mcpField
A
analyzing-supply-chain-malware-artifacts

analyzing-supply-chain-malware-artifacts

github.com/mukul975セキュリティ35.2k286 回インストール8 週間前に更新
リポジトリ

analyzing-supply-chain-malware-artifacts について

インシデント対応担当者や SOC アナリスト向けのサプライチェーンマルウェア分析スキルです。トロイの木馬化されたバイナリの比較、署名異常の確認、感染経路の再構築を扱います。

主な機能

  1. 01改ざん版と正規バイナリの比較
  2. 02注入コードの特定と分析
  3. 03コード署名の異常を記録
  4. 04ビルド成果物から感染時系列を再構築
  5. 05下流への影響範囲を評価
  6. 06検知・遮断用 IOC の抽出

活用シーン

  1. 01ソフトウェアサプライチェーン侵害の調査
  2. 02関連攻撃の検知ルール作成
  3. 03影響を受けたシステムと感染経路の追跡
  4. 04セキュリティ監視範囲の検証

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-supply-chain-malware-artifacts

インストール後、Claude Code で/analyzing-supply-chain-malware-artifactsを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py

詳細

サプライチェーンマルウェアのアーティファクトを分析する

概要

サプライチェーン攻撃は、正規のソフトウェア配布チャネルを侵害し、信頼された更新メカニズムを通じてマルウェアを配信します。代表的な例として、SolarWinds SUNBURST(2020年、18,000社以上に影響)、3CX SmoothOperator(2023年、Trading Technologiesを起点とする連鎖型サプライチェーン攻撃)、および多数のnpm/PyPIパッケージ汚染キャンペーンが挙げられます。分析では、トロイの木馬化されたバイナリと正規バージョンを比較し、ビルド成果物に注入されたコードを特定し、コード署名の異常を調査して、最初の侵害からペイロードの配信に至るまでの感染経路を追跡します。2025年時点で、サプライチェーン攻撃はすべての侵害の30%を占めており、前年までと比べて100%増加しています。

使用する場面

  • サプライチェーンマルウェアのアーティファクト分析が必要なセキュリティインシデントを調査する場合
  • この分野の検出ルールや脅威ハンティングクエリを作成する場合
  • SOC アナリストがこの種の分析に関する体系的な手順を必要とする場合
  • 関連する攻撃手法に対するセキュリティ監視のカバレッジを検証する場合

前提条件

  • pefile、ssdeep、hashlib を備えた Python 3.9+
  • バイナリ差分ツール(BinDiff、Diaphora)
  • コード署名検証ツール(sigcheck、codesign)
  • ソフトウェア構成分析(SCA)ツール
  • 比較用の正規ソフトウェアバージョンへのアクセス
  • パッケージリポジトリの監視(npm、PyPI、NuGet)

ワークフロー

ステップ 1:バイナリ比較分析
#!/usr/bin/env python3
"""Compare trojanized binary against legitimate version."""
import hashlib
import pefile
import sys
import json


def compare_pe_files(legitimate_path, suspect_path):
    """Compare PE file structures between legitimate and suspect versions."""
    legit_pe = pefile.PE(legitimate_path)
    suspect_pe = pefile.PE(suspect_path)

    report = {"differences": [], "suspicious_sections": [], "import_changes": []}

    # Compare sections
    legit_sections = {s.Name.rstrip(b'\x00').decode(): {
        "size": s.SizeOfRawData,
        "entropy": s.get_entropy(),
        "characteristics": s.Characteristics,
    } for s in legit_pe.sections}

    suspect_sections = {s.Name.rstrip(b'\x00').decode(): {
        "size": s.SizeOfRawData,
        "entropy": s.get_entropy(),
        "characteristics": s.Characteristics,
    } for s in suspect_pe.sections}

    # Find new or modified sections
    for name, props in suspect_sections.items():
        if name not in legit_sections:
            report["suspicious_sections"].append({
                "name": name, "reason": "New section not in legitimate version",
                "size": props["size"], "entropy": round(props["entropy"], 2),
            })
        elif abs(props["size"] - legit_sections[name]["size"]) > 1024:
            report["suspicious_sections"].append({
                "name": name, "reason": "Section size significantly changed",
                "legit_size": legit_sections[name]["size"],
                "suspect_size": props["size"],
            })

    # Compare imports
    legit_imports = set()
    if hasattr(legit_pe, 'DIRECTORY_ENTRY_IMPORT'):
        for entry in legit_pe.DIRECTORY_ENTRY_IMPORT:
            for imp in entry.imports:
                if imp.name:
                    legit_imports.add(f"{entry.dll.decode()}!{imp.name.decode()}")

    suspect_imports = set()
    if hasattr(suspect_pe, 'DIRECTORY_ENTRY_IMPORT'):
        for entry in suspect_pe.DIRECTORY_ENTRY_IMPORT:
            for imp in entry.imports:
                if imp.name:
                    suspect_imports.add(f"{entry.dll.decode()}!{imp.name.decode()}")

    new_imports = suspect_imports - legit_imports
    if new_imports:
        report["import_changes"] = list(new_imports)

    # Check code signing
    report["legit_signed"] = bool(legit_pe.OPTIONAL_HEADER.DATA_DIRECTORY[4].Size)
    report["suspect_signed"] = bool(suspect_pe.OPTIONAL_HEADER.DATA_DIRECTORY[4].Size)

    return report


def hash_file(filepath):
    """Calculate multiple hashes for a file."""
    hashes = {}
    with open(filepath, 'rb') as f:
        data = f.read()
    for algo in ['md5', 'sha1', 'sha256']:
        h = hashlib.new(algo)
        h.update(data)
        hashes[algo] = h.hexdigest()
    return hashes


if __name__ == "__main__":
    if len(sys.argv) < 3:
        print(f"Usage: {sys.argv[0]} <legitimate_binary> <suspect_binary>")
        sys.exit(1)
    report = compare_pe_files(sys.argv[1], sys.argv[2])
    print(json.dumps(report, indent=2))

検証基準

  • バイナリ差分によってトロイの木馬化されたコンポーネントを特定している
  • 注入されたコードを分離し、個別に分析している
  • コード署名の異常を記録している
  • ビルド成果物から感染のタイムラインを再構築している
  • 影響を受けたシステム全体で下流への影響範囲を評価している
  • 検出およびブロック用の IOC を抽出している

参考資料

コメント