0
0

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.

VulsRepoでunscored CVEsを含むVulsレポートを読み込もうとすると止まるので応急処置してみた事

Posted at

概要

VulsRepoで特定のVulsレポートを読み込ませた時に止まってしまったのを取り敢えず表示できるところまでもっていったメモです。

環境は以下になります。
Vuls v0.6.3
2019年2月23日時点のVulsRepo
表示ブラウザはFirefox 65.0.1、Chrome 72.0.3626.109

状況

VulsRepoでレポート情報を読み込ませていると、表示できるサーバと読み込ませた時にロード表示で止まってしまうサーバがある。
ブラウザの開発ツールのコンソールには vulsrepo.js について以下メッセージが表示される。

Chromeの場合
Uncaught TypeError: Cannot read property 'nvd' of undefined
Firefoxの場合
TypeError: y_val.cveContents is undefined

コンソールで出ていたメッセージの該当行を見ると以下の部分。

vulsrepo.js
                    if (y_val.cveContents.nvd !== undefined) {
                        result["CweID"] = y_val.cveContents.nvd.cweIDs;
                    } else {
                        result["CweID"] = "None";
                    }

上記の内容から cveContents の参照に何かあるのだろうなと。

確認

読み込み失敗してしまうサーバレポートのjsonデータの読み込みを確認。

console.info(y_val.cveContents.nvd);

上記を差し込んで見てみると、レポートの診断情報を数個読み込んだ後に途中で失敗してしまっている事が分かった。
読み込み失敗している診断情報の該当部分を確認してみると以下のような内容で「cveContents」が存在しない。(読み込み成功していたものは「cveContents」を含んでいた)

    "CVE-2018-12384": {
      "cveID": "CVE-2018-12384",
      "confidences": [
        {
          "score": 100,
          "detectionMethod": "OvalMatch"
        }
      ],
      "affectedPackages": [
        {
          "name": "nss",
          "notFixedYet": false,
          "fixState": ""
        }
      ],
      "alertDict": {
        "ja": null,
        "en": null
      }
    },

vuls reportコマンドのオプションでは除外ケースがある「-ignore-unscored-cves」(Don't report the unscored CVEs)のように、CVE情報(cveContents)が含まれないケースがあって、それがエラーに影響していそうという事が分かった。

応急処置

「y_val.cveContents」の部分が未定義の場合空にしておけば影響出さずにパス出来そうだなとvulsrepo.jsをざっくり確認して、以下のように修正。

vulsrepo.js(修正後)
                    if (y_val.cveContents === undefined) {
                        y_val.cveContents = "";
                    }

                    if (y_val.cveContents.nvd !== undefined) {
                        result["CweID"] = y_val.cveContents.nvd.cweIDs;
                    } else {
                        result["CweID"] = "None";
                    }

以上で、読み込みが止まってしまっていたサーバ情報もVulsRepoで表示できるようになった。
*取り敢えず表示が見たいために行った応急処置なので実際利用する場合はコード確認してください

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?