1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitHub から脆弱性警告メールが来て、対応に苦労した話

Posted at

発端

メールを受信すると、以下タイトルが目に入る。

Your GitHub security alerts for the week of Nov 5 - Nov 12

恐る恐る中を見ると

com.fasterxml.jackson.core:jackson-databind dependency
------------------------------------------------
Vulnerable versions: < 2.9.10.1
Upgrade to: 2.9.10.1
Defined in: pom.xml
Vulnerabilities: CVE-2019-16942 (Moderate severity)

どうやら自分がgithubにアップしてるツールで使ってる jackson-databind ライブラリに脆弱性が見つかった様子。

初動

ライブラリバージョンの問題っぽいので、pom.xml のバージョン指定を変更すれば済みそう。指示通り、2.9.10 を 2.9.10.1 にして mvn package してみる。

[ERROR] Failed to execute goal on project glacier-tool: Could not resolve dependencies for project com.mytools:glacier-tool:jar:1.0-SNAPSHOT: Failure to find com.fasterxml.jackson.core:jackson-annotations:jar:2.9.10.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

調査その1

へ?と思い、 https://repo.maven.apache.org/maven2/ を見てみるが、確かに2.9.10.1が無い。こっちのページ からすると存在していそうなのに。ここにあるからには2.9.10.1が存在するCentralなリポジトリがあるはず。Central とあるタグをクリックすると https://repo1.maven.org/maven2/ がCentralのURLらしい。でも こっちのリポジトリ にも2.9.10.1は無いんですけど!
念のため、%maven-home%\conf\settings.xml のmirrors タグ配下に以下追加して mvn package 実行してみるもやっぱり失敗。

settings.xml
    <mirror>
      <id>central-proxy</id>
      <name>Central Repository</name>
      <url>https://repo1.maven.org/maven2/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>

補足:やはり正式(?)には無指定時のリポジトリURLがデフォルトらしい。
https://github.com/apache/maven/blob/maven-3.6.0/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java#L56-L58

調査その2

参照するリポジトリを変更するのは結局自分は良くても他の人では問題が出る事になる。使う人はほぼいないと思うが、公開している以上、対応したい。他の方法を探す。
条件は冒頭に引用した通り。2.10.0ならOKなのか?という希望を追う。

Vulnerable versions: < 2.9.10.1

メールにあった脆弱性管理番号と思われる CVE-2019-16942 という単語を検索してみる。以下ページを得る。

https://nvd.nist.gov/vuln/detail/CVE-2019-16942
https://jvndb.jvn.jp/ja/contents/2019/JVNDB-2019-010253.html

対象が「Jackson-databind 2.0.0 から 2.9.10」との事で、2.10.0でも大丈夫の様子。ご丁寧に、githubのissueへのリンク もあったので飛ぶ。

2.9.10.1に関しては、ファミリーの jackson-bom の version 2.9.10.20191020 だけ、MicroPatchとして出ているらしい。試しにpom.xmlにdependency追加して mvn dependency:tree してみる。

[INFO] +- com.fasterxml.jackson:jackson-bom:pom:2.9.10.20191020:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.10:compile
[INFO] | - com.fasterxml.jackson.core:jackson-core:jar:2.9.10:compile
[INFO] - com.fasterxml.jackson.core:jackson-annotations:jar:2.9.10:compile

jackson-bomは他のから独立してるみたいですね。なんとなくこの状況なら2.9.10を使っても大丈夫そうな雰囲気。他のファミリーに2.9.10.1が出ていないのが、まだ出てないのか、必要がないから出てないのかちょっと今の時点では判断できず。なんにせよ自分のツールでは2.9.10系である絶対的必要性は無いので、2.10.0 にする事に決めた。無事ビルド成功。

まとめ

脆弱性に関する情報を読んでから対応しましょう

残った謎

  • mavenの正式Centralリポジトリってどこなんだろう?多分無指定時の方が正式だと思うが。前述2つは実体同じものだったりするのかな?
  • この類の脆弱性って誰がどうやって見つけてるのだろう? => 資料ありました
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?