mcpField
P
performing-timeline-reconstruction-with-plaso

performing-timeline-reconstruction-with-plaso

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

performing-timeline-reconstruction-with-plaso について

Plasoを使い、ディスクイメージなどの証拠から時系列を作成・分析するフォレンジック向けスキルです。イベントの解析、絞り込み、出力からTimesketchでの可視化までを扱います。

主な機能

  1. 01Plasoによるディスクイメージ処理
  2. 02アーティファクトパーサーの選択
  3. 03タイムラインの絞り込みと出力
  4. 04Timesketchでの分析
  5. 05複数ソースのイベント相関

活用シーン

  1. 01ランサムウェア活動の再構成
  2. 02データ窃取疑惑の調査
  3. 03侵害システム間のイベント相関
  4. 04時間外アクセスの確認

インストール

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

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill performing-timeline-reconstruction-with-plaso

インストール後、Claude Code で/performing-timeline-reconstruction-with-plasoを入力して読み込まれたか確認します。

同梱ファイル

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

LICENSE
references/
api-reference.md
scripts/
agent.py

詳細

Plasoによるタイムライン再構築

使用する場面

  • 複数の証拠ソースから包括的なフォレンジックタイムラインを構築する場合
  • ファイルシステムのメタデータ、イベントログ、ブラウザー履歴、レジストリのイベントを関連付ける場合
  • アクティビティを時系列で再構築する必要がある複雑な調査を行う場合
  • 標準的なログ分析ではイベントの発生順序を特定できない場合
  • 調査結果を視覚的かつ時系列で提示する場合

前提条件

  • フォレンジックワークステーションにPlaso(log2timeline/psort)がインストールされていること
  • raw(dd)、E01、またはVMDK形式のフォレンジックディスクイメージ
  • Plasoの出力用に十分なストレージ容量(イメージサイズの10倍以上になる場合があります)
  • 8GB以上のRAM(大規模なイメージには16GB以上を推奨)
  • 可視化用のTimeline Explorer(Eric Zimmerman)またはTimesketch
  • タイムスタンプの種類(MACB:Modified、Accessed、Changed、Born)に関する理解

ワークフロー

ステップ1:Plasoをインストールして環境を準備する
# Install Plaso on Ubuntu/Debian
sudo add-apt-repository ppa:gift/stable
sudo apt-get update
sudo apt-get install plaso-tools

# Or install via pip
pip install plaso

# Or use Docker (recommended for dependency isolation)
docker pull log2timeline/plaso

# Verify installation
log2timeline.py --version
psort.py --version

# Create output directory
mkdir -p /cases/case-2024-001/timeline/

# Verify the forensic image
img_stat /cases/case-2024-001/images/evidence.dd
ステップ2:log2timelineでPlasoストレージファイルを生成する
# Basic processing of a disk image (all parsers)
log2timeline.py \
   --storage-file /cases/case-2024-001/timeline/evidence.plaso \
   /cases/case-2024-001/images/evidence.dd

# Process with specific parsers for faster targeted analysis
log2timeline.py \
   --parsers "winevtx,prefetch,mft,usnjrnl,lnk,recycle_bin,chrome_history,firefox_history,winreg" \
   --storage-file /cases/case-2024-001/timeline/evidence.plaso \
   /cases/case-2024-001/images/evidence.dd

# Process with a filter file to focus on specific paths
cat << 'EOF' > /cases/case-2024-001/timeline/filter.txt
/Windows/System32/winevt/Logs
/Windows/Prefetch
/Users/*/NTUSER.DAT
/Users/*/AppData/Local/Google/Chrome
/Users/*/AppData/Roaming/Mozilla/Firefox
/$MFT
/$UsnJrnl:$J
/Windows/System32/config
EOF

log2timeline.py \
   --filter-file /cases/case-2024-001/timeline/filter.txt \
   --storage-file /cases/case-2024-001/timeline/evidence.plaso \
   /cases/case-2024-001/images/evidence.dd

# Using Docker
docker run --rm -v /cases:/cases log2timeline/plaso log2timeline \
   --storage-file /cases/case-2024-001/timeline/evidence.plaso \
   /cases/case-2024-001/images/evidence.dd

# Process multiple evidence sources into one timeline
log2timeline.py \
   --storage-file /cases/case-2024-001/timeline/combined.plaso \
   /cases/case-2024-001/images/workstation.dd

log2timeline.py \
   --storage-file /cases/case-2024-001/timeline/combined.plaso \
   /cases/case-2024-001/images/server.dd
ステップ3:psortでタイムラインをフィルタリングしてエクスポートする
# Export full timeline to CSV (super-timeline format)
psort.py \
   -o l2tcsv \
   -w /cases/case-2024-001/timeline/full_timeline.csv \
   /cases/case-2024-001/timeline/evidence.plaso

# Export with date range filter (focus on incident window)
psort.py \
   -o l2tcsv \
   -w /cases/case-2024-001/timeline/incident_window.csv \
   /cases/case-2024-001/timeline/evidence.plaso \
   "date > '2024-01-15 00:00:00' AND date < '2024-01-20 23:59:59'"

# Export in JSON Lines format (for ingestion into SIEM/Timesketch)
psort.py \
   -o json_line \
   -w /cases/case-2024-001/timeline/timeline.jsonl \
   /cases/case-2024-001/timeline/evidence.plaso

# Export with specific source type filters
psort.py \
   -o l2tcsv \
   -w /cases/case-2024-001/timeline/registry_events.csv \
   /cases/case-2024-001/timeline/evidence.plaso \
   "source_short == 'REG'"

psort.py \
   -o l2tcsv \
   -w /cases/case-2024-001/timeline/evtx_events.csv \
   /cases/case-2024-001/timeline/evidence.plaso \
   "source_short == 'EVT'"

# Export for Timeline Explorer (dynamic CSV)
psort.py \
   -o dynamic \
   -w /cases/case-2024-001/timeline/timeline_explorer.csv \
   /cases/case-2024-001/timeline/evidence.plaso
ステップ4:Timesketchでタイムラインを分析する
# Install Timesketch (Docker deployment)
git clone https://github.com/google/timesketch.git
cd timesketch
docker compose up -d

# Import Plaso file into Timesketch via CLI
timesketch_importer \
   --host http://localhost:5000 \
   --username analyst \
   --password password \
   --sketch_id 1 \
   --timeline_name "Case 2024-001 Workstation" \
   /cases/case-2024-001/timeline/evidence.plaso

# Alternatively, import JSONL
timesketch_importer \
   --host http://localhost:5000 \
   --username analyst \
   --sketch_id 1 \
   --timeline_name "Case 2024-001" \
   /cases/case-2024-001/timeline/timeline.jsonl

# In Timesketch web UI:
# 1. Search for events: "data_type:windows:evtx:record AND event_identifier:4624"
# 2. Apply Sigma analyzers for automated detection
# 3. Star/tag important events
# 4. Create stories documenting the investigation narrative
# 5. Share with team members
ステップ5:対象を絞ってタイムラインを分析する
# Analyze specific time periods around known events
python3 << 'PYEOF'
import csv
from collections import defaultdict
from datetime import datetime

# Load incident window timeline
events_by_hour = defaultdict(list)
source_counts = defaultdict(int)

with open('/cases/case-2024-001/timeline/incident_window.csv', 'r', errors='ignore') as f:
    reader = csv.DictReader(f)
    total = 0
    for row in reader:
        total += 1
        timestamp = row.get('datetime', row.get('date', ''))
        source = row.get('source_short', row.get('source', 'Unknown'))
        description = row.get('message', row.get('desc', ''))

        source_counts[source] += 1

        # Group by hour for activity patterns
        try:
            dt = datetime.strptime(timestamp[:19], '%Y-%m-%dT%H:%M:%S')
            hour_key = dt.strftime('%Y-%m-%d %H:00')
            events_by_hour[hour_key].append({
                'time': timestamp,
                'source': source,
                'description': description[:200]
            })
        except (ValueError, TypeError):
            pass

print(f"Total events in incident window: {total}\n")

print("=== EVENTS BY SOURCE TYPE ===")
for source, count in sorted(source_counts.items(), key=lambda x: x[1], reverse=True):
    print(f"  {source}: {count}")

print("\n=== ACTIVITY BY HOUR ===")
for hour in sorted(events_by_hour.keys()):
    count = len(events_by_hour[hour])
    bar = '#' * min(count // 10, 50)
    print(f"  {hour}: {count:>6} events {bar}")

# Find hours with unusual activity spikes
avg = total / max(len(events_by_hour), 1)
print(f"\n=== ANOMALOUS HOURS (>{avg*3:.0f} events) ===")
for hour in sorted(events_by_hour.keys()):
    if len(events_by_hour[hour]) > avg * 3:
        print(f"  {hour}: {len(events_by_hour[hour])} events (SPIKE)")
PYEOF

主な概念

概念説明
スーパータイムライン複数のソースから取得した、あらゆるアーティファクトのタイムスタンプを統合した時系列ビュー
MACBタイムスタンプModified(変更)、Accessed(アクセス)、Changed(メタデータ変更)、Born(作成)—主要な4種類のファイルタイムスタンプ
Plasoストレージファイルエクスポート前に解析済みイベントを保存する、SQLiteベースの中間形式
L2T CSVタイムラインイベントの標準化された列を備えたLog2timeline CSV形式
パーサー特定のアーティファクトタイプ(winevtx、prefetchなど)からタイムスタンプを抽出するPlasoモジュール
Psort処理後のストレージファイルを対象とする、Plasoの並べ替えおよびフィルタリングツール
TimesketchGoogleのオープンソース共同タイムライン分析プラットフォーム
ピボットポイント調査範囲を絞るために使用する、既知のタイムスタンプ(マルウェアの実行など)

ツールとシステム

ツール目的
log2timeline(Plaso)100種類以上のアーティファクトを解析する、主要なタイムライン生成エンジン
psortPlasoの出力をフィルタリング、並べ替え、エクスポートするユーティリティ
TimesketchWebベースの共同フォレンジックタイムライン分析プラットフォーム
Timeline ExplorerCSV形式のタイムライン分析用Windows GUI(Eric Zimmerman製)
KAPEPlasoによる処理に渡す、自動トリアージ収集ツール
mactime(TSK)Sleuth Kitのbodyfileからタイムラインを簡単に生成するツール
Excel/Sheetsフィルタリング済みの小規模なデータセットを手動で確認するツール
Elastic/KibanaJSONL形式のタイムラインデータ向けの代替可視化プラットフォーム

一般的なシナリオ

シナリオ 1:ランサムウェア攻撃の再構成 Plaso でディスクイメージ全体を処理し、暗号化の発覚前の 1 週間に絞り込み、ブラウザーの履歴とイベントログから初期アクセス経路を特定し、レジストリと Prefetch をたどって権限昇格を追跡し、ネットワークログオンイベントから横展開をマッピングし、MFT のタイムスタンプに記録された大量のファイル変更から暗号化の開始時点を特定します。

シナリオ 2:データ窃取の調査 容疑者のワークステーションからスーパータイムラインを作成し、USB デバイスの接続イベント、ファイルアクセスのタイムスタンプ、クラウドストレージに関するブラウザーのアクティビティに絞り込み、データの集約、圧縮、持ち出しを示す経緯をまとめ、タグ付けした証拠ポイントとともにタイムラインを法務チームに提示します。

シナリオ 3:複数システムにわたる侵害の分析 影響を受けたすべてのシステムのディスクイメージを処理して、単一の Plaso ストレージファイルにまとめ、Timesketch にインポートして共同分析を行い、システムごとのタイムラインをまたいで横展開のパターンを検索し、最初に侵害されたシステムと初期侵害経路を特定し、環境全体にわたる攻撃チェーンをマッピングします。

シナリオ 4:営業時間外の内部脅威による活動 営業時間外のみにタイムラインを絞り込み、通常の勤務時間外に行われたファイルアクセスのパターンを特定し、認証イベント(入退館記録、VPN ログオン)と相関させ、この時間帯の機密ディレクトリへのデータアクセスを検索して、人事部門および法務部門向けの証拠資料を作成します。

出力形式

Timeline Reconstruction Summary:
  Evidence Sources:
    Disk Image: evidence.dd (500 GB, NTFS)
    Plaso Storage: evidence.plaso (2.3 GB)

  Processing Statistics:
    Total events extracted: 4,567,890
    Parsers used: 45 (winevtx, prefetch, mft, usnjrnl, lnk, chrome, firefox, winreg, ...)
    Processing time: 3h 45m

  Incident Window (2024-01-15 to 2024-01-20):
    Events in window: 234,567
    Event Sources:
      MFT:          89,234
      Event Logs:   45,678
      USN Journal:  56,789
      Registry:     23,456
      Prefetch:     1,234
      Browser:      5,678
      LNK Files:    2,345
      Other:        10,153

  Key Timeline Events:
    2024-01-15 14:32 - Phishing email opened (browser)
    2024-01-15 14:33 - Malicious document downloaded
    2024-01-15 14:35 - PowerShell executed (Prefetch + Event Log)
    2024-01-15 14:36 - C2 connection established (Registry + Event Log)
    2024-01-16 02:30 - Mimikatz execution (Prefetch)
    2024-01-16 02:45 - Lateral movement to DC (Event Log)
    2024-01-17 03:00 - Data exfiltration (MFT + USN Journal)
    2024-01-18 03:00 - Log clearing (Event Log)

  Exported Files:
    Full Timeline:     /timeline/full_timeline.csv (4.5M rows)
    Incident Window:   /timeline/incident_window.csv (234K rows)
    Timesketch Import: /timeline/timeline.jsonl

コメント