Communitygithub.com

Cuckooサンドボックスによるマルウェア動作分析

Cuckoo Sandboxでマルウェアサンプルを実行し、ランタイムの動作を観察します。

Cuckooサンドボックスによるマルウェア動作分析 とは?

このスキルは、セキュリティアナリストやマルウェア研究者がCuckoo Sandboxを使用して、悪意のあるサンプルの動的解析を実施するための完全なガイドです。Cuckooはオープンソースの自動マルウェア解析システムで、隔離環境でファイルを実行し、APIコール、ファイルシステム操作、レジストリ変更、ネットワークトラフィック、メモリダンプなどの詳細な動作レポートを生成します。このスキルでは、コマンドラインまたはREST APIを使用したサンプル送信、実行中の動作のリアルタイム監視、プロセスツリーやネットワーク活動の分析、ファイル/レジストリ変更の確認、動作シグネチャの評価、Volatilityを使用したメモリダンプのフォレンジック分析など、ステップバイステップのワークフローを提供します。特に、マルチステージドロッパーの分析シナリオや、InetSim/FakeNet-NGを使ったネットワーク分離の設定、分析タイムアウトやサンドボックス回避検出の落とし穴についても詳しく解説しています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-malware-behavior-with-cuckoo-sandbox

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

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

ドキュメント

Cuckooサンドボックスによるマルウェア動作分析 は何をしますか?

使用すべき場面

  • 不審なサンプルが静的解析トリアージを通過し、管理された環境で動的な動作観察が必要な場合
  • マルウェア実行によるネットワークトラフィック、ファイルドロップ、レジストリ変更、APIコールを取得する必要がある場合
  • セカンドステージペイロードのダウンロードや永続化メカニズムを含む完全な感染チェーンを特定する場合
  • 観察されたランタイムアクティビティに基づいて動作シグネチャやYARAルールを生成する場合
  • 一貫したレポートが求められる大量のマルウェアサンプルの自動分析を行う場合

使用すべきでない場面: サンプルが既知のランサムウェア亜種であり、設定ミスのあるサンドボックスでネットワーク共有を介して拡散する可能性がある場合。先にネットワーク分離を確認してください。

前提条件

  • 専用解析サーバー(Ubuntu 22.04推奨)にCuckoo Sandbox 3.xがインストールされていること
  • Windows 10/11のスナップショットが設定されたゲストVM(Cuckooエージェントインストール済み、クリーンな状態でスナップショット取得)
  • VirtualBox、KVM、またはVMwareがCuckooの仮想化バックエンドとして設定されていること
  • インターネットサービスをシミュレートするためのInetSimまたはFakeNet-NGを使用した隔離ネットワーク
  • 解析中のネットワークレベルシグネチャマッチングのためにSuricataまたはSnortが統合されていること
  • PCAPキャプチャとメモリダンプに十分なディスク容量(最低500 GB推奨)

ワークフロー

ステップ1: サンプルをCuckooに送信

自動解析のためにマルウェアサンプルを送信します:

# コマンドラインで送信
cuckoo submit /path/to/suspect.exe

# 特定の解析タイムアウトを指定(300秒)
cuckoo submit --timeout 300 /path/to/suspect.exe

# 特定のVMと解析パッケージを指定
cuckoo submit --machine win10_x64 --package exe --timeout 300 /path/to/suspect.exe

# REST API経由で送信
curl -F "[email protected]" -F "timeout=300" -F "machine=win10_x64" \
  http://localhost:8090/tasks/create/file

# URLを解析用に送信
curl -F "url=http://malicious-site.com/payload" -F "timeout=300" \
  http://localhost:8090/tasks/create/url

# タスクステータスを確認
curl http://localhost:8090/tasks/view/1 | jq '.task.status'

ステップ2: 実行をリアルタイムで監視

解析の進行状況を追跡し、ライブの動作を観察します:

# Cuckoo解析ログを監視
tail -f /opt/cuckoo/log/cuckoo.log

# 解析タスクのステータスを監視
cuckoo status

# ライブスクリーンショットとプロセスツリーのためにCuckoo Webインターフェースにアクセス
# http://localhost:8080/analysis/<task_id>/ にアクセス

実行中に監視すべき主要な動作イベント:

  • プロセス生成チェーン(親子関係)
  • 外部IPへのネットワーク接続試行
  • 一時ディレクトリやシステムフォルダへのファイルドロップ
  • Runキーやサービスエントリへのレジストリ変更
  • 暗号化(CryptEncrypt)、インジェクション(WriteProcessMemory)、回避などに関するAPIコール

ステップ3: プロセスアクティビティを分析

CuckooレポートからプロセスツリーとAPIコールトレースをレビューします:

# Cuckoo JSONレポートをプログラムで解析
import json

with open("/opt/cuckoo/storage/analyses/1/reports/report.json") as f:
    report = json.load(f)

# プロセスツリー分析
for process in report["behavior"]["processes"]:
    pid = process["pid"]
    ppid = process["ppid"]
    name = process["process_name"]
    print(f"PID: {pid} PPID: {ppid} Name: {name}")

    # 不審なAPIコールを抽出
    for call in process["calls"]:
        api = call["api"]
        if api in ["CreateRemoteThread", "VirtualAllocEx", "WriteProcessMemory",
                    "NtCreateThreadEx", "RegSetValueExA", "URLDownloadToFileA"]:
            args = {arg["name"]: arg["value"] for arg in call["arguments"]}
            print(f"  [!] {api}({args})")

ステップ4: ネットワークアクティビティをレビュー

ネットワーク接続、DNSクエリ、HTTPリクエストを調査します:

# Cuckooレポートからのネットワーク分析
network = report["network"]

# DNS解決
print("DNSクエリ:")
for dns in network.get("dns", []):
    print(f"  {dns['request']} -> {dns.get('answers', [])}")

# HTTPリクエスト
print("\nHTTPリクエスト:")
for http in network.get("http", []):
    print(f"  {http['method']} {http['uri']} (Host: {http['host']})")
    if http.get("body"):
        print(f"    Body: {http['body'][:200]}")

# TCP接続
print("\nTCP接続:")
for tcp in network.get("tcp", []):
    print(f"  {tcp['src']}:{tcp['sport']} -> {tcp['dst']}:{tcp['dport']}")

# 詳細なWireshark解析のためにPCAPを抽出
# PCAPの場所: /opt/cuckoo/storage/analyses/1/dump.pcap

ステップ5: ファイルシステムとレジストリの変更を調査

永続化メカニズムとドロップされたファイルを文書化します:

# ファイル操作
print("作成/変更されたファイル:")
for f in report["behavior"].get("summary", {}).get("files", []):
    print(f"  {f}")

# ハッシュ付きのドロップされたファイル
print("\nドロップされたファイル:")
for dropped in report.get("dropped", []):
    print(f"  パス: {dropped['filepath']}")
    print(f"  SHA-256: {dropped['sha256']}")
    print(f"  サイズ: {dropped['size']} バイト")
    print(f"  タイプ: {dropped['type']}")

# レジストリ変更
print("\n変更されたレジストリキー:")
for key in report["behavior"].get("summary", {}).get("keys", []):
    print(f"  {key}")

ステップ6: シグネチャとスコアリングをレビュー

Cuckooの動作シグネチャと脅威スコアリングを確認します:

# トリガーされた動作シグネチャ
print("トリガーされたシグネチャ:")
for sig in report.get("signatures", []):
    severity = sig["severity"]
    name = sig["name"]
    description = sig["description"]
    marker = "[!]" if severity >= 3 else "[*]"
    print(f"  {marker} [{severity}/5] {name}: {description}")
    for mark in sig.get("marks", []):
        if mark.get("call"):
            print(f"      API: {mark['call']['api']}")
        if mark.get("ioc"):
            print(f"      IOC: {mark['ioc']}")

# 全体スコア
score = report.get("info", {}).get("score", 0)
print(f"\n全体的な脅威スコア: {score}/10")

ステップ7: メモリダンプのアーティファクトを抽出

実行中にキャプチャされた完全なメモリダンプを分析します:

# メモリダンプの保存場所:
# /opt/cuckoo/storage/analyses/1/memory.dmp

# Volatilityを使用してメモリダンプを分析
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.pslist
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.malfind
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.netscan

主要な概念

用語定義
動的解析管理された環境でマルウェアを実行し、システムコール、ネットワークアクティビティ、ファイル操作などのランタイム動作を観察すること
サンドボックス回避マルウェアが仮想/サンドボックス環境を検出し、動作を変更して解析を回避するために使用する手法(スリープタイマー、VMチェック、ユーザーインタラクションチェック)
APIフックCuckooがマルウェアによるWindows APIコールをインターセプトし、関数名、パラメータ、戻り値をログに記録する方法
InetSim隔離された解析ネットワーク内でマルウェアのネットワークリクエスト(HTTP、DNS、SMTP)に応答するインターネットサービスシミュレーションツール
プロセスインジェクションマルウェアが正規のプロセスにコードを注入する手法。VirtualAllocExやWriteProcessMemoryのAPIシーケンスを監視することで検出
動作シグネチャ特定のAPIコール、ファイル操作、ネットワークアクティビティのシーケンスを既知のマルウェア動作と照合するルールベースの検出
解析パッケージゲストVM内で特定のファイルタイプ(exe、dll、pdf、doc)を適切に実行し、動作をキャプチャするためのCuckooモジュール

ツールとシステム

  • Cuckoo Sandbox: 動作レポート、ネットワークキャプチャ、メモリダンプを提供するオープンソースの自動マルウェア解析システム
  • InetSim: 隔離されたマルウェア解析ネットワーク向けに偽のHTTP、DNS、SMTP、その他のサービスを提供するインターネットサービスシミュレーションスイート
  • FakeNet-NG: FLAREチームのネットワークシミュレーションツール。すべてのネットワークトラフィックをインターセプトし、解析用にリダイレクト
  • Suricata: Cuckooと統合されたネットワークIDS/IPS。悪意のあるネットワークトラフィックのリアルタイムシグネチャベース検出を実現
  • Volatility: Cuckoo解析中にキャプチャされたメモリダンプを分析するためのメモリフォレンジックフレームワーク

よくあるシナリオ

シナリオ: マルチステージドロッパーの分析

コンテキスト: 静的解析により、最小限のインポートと高いエントロピーを持つパックされた実行ファイルが明らかになる。アンパック、ペイロード配信、C2確立を観察するためにサンドボックス実行が必要。

アプローチ:

  1. 拡張タイムアウト(600秒)でサンプルをCuckooに送信し、低速な動作をキャプチャ
  2. 子プロセス生成(ドロッパーがペイロードプロセスを生成)のプロセスツリーをレビュー
  3. %TEMP%、%APPDATA%、システムディレクトリにドロップされたファイルを特定
  4. ドロップされたファイルを抽出し、個別解析のためにハッシュを計算
  5. ネットワーク接続をマッピングし、初期実行後に接触したC2インフラを特定
  6. レジストリ変更から永続化メカニズム(Runキー、スケジュールタスク、サービス)を確認
  7. 動作シグネチャを既知のマルウェアファミリと比較

落とし穴:

  • 不十分な解析タイムアウトにより、セカンドステージペイロードが実行される前にサンドボックスが終了してしまう
  • InetSimをDNSおよびHTTPリクエストに応答するように設定していないため、マルウェアがC2チェックインを通過できない
  • サンドボックス回避検出を無視する。サンプルが即座に終了する場合、仮想環境を検出している可能性がある
  • ドロップされたファイルを個別に分析しない。初期ドロッパーよりも最終ペイロードの方が興味深い場合がある

出力形式

動的解析レポート - CUCKOO SANDBOX
==========================================
タスクID:         1547
サンプル:          suspect.exe (SHA-256: e3b0c44298fc1c149afbf4c8996fb924...)
解析時間:         300秒
VM:                win10_x64 (Windows 10 21H2)
スコア:            8.5/10

プロセスツリー
suspect.exe (PID: 2184)
  └── cmd.exe (PID: 3456)
      └── powershell.exe (PID: 4012)
          └── svchost_fake.exe (PID: 4568)

ファイルシステムアクティビティ
[作成]  C:\Users\Admin\AppData\Local\Temp\payload.dll
[作成]  C:\Windows\System32\svchost_fake.exe
[変更]  C:\Windows\System32\drivers\etc\hosts

レジストリ変更
[設定] HKCU\Software\Microsoft\Windows\CurrentVersion\Run\WindowsUpdate = "C:\Windows\System32\svchost_fake.exe"
[設定] HKLM\SYSTEM\CurrentControlSet\Services\FakeService\ImagePath = "C:\Windows\System32\svchost_fake.exe"

ネットワークアクティビティ
DNS:    update.malicious[.]com -> 185.220.101.42
HTTP:   POST hxxps://185.220.101[.]42/gate.php (ビーコン)
TCP:    10.0.2.15:49152 -> 185.220.101.42:443 (237接続)

動作シグネチャ
[!] [4/5] injection_createremotethread: リモートプロセスにコードを注入
[!] [4/5] persistence_autorun: 永続化のためにRunレジストリキーを変更
[!] [3/5] network_cnc_http: HTTP C2通信を実行
[*] [2/5] antiav_detectfile: アンチウイルス製品ファイルをチェック

ドロップされたファイル
payload.dll    SHA-256: abc123... サイズ: 98304  タイプ: PE32 DLL
svchost_fake.exe SHA-256: def456... サイズ: 184320 タイプ: PE32 EXE

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,

関連スキル