Communitygithub.com

Windowsレジストリアーティファクト分析

インシデント対応やフォレンジック調査において、Windowsレジストリハイブから証拠を抽出・分析します。RegRipperやpython-registryなどのツールを使用し、マルウェアの永続化機構、ユーザーアクティビティ、USB接続履歴などを調査します。

Windowsレジストリアーティファクト分析 とは?

このスキルは、デジタルフォレンジックやインシデント対応において、Windowsレジストリハイブ(SAM、SYSTEM、SOFTWARE、NTUSER.DATなど)から証拠を抽出・分析するための包括的なワークフローを提供します。RegRipperの自動解析プラグインやpython-registryを用いたカスタムスクリプトにより、マルウェアの自動起動・永続化設定(Runキー、サービス)、ユーザーのプログラム実行履歴(UserAssist)、最近使用したドキュメント(MRU)、入力されたURL、USBデバイス接続履歴(USBSTOR)、ネットワーク設定、インストールソフトウェア情報などを体系的に調査できます。特に、インシデント発生時のユーザー行動再構築、不正ソフトウェアの検出、USB経由のデータ流出調査など、4つの典型的なシナリオに対応しており、SHA-256によるハッシュ検証やトランザクションログを用いたダーティハイブの復元など、証拠の完全性を保つ実践的な手法が含まれています。調査結果はシステム情報、自動起動エントリ、ユーザーアクティビティ、USB接続履歴、インストールソフトウェア一覧、異常項目のサマリとして出力されます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-windows-registry-for-artifacts

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

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

ドキュメント

Windowsレジストリアーティファクトの分析

使用するタイミング

  • インシデント発生時にWindowsシステム上のユーザーアクティビティを調査する場合
  • マルウェアが使用する自動起動・永続化メカニズムを特定する場合
  • インストールソフトウェア、USBデバイス、ネットワーク接続の追跡を行う場合
  • 内部関係者による脅威の調査でユーザーの操作を再構築する場合
  • レジストリのタイムスタンプを他のフォレンジックアーティファクトと関連付ける場合

前提条件

  • フォレンジックイメージまたは抽出済みのレジストリハイブファイル
  • RegRipper、Registry Explorer(Eric Zimmerman)、またはpython-registry
  • レジストリハイブのパスにアクセス可能であること(SAM、SYSTEM、SOFTWARE、NTUSER.DAT、UsrClass.dat)
  • Windowsレジストリの構造(ハイブ、キー、値)の理解
  • SIFT Workstationまたはフォレンジック分析環境

ワークフロー

ステップ1:フォレンジックイメージからレジストリハイブを抽出する

# フォレンジックイメージを読み取り専用でマウント
mkdir /mnt/evidence
mount -o ro,loop,offset=$((2048*512)) /cases/case-2024-001/images/evidence.dd /mnt/evidence

# システムレジストリハイブをコピー
cp /mnt/evidence/Windows/System32/config/SAM /cases/case-2024-001/registry/
cp /mnt/evidence/Windows/System32/config/SYSTEM /cases/case-2024-001/registry/
cp /mnt/evidence/Windows/System32/config/SOFTWARE /cases/case-2024-001/registry/
cp /mnt/evidence/Windows/System32/config/SECURITY /cases/case-2024-001/registry/
cp /mnt/evidence/Windows/System32/config/DEFAULT /cases/case-2024-001/registry/

# ユーザー固有のハイブをコピー
cp /mnt/evidence/Users/*/NTUSER.DAT /cases/case-2024-001/registry/
cp /mnt/evidence/Users/*/AppData/Local/Microsoft/Windows/UsrClass.dat /cases/case-2024-001/registry/

# トランザクションログのコピー(ダーティハイブ復元用)
cp /mnt/evidence/Windows/System32/config/*.LOG* /cases/case-2024-001/registry/logs/

# 抽出したすべてのハイブをハッシュ化
sha256sum /cases/case-2024-001/registry/* > /cases/case-2024-001/registry/hive_hashes.txt

ステップ2:RegRipperを使用した自動アーティファクト抽出

# RegRipperのインストール
git clone https://github.com/keydet89/RegRipper3.0.git /opt/regripper

# NTUSER.DAT(ユーザープロファイル)に対してRegRipperを実行
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/NTUSER.DAT \
   -f ntuser > /cases/case-2024-001/analysis/ntuser_report.txt

# SYSTEMハイブに対して実行
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SYSTEM \
   -f system > /cases/case-2024-001/analysis/system_report.txt

# SOFTWAREハイブに対して実行
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SOFTWARE \
   -f software > /cases/case-2024-001/analysis/software_report.txt

# SAMハイブ(ユーザーアカウント)に対して実行
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SAM \
   -f sam > /cases/case-2024-001/analysis/sam_report.txt

# 特定のプラグインを実行
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/NTUSER.DAT \
   -p userassist > /cases/case-2024-001/analysis/userassist.txt

perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SYSTEM \
   -p usbstor > /cases/case-2024-001/analysis/usbstor.txt

ステップ3:永続化と自動起動エントリの抽出

# python-registryを使用したターゲット抽出
pip install python-registry

python3 << 'PYEOF'
from Registry import Registry

# SOFTWAREハイブを開く
reg = Registry.Registry("/cases/case-2024-001/registry/SOFTWARE")

# Runキー(自動起動)を確認
autorun_paths = [
    "Microsoft\\Windows\\CurrentVersion\\Run",
    "Microsoft\\Windows\\CurrentVersion\\RunOnce",
    "Microsoft\\Windows\\CurrentVersion\\RunServices",
    "Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run",
    "Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run"
]

for path in autorun_paths:
    try:
        key = reg.open(path)
        print(f"\n=== {path} (最終更新日時:{key.timestamp()}) ===")
        for value in key.values():
            print(f"  {value.name()}: {value.value()}")
    except Registry.RegistryKeyNotFoundException:
        pass

# インストールされたサービスを確認
key = reg.open("Microsoft\\Windows NT\\CurrentVersion\\Svchost")
print(f"\n=== Svchostグループ ===")
for value in key.values():
    print(f"  {value.name()}: {value.value()}")
PYEOF

# NTUSER.DATでユーザー固有の自動起動を確認
python3 << 'PYEOF'
from Registry import Registry

reg = Registry.Registry("/cases/case-2024-001/registry/NTUSER.DAT")

user_autorun = [
    "Software\\Microsoft\\Windows\\CurrentVersion\\Run",
    "Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
    "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved\\Run"
]

for path in user_autorun:
    try:
        key = reg.open(path)
        print(f"\n=== {path} (最終更新日時:{key.timestamp()}) ===")
        for value in key.values():
            print(f"  {value.name()}: {value.value()}")
    except Registry.RegistryKeyNotFoundException:
        pass
PYEOF

ステップ4:ユーザーアクティビティアーティファクトの分析

# UserAssistデータ(ROT13エンコードされたプログラム実行履歴)を抽出
python3 << 'PYEOF'
from Registry import Registry
import codecs, struct, datetime

reg = Registry.Registry("/cases/case-2024-001/registry/NTUSER.DAT")

ua_path = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UserAssist"
key = reg.open(ua_path)

for guid_key in key.subkeys():
    count_key = guid_key.subkey("Count")
    print(f"\n=== {guid_key.name()} ===")
    for value in count_key.values():
        decoded_name = codecs.decode(value.name(), 'rot_13')
        data = value.value()
        if len(data) >= 16:
            run_count = struct.unpack('<I', data[4:8])[0]
            focus_count = struct.unpack('<I', data[8:12])[0]
            timestamp = struct.unpack('<Q', data[60:68])[0] if len(data) >= 68 else 0
            if timestamp > 0:
                ts = datetime.datetime(1601,1,1) + datetime.timedelta(microseconds=timestamp//10)
                print(f"  {decoded_name}: 実行回数={run_count}, フォーカス回数={focus_count}, 最終更新={ts}")
            else:
                print(f"  {decoded_name}: 実行回数={run_count}, フォーカス回数={focus_count}")
PYEOF

# 最近使用したドキュメント(MRUリスト)を抽出
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/NTUSER.DAT \
   -p recentdocs > /cases/case-2024-001/analysis/recentdocs.txt

# 入力されたURL(ブラウザ)を抽出
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/NTUSER.DAT \
   -p typedurls > /cases/case-2024-001/analysis/typedurls.txt

# エクスプローラーで入力されたパスを抽出
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/NTUSER.DAT \
   -p typedpaths > /cases/case-2024-001/analysis/typedpaths.txt

ステップ5:システム情報とネットワーク情報の抽出

# SYSTEMハイブからコンピュータ名とOSバージョンを取得
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SYSTEM \
   -p compname > /cases/case-2024-001/analysis/system_info.txt

# ネットワークインターフェースと設定
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SYSTEM \
   -p nic2 >> /cases/case-2024-001/analysis/system_info.txt

# ワイヤレスネットワーク履歴
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SOFTWARE \
   -p networklist > /cases/case-2024-001/analysis/network_history.txt

# タイムゾーン設定
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SYSTEM \
   -p timezone > /cases/case-2024-001/analysis/timezone.txt

# シャットダウン時刻
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SYSTEM \
   -p shutdown > /cases/case-2024-001/analysis/shutdown.txt

# Uninstallキーからインストール済みソフトウェア
perl /opt/regripper/rip.pl -r /cases/case-2024-001/registry/SOFTWARE \
   -p uninstall > /cases/case-2024-001/analysis/installed_software.txt

主要な概念

概念説明
レジストリハイブレジストリのセクションを保存するバイナリファイル(SAM、SYSTEM、SOFTWARE、NTUSER.DAT)
MRU(最近使用したもの)最近アクセスしたファイル、コマンド、検索語を追跡するリスト
UserAssistROT13エンコードされたレジストリエントリで、プログラムの実行をタイムスタンプ付きで追跡
ShimCache実行されたプログラムを記録するアプリケーション互換性キャッシュ
AmCache実行ファイルのSHA-1ハッシュを含む詳細な実行履歴
BAM/DAMバックグラウンド/デスクトップアクティビティモデレーター、Win10+でプログラム実行を追跡
最終更新日時レジストリキーが最後に変更された日時を示すタイムスタンプ
トランザクションログ不適切なシャットダウン後にレジストリの状態を復元できるジャーナルファイル

ツールとシステム

ツール目的
RegRipperプラグインアーキテクチャによる自動レジストリアーティファクト抽出
Registry ExplorerEric ZimmermanのGUIツール。対話的なレジストリ解析用
python-registryPythonライブラリ。プログラムによるレジストリハイブ解析用
RECmdEric Zimmermanのコマンドラインレジストリ解析ツール
yarpPythonベースのもう一つのレジストリパーサー
AppCompatCacheParserShimCache/AppCompatCache専用パーサー
AmcacheParserAmCache.hve専用解析ツール
ShellBags ExplorerShellBagアーティファクト解析専用ツール

一般的なシナリオ

シナリオ1:マルウェアの永続化調査 SOFTWAREハイブとNTUSER.DATハイブを抽出し、すべてのRun/RunOnceキーで不正なエントリを確認。サービスの不審な追加を調査。スケジュールタスクのレジストリキーを確認。自動起動のタイムスタンプをマルウェアの実行タイムラインと関連付ける。

シナリオ2:ユーザーアクティビティの再構築 UserAssistを分析してプログラム実行履歴を確認。RecentDocsでアクセスされたファイルを調査。TypedPathsでエクスプローラーでの移動を確認。ShellBagsでフォルダアクセスパターンを抽出。インシデントの時間帯におけるユーザーアクティビティのタイムラインを構築。

シナリオ3:不正ソフトウェアの検出 Uninstallキーからすべてのインストール済みアプリケーションを解析。許可されたソフトウェアベースラインと比較。BAM/DAMで許可リストにない最近実行されたプログラムを確認。アンインストール後でもAppCompatCacheで実行痕跡を調査。

シナリオ4:USB経由のデータ流出調査 SYSTEMハイブからUSBSTORエントリを抽出して接続デバイスを特定。デバイスのシリアル番号をMountedDevicesと関連付け。NTUSER.DATのMountPoints2でリムーバブルメディアへのユーザーアクセスを確認。SetupAPIログで初回接続のタイムスタンプを調査。

出力形式

レジストリ分析サマリ:
  システム:DESKTOP-ABC123(Windows 10 Pro Build 19041)
  タイムゾーン:東部標準時(UTC-5)
  最終シャットダウン:2024-01-18 23:45:12 UTC

  自動起動エントリ:
    HKLM Run:     5エントリ(1つ疑わしい:"updater.exe" -> C:\ProgramData\svc\updater.exe)
    HKCU Run:     3エントリ(すべて正当)
    サービス:     142エントリ(2つ不明:"WinDefSvc"、"SysMonAgent")

  ユーザーアクティビティ(NTUSER.DAT):
    UserAssistプログラム:  234エントリ
    最近使用したドキュメント:     89エントリ
    入力されたURL:           45エントリ
    入力されたパス:          12エントリ

  USB接続デバイス:
    - Kingston DataTraveler(シリアル:0019E06B4521) - 初回:2024-01-10、最終:2024-01-18
    - WD My Passport(シリアル:575834314131) - 初回:2024-01-15、最終:2024-01-15

  インストール済みソフトウェア:     127アプリケーション
  疑わしい発見事項:    3項目を確認用にフラグ

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,

関連スキル