Communitygithub.com

SBOMサプライチェーン脆弱性分析

CycloneDXおよびSPDX JSON形式のソフトウェア部品表(SBOM)を解析し、NVDデータベースと照合して既知の脆弱性を特定、依存関係グラフとリスクスコアを生成します。

SBOMサプライチェーン脆弱性分析 とは?

このスキルは、SBOM(ソフトウェア部品表)を解析してサプライチェーン脆弱性を評価するための包括的なワークフローを提供します。CycloneDX(v1.4+)およびSPDX JSON(v2.3+)形式のSBOMファイルを入力として受け取り、NVD APIを通じて各コンポーネントの既知の脆弱性(CVE)を検索、依存関係グラフを構築して推移的依存関係を含むリスク伝搬を追跡します。さらに、Grypeによるクロスバリデーションや、CISA KEVカタログに基づく重要度評価を含むコンプライアンスレポートを生成可能です。主なユースケースには、新しい規制要件(大統領令14028、EUサイバーレジリエンス法)への対応、ベンダー提供SBOMの第三者リスク評価、CI/CDパイプラインへの自動脆弱性チェック組み込み、新たに開示されたCVEの影響分析、調達前のリスク評価などがあります。本スキルは、パッケージURL(PURL)や共通プラットフォーム列挙(CPE)などの業界標準識別子を活用して、NVD、GitHub Security Advisories、Alpine SecDBなど複数の脆弱性データベースと効率的に連携します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-sbom-for-supply-chain-vulnerabilities

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Analyzing SBOM for Supply Chain Vulnerabilities

使用すべき状況

  • 新しい規制要件(EO 14028、EU CRA)によりソフトウェア納品時のSBOM分析が義務付けられている場合
  • セキュリティチームが、ベンダー提供のSBOMをスキャンしてサードパーティリスクを評価する必要がある場合
  • CI/CDパイプラインで、生成されたSBOMに対する自動脆弱性チェックが必要な場合
  • インシデント対応において、新たに開示されたCVEがデプロイ済みソフトウェアに影響するかを判断する必要がある場合
  • 調達部門がソフトウェア導入のためのサプライチェーンリスク評価を必要とする場合

使用しないでください:稼働中のシステムのランタイム脆弱性スキャンには使用しないでください。代わりにコンテナスキャンツール(Trivy、Grype CLI)やホストベースの脆弱性スキャナ(Nessus、Qualys)を使用してください。

前提条件

ワークフロー

ステップ1:SBOMの生成(提供されていない場合)

syftを使用して、コンテナイメージまたはプロジェクトディレクトリからSBOMを作成します:

# コンテナイメージからCycloneDX JSONを生成
syft alpine:latest -o cyclonedx-json > sbom-cyclonedx.json

# プロジェクトディレクトリからSPDX JSONを生成
syft dir:/path/to/project -o spdx-json > sbom-spdx.json

# 実行中のコンテナから生成
syft docker:my-app-container -o cyclonedx-json > sbom.json

syftはnpm、PyPI、Maven、Goモジュール、apt、apk、RPMを含む30以上のパッケージエコシステムをサポートします。生成されたSBOMには、パッケージ名、バージョン、ライセンス、CPE識別子、PURL(Package URL)参照が含まれます。

ステップ2:SBOMの解析とコンポーネントの抽出

SBOMを解析して、すべてのソフトウェアコンポーネントとその識別子を抽出します:

CycloneDX JSON構造:

{
  "bomFormat": "CycloneDX",
  "specVersion": "1.5",
  "components": [
    {
      "type": "library",
      "name": "lodash",
      "version": "4.17.20",
      "purl": "pkg:npm/[email protected]",
      "cpe": "cpe:2.3:a:lodash:lodash:4.17.20:*:*:*:*:*:*:*",
      "licenses": [{"license": {"id": "MIT"}}]
    }
  ],
  "dependencies": [
    {"ref": "pkg:npm/[email protected]", "dependsOn": ["pkg:npm/[email protected]"]}
  ]
}

SPDX JSON構造:

{
  "spdxVersion": "SPDX-2.3",
  "packages": [
    {
      "name": "lodash",
      "versionInfo": "4.17.20",
      "externalRefs": [
        {"referenceType": "purl", "referenceLocator": "pkg:npm/[email protected]"},
        {"referenceType": "cpe23Type", "referenceLocator": "cpe:2.3:a:lodash:lodash:4.17.20:*:*:*:*:*:*:*"}
      ],
      "licenseConcluded": "MIT"
    }
  ],
  "relationships": [
    {"spdxElementId": "SPDXRef-express", "relatedSpdxElement": "SPDXRef-lodash",
     "relationshipType": "DEPENDS_ON"}
  ]
}

ステップ3:コンポーネントとNVD CVEデータベースの関連付け

NVD 2.0 APIにクエリを送信して、各コンポーネントの既知の脆弱性を検索します:

import requests

NVD_API = "https://services.nvd.nist.gov/rest/json/cves/2.0"

def search_cves_by_cpe(cpe_name, api_key=None):
    params = {"cpeName": cpe_name, "resultsPerPage": 50}
    headers = {"apiKey": api_key} if api_key else {}
    resp = requests.get(NVD_API, params=params, headers=headers, timeout=30)
    resp.raise_for_status()
    return resp.json().get("vulnerabilities", [])

def search_cves_by_keyword(keyword, version=None, api_key=None):
    params = {"keywordSearch": keyword, "resultsPerPage": 50}
    headers = {"apiKey": api_key} if api_key else {}
    resp = requests.get(NVD_API, params=params, headers=headers, timeout=30)
    resp.raise_for_status()
    return resp.json().get("vulnerabilities", [])

NVD APIは、CPE名(最も正確)、キーワード、CVE ID、日付範囲による検索をサポートします。レート制限:APIキーなしで5リクエスト/30秒、キーありで50リクエスト/30秒。

ステップ4:依存関係グラフの構築と推移的リスクの特定

依存関係の有向グラフを構築して、脆弱性の伝播を追跡します:

import networkx as nx

def build_dependency_graph(sbom):
    G = nx.DiGraph()
    # 各コンポーネントのノードを追加
    for comp in sbom["components"]:
        G.add_node(comp["purl"], name=comp["name"], version=comp["version"])
    # 依存関係からエッジを追加
    for dep in sbom.get("dependencies", []):
        for child in dep.get("dependsOn", []):
            G.add_edge(dep["ref"], child)
    return G

推移的依存関係分析により、直接含まれていないが依存関係チェーンを通じて取り込まれるコンポーネントを特定します。深くネストされた推移的依存関係(例:4レベル深い)の脆弱性もリスクを表しますが、修正が難しい場合があります。

リスク評価のための主要なグラフ指標:

  • 入次数(In-degree):このコンポーネントに依存するコンポーネントの数(高入次数 = 広い影響範囲)
  • ルートへの最短パス:アプリケーションエントリポイントからの距離(近いほど悪用されやすい)
  • 媒介中心性(Betweenness centrality):多くの依存パス上に位置するコンポーネント(ボトルネックリスク)

ステップ5:リスクスコアの計算

脆弱性データをコンポーネントおよび全体のリスクスコアに集約します:

リスクスコア計算:
━━━━━━━━━━━━━━━━━━━━━━━━━━
コンポーネントリスク = コンポーネントに影響する全CVEのCVSSスコアの最大値

加重リスク = コンポーネントリスク × 依存係数
  ここで、依存係数 = 1.0 + (0.1 × 入次数)
  (依存数が多いほど組織への影響が大きい)

SBOM全体のリスク = 全コンポーネントリスクの加重平均
  依存関係の中心性で重み付け

リスクレベル:
  CRITICAL: CVSS >= 9.0 または既知の悪用(CISA KEV)
  HIGH:     CVSS >= 7.0
  MEDIUM:   CVSS >= 4.0
  LOW:      CVSS < 4.0

ステップ6:Grypeによるクロスバリデーション

grypeを使用してSBOMを独立してスキャンし、結果を比較します:

# CycloneDX SBOMをgrypeでスキャン
grype sbom:sbom-cyclonedx.json -o json > grype-results.json

# SPDX SBOMをスキャン
grype sbom:sbom-spdx.json -o table

# 深刻度でフィルタ
grype sbom:sbom-cyclonedx.json --only-fixed --fail-on critical

grypeは、NVD、GitHub Security Advisories、Alpine SecDB、Red Hat、Debian、Ubuntu、Amazon Linux、Oracleのセキュリティデータベースから脆弱性データを取得し、NVD単独よりも広いカバレッジを提供します。

ステップ7:コンプライアンスレポートの生成

規制コンプライアンスに適した構造化レポートを生成します:

SBOM 脆弱性分析レポート
═════════════════════════════
SBOMファイル:         app-sbom-cyclonedx.json
形式:            CycloneDX v1.5
分析日:             2026-03-19
総コンポーネント数:  247
総依存関係数:       1,842 (直接: 34, 推移的: 213)

脆弱性サマリー
  Critical:  3 コンポーネント / 5 CVE
  High:      11 コンポーネント / 18 CVE
  Medium:    27 コンポーネント / 41 CVE
  Low:       8 コンポーネント / 12 CVE

Critical 検出結果
1. [email protected]
   CVE-2021-23337 (CVSS 7.2) - テンプレート経由のコマンドインジェクション
   CVE-2020-28500 (CVSS 5.3) - trimEndのReDoS
   依存数: 14コンポーネント(広い影響範囲)
   修正: 4.17.21+ へアップグレード

2. [email protected]
   CVE-2021-44228 (CVSS 10.0) - Log4Shell RCE [CISA KEV]
   CVE-2021-45046 (CVSS 9.0) - 不完全な修正の回避
   依存数: 8コンポーネント
   修正: 2.17.1+ へアップグレード

依存関係グラフリスク
  最も依存されている: [email protected] (47の依存元)
  最も深いチェーン: app -> framework -> adapter -> codec -> zlib (5レベル)
  ボトルネックコンポーネント: 依存パスの50%以上に存在する3つのコンポーネント

ライセンスコンプライアンス
  Copyleftライセンス発見: 2 (libxml2のGPL-3.0、mongodb-driverのAGPL-3.0)
  商用配布にはレビューが必要

主要概念

用語定義
SBOMソフトウェア部品表。ソフトウェア製品内の全コンポーネント、ライブラリ、依存関係の正式な棚卸し
CycloneDXOWASPが維持するSBOM標準。JSON、XML、protobuf形式をサポートし、依存関係グラフと脆弱性データを含む
SPDXLinux FoundationのSBOM標準。ライセンスコンプライアンスに重点を置き、パッケージ、ファイル、スニペットレベルの詳細をサポート
PURLPackage URL。エコシステム全体でソフトウェアパッケージを識別する標準化されたスキーム(例:pkg:npm/[email protected])
CPE共通プラットフォーム列挙。IT製品向けのNIST命名スキームで、NVD CVEデータとの関連付けに使用
NVD米国国家脆弱性データベース。CVE識別子でインデックスされた脆弱性データの米国政府リポジトリ
推移的依存関係直接宣言されていないが、直接依存関係の依存チェーンを通じて取り込まれる依存関係
CISA KEVCISA既知の悪用脆弱性カタログ。実際に悪用されていることが確認されたCVE

ツールとシステム

  • syft (Anchore):オープンソースのSBOM生成ツール。30以上のパッケージエコシステムとCycloneDX/SPDX出力をサポート
  • grype (Anchore):SBOMを入力として受け取り、複数のアドバイザリデータベースと相関させる脆弱性スキャナ
  • cyclonedx-python-lib:プログラムでCycloneDX SBOMを作成、解析、検証するためのPythonライブラリ
  • lib4sbom:SPDXとCycloneDXの両形式のSBOMを解析するPythonライブラリ
  • nvdlib:レート制限管理を備えたNVD 2.0 APIのPythonラッパー。CVEおよびCPEクエリをサポート
  • OWASP Dependency-Track:継続的なSBOM分析、脆弱性追跡、ポリシー実施のためのプラットフォーム

一般的なシナリオ

シナリオ:Log4Shell開示後のベンダーソフトウェア評価

背景:Log4Shell(CVE-2021-44228)の開示後、セキュリティチームは、どのベンダー提供アプリケーションに脆弱なバージョンのlog4jが含まれているかを判断する必要があります。複数のベンダーが契約要件に従ってSBOMを提供しています。

アプローチ:

  1. すべてのベンダーSBOMを収集(CycloneDXまたはSPDX JSON形式)
  2. 各SBOMを解析し、バージョン < 2.17.1 のlog4j-coreコンポーネントを検索
  3. NVD APIに特定のCVE(CVE-2021-44228、CVE-2021-45046、CVE-2021-45105)を照会
  4. 依存関係グラフを構築し、どのアプリケーションコンポーネントがlog4jに依存しているかを特定
  5. 影響範囲の計算:露出しているサービスとエンドポイントの数
  6. 露出とビジネス重要度で優先順位付けされた修正レポートを生成
  7. 同じSBOMに対するgrypeスキャンで結果をクロスバリデーション

注意点:

  • ベンダーSBOMは不完全である可能性があり、log4jを埋め込んだshaded/bundled JARファイルを見逃す可能性がある
  • SPDXとCycloneDXのバージョン違いがパーサーの互換性に影響する可能性がある
  • NVD APIのレート制限により、APIキーなしで数百のコンポーネントをスキャンする際に分析が遅くなる可能性がある
  • SBOM内のCPE名がNVDエントリと完全に一致しない場合があり、ファジーマッチングが必要になる
  • 推移的依存関係には、直接依存関係でなくてもlog4jが含まれる可能性がある

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

関連スキル