jpskill.com
🛠️ 開発・MCP コミュニティ

binary-re

バイナリファイルや実行可能ファイル、バイトコードの動作や仕組みを解析し、理解を深めるためのリバースエンジニアリングを行うSkill。

📜 元の英語説明(参考)

This skill should be used when analyzing binaries, executables, or bytecode to understand what they do or how they work. Triggers on "binary", "executable", "ELF", "what does this do", "reverse engineer", "disassemble", "decompile", "pyc file", "python bytecode", "analyze binary", "figure out", "marshal". Routes to sub-skills for triage, static analysis, dynamic analysis, synthesis, or tool setup.

🇯🇵 日本人クリエイター向け解説

一言でいうと

バイナリファイルや実行可能ファイル、バイトコードの動作や仕組みを解析し、理解を深めるためのリバースエンジニアリングを行うSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o binary-re.zip https://jpskill.com/download/6550.zip && unzip -o binary-re.zip && rm binary-re.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/6550.zip -OutFile "$d\binary-re.zip"; Expand-Archive "$d\binary-re.zip" -DestinationPath $d -Force; ri "$d\binary-re.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して binary-re.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → binary-re フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

バイナリリバースエンジニアリング

目的

バイナリリバースエンジニアリングに関する包括的なガイドです。このスキルは、全体的な方法論、哲学、および参考資料を提供します。関連スキルは特定のフェーズを扱います。

関連スキル

スキル 目的 トリガーキーワード
binary-re:triage 高速フィンガープリンティング "what is this binary", "identify", "file type"
binary-re:static-analysis r2 + Ghidra 解析 "disassemble", "decompile", "functions"
binary-re:dynamic-analysis QEMU + GDB + Frida "run", "execute", "debug", "trace"
binary-re:synthesis レポート生成 "summarize", "report", "document findings"
binary-re:tool-setup ツールのインストール "install", "setup", "tool not found"

注: 各スキルはキーワードに基づいて自動検出されます。明示的にルーティングする必要はなく、必要なことを尋ねるだけで結構です。

事前検証

分析を開始する前に、ツールの可用性を確認してください。

コアツール (必須)

rabin2 -v  # Should show version
r2 -v      # Should show version

逆コンパイル (オプション)

# Check r2ghidra availability
r2 -qc 'pdg?' - 2>/dev/null | grep -q Usage && echo "r2ghidra OK" || echo "r2ghidra missing - install with: r2pm -ci r2ghidra"

動的解析プラットフォームの確認

ホストプラットフォーム 方法 セットアップの必要性
Linux x86_64 ネイティブ QEMU apt install qemu-user
macOS (任意) Docker + binfmt binary-re-tool-setup スキルを参照
Windows WSL2 WSL 内で Linux の方法を使用

動的ツールが利用できない場合: 静的解析のみで続行し、合成フェーズでの信頼度が低下することに注意してください。

フォールバックツール (r2/Ghidra なし)

radare2 または Ghidra が利用できない場合は、標準の binutils/LLVM ツールを使用します。

# Metadata (replaces rabin2 -I)
readelf -h binary              # ELF header
readelf -d binary              # Dynamic section (dependencies)
file binary                    # Quick identification

# Imports/Exports (replaces rabin2 -i/-E)
readelf -Ws binary | grep -E "FUNC|OBJECT" | awk '{print $8}'
nm -D binary 2>/dev/null       # Dynamic symbols

# Strings (replaces rabin2 -zz)
strings -a -n 8 binary | grep -Ei 'http|ftp|/etc|/var|error|pass|key|token|api'

# Disassembly (replaces r2 pdf)
objdump -d -M intel binary | head -500
# Or LLVM (better cross-arch support):
llvm-objdump -d --no-show-raw-insn binary | head -500

# Dependencies (replaces rabin2 -l)
ldd binary 2>/dev/null || readelf -d binary | grep NEEDED

フォールバックアプローチの制限事項:

  • クロスリファレンス (axt/axf) なし - 手動でトレースする必要があります
  • 逆コンパイルなし - アセンブリのみ
  • 関数境界検出なし - 生の逆アセンブリ
  • ストリップされたバイナリの精度低下

哲学

LLM が分析を主導し、人間がコンテキストを提供します。

人間が提供するもの:

  • プラットフォーム情報 (デバイスタイプ、OS、ハードウェア)
  • 疑われる目的 (バイナリが何をする可能性があるか)
  • 制約 (ネットワークなし、隔離された環境など)

LLM が実行するもの:

  • ツールの選択と呼び出し
  • 証拠からの仮説形成
  • 実験計画
  • 知識の統合

エージェントループ

┌─────────────────────────────────────────────────┐
│           HYPOTHESIS-DRIVEN ANALYSIS            │
├─────────────────────────────────────────────────┤
│                                                 │
│  0. I/O SANITY → Compare known inputs/outputs   │
│  1. OBSERVE → Gather facts via tools            │
│  2. HYPOTHESIZE → Form theories from facts      │
│  3. PLAN → Design experiments to test theories  │
│  4. EXECUTE → Run tools (gate risky ops)        │
│  5. RECORD → Capture observations               │
│  6. UPDATE → Confirm/refute hypotheses          │
│  7. LOOP → Until understanding sufficient       │
│                                                 │
└─────────────────────────────────────────────────┘

ステップ 0: 既知の I/O を最初に比較する (重要)

コード分析に入る前に、常に既知の入力/出力が存在するかどうかを確認してください。

このステップは、まず真実を確立することで、何時間もの無駄な分析を防ぎます。

⚠️ 人間の承認が必要 - I/O 比較であっても、実行前に明示的な承認を得てください。

# SAFE: Use emulation for cross-arch binaries (after human approval)
# ARM32 example:
qemu-arm -L /usr/arm-linux-gnueabihf -- ./binary input.txt > actual_output.txt

# x86-64 native (still requires approval):
./binary input.txt > actual_output.txt

# Docker-based (macOS - safest option):
docker run --rm --platform linux/arm/v7 -v ~/samples:/work:ro \
  arm32v7/debian:bullseye-slim /work/binary /work/input.txt > actual_output.txt

# Compare outputs:
diff expected_output.txt actual_output.txt
cmp -l expected_output.txt actual_output.txt | head -20  # Byte-level

# Document the delta:
# - Where does output first diverge?
# - What pattern appears in the corruption?
# - Does file size match (logic bug) or differ (truncation)?

事実として記録:

FACT: Output differs at byte {N}, expected "{X}" got "{Y}" (source: diff/cmp)
FACT: File sizes match/differ by {N} bytes (source: ls -l)

この単一のステップで、逆アセンブリを行う前にバグのカテゴリが明らかになることがよくあります。

知識モデル

分析全体を通して、エピソード記憶を介して構造化された知識を維持します。

FACTS: Verified observations with tool attribution
HYPOTHESES: Theories with confidence and evidence
QUESTIONS: Open unknowns blocking progress
EXPERIMENTS: Planned tool invocations
OBSERVATIONS: Results from experiments
DECISIONS: Human-approved choices with rationale

エピソード記憶の統合

知識はエピソード記憶を介してセッション間で保持されます。一貫したタグ付けを使用してください。

[BINARY-RE:{phase}] {artifact_name} (sha256: {hash})
FACT: {observation} (source: {tool})
HYPOTHESIS: {theory} (confidence: {0.0-1.0})
QUESTION: {unknown}
DECISION: {choice} (rationale: {why})

分析の開始: まずエピソード記憶でアーティファクトハッシュを検索します。 各フェーズの後: 調査結果は自動的に conve に取り込まれます。

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Binary Reverse Engineering

Purpose

Comprehensive guide for binary reverse engineering. This skill provides the overall methodology, philosophy, and reference material. Related skills handle specific phases:

Related Skills

Skill Purpose Trigger Keywords
binary-re:triage Fast fingerprinting "what is this binary", "identify", "file type"
binary-re:static-analysis r2 + Ghidra analysis "disassemble", "decompile", "functions"
binary-re:dynamic-analysis QEMU + GDB + Frida "run", "execute", "debug", "trace"
binary-re:synthesis Report generation "summarize", "report", "document findings"
binary-re:tool-setup Install tools "install", "setup", "tool not found"

Note: Each skill auto-detects based on keywords. You don't need to explicitly route - just ask what you need.

Pre-Flight Verification

Before beginning any analysis, verify tooling availability:

Core Tools (Required)

rabin2 -v  # Should show version
r2 -v      # Should show version

Decompilation (Optional)

# Check r2ghidra availability
r2 -qc 'pdg?' - 2>/dev/null | grep -q Usage && echo "r2ghidra OK" || echo "r2ghidra missing - install with: r2pm -ci r2ghidra"

Dynamic Analysis Platform Check

Host Platform Method Setup Required
Linux x86_64 Native QEMU apt install qemu-user
macOS (any) Docker + binfmt See binary-re-tool-setup skill
Windows WSL2 Use Linux method inside WSL

If dynamic tools unavailable: Proceed with static-only analysis, note reduced confidence in synthesis phase.

Fallback Tooling (No r2/Ghidra)

When radare2 or Ghidra aren't available, use standard binutils/LLVM tools:

# Metadata (replaces rabin2 -I)
readelf -h binary              # ELF header
readelf -d binary              # Dynamic section (dependencies)
file binary                    # Quick identification

# Imports/Exports (replaces rabin2 -i/-E)
readelf -Ws binary | grep -E "FUNC|OBJECT" | awk '{print $8}'
nm -D binary 2>/dev/null       # Dynamic symbols

# Strings (replaces rabin2 -zz)
strings -a -n 8 binary | grep -Ei 'http|ftp|/etc|/var|error|pass|key|token|api'

# Disassembly (replaces r2 pdf)
objdump -d -M intel binary | head -500
# Or LLVM (better cross-arch support):
llvm-objdump -d --no-show-raw-insn binary | head -500

# Dependencies (replaces rabin2 -l)
ldd binary 2>/dev/null || readelf -d binary | grep NEEDED

Limitations of fallback approach:

  • No cross-references (axt/axf) - must trace manually
  • No decompilation - assembly only
  • No function boundary detection - raw disassembly
  • Reduced accuracy for stripped binaries

Philosophy

The LLM drives analysis; the human provides context.

Human provides:

  • Platform info (device type, OS, hardware)
  • Suspected purpose (what the binary might do)
  • Constraints (no network, isolated env, etc.)

LLM executes:

  • Tool selection and invocation
  • Hypothesis formation from evidence
  • Experiment design
  • Knowledge synthesis

The Agentic Loop

┌─────────────────────────────────────────────────┐
│           HYPOTHESIS-DRIVEN ANALYSIS            │
├─────────────────────────────────────────────────┤
│                                                 │
│  0. I/O SANITY → Compare known inputs/outputs   │
│  1. OBSERVE → Gather facts via tools            │
│  2. HYPOTHESIZE → Form theories from facts      │
│  3. PLAN → Design experiments to test theories  │
│  4. EXECUTE → Run tools (gate risky ops)        │
│  5. RECORD → Capture observations               │
│  6. UPDATE → Confirm/refute hypotheses          │
│  7. LOOP → Until understanding sufficient       │
│                                                 │
└─────────────────────────────────────────────────┘

Step 0: Compare Known I/O First (CRITICAL)

Before diving into code analysis, always check if known inputs/outputs exist.

This step prevents hours of wasted analysis by establishing ground truth first.

⚠️ REQUIRES HUMAN APPROVAL - Even for I/O comparison, get explicit approval before execution.

# SAFE: Use emulation for cross-arch binaries (after human approval)
# ARM32 example:
qemu-arm -L /usr/arm-linux-gnueabihf -- ./binary input.txt > actual_output.txt

# x86-64 native (still requires approval):
./binary input.txt > actual_output.txt

# Docker-based (macOS - safest option):
docker run --rm --platform linux/arm/v7 -v ~/samples:/work:ro \
  arm32v7/debian:bullseye-slim /work/binary /work/input.txt > actual_output.txt

# Compare outputs:
diff expected_output.txt actual_output.txt
cmp -l expected_output.txt actual_output.txt | head -20  # Byte-level

# Document the delta:
# - Where does output first diverge?
# - What pattern appears in the corruption?
# - Does file size match (logic bug) or differ (truncation)?

Record as FACT:

FACT: Output differs at byte {N}, expected "{X}" got "{Y}" (source: diff/cmp)
FACT: File sizes match/differ by {N} bytes (source: ls -l)

This single step often reveals the bug category before any disassembly.

Knowledge Model

Throughout analysis, maintain structured knowledge via episodic memory:

FACTS: Verified observations with tool attribution
HYPOTHESES: Theories with confidence and evidence
QUESTIONS: Open unknowns blocking progress
EXPERIMENTS: Planned tool invocations
OBSERVATIONS: Results from experiments
DECISIONS: Human-approved choices with rationale

Episodic Memory Integration

Knowledge persists across sessions via episodic memory. Use consistent tagging:

[BINARY-RE:{phase}] {artifact_name} (sha256: {hash})
FACT: {observation} (source: {tool})
HYPOTHESIS: {theory} (confidence: {0.0-1.0})
QUESTION: {unknown}
DECISION: {choice} (rationale: {why})

Starting analysis: Search episodic memory for artifact hash first After each phase: Findings are automatically captured in conversation Resuming: Search [BINARY-RE] {artifact_name} to restore context

Human-in-the-Loop Triggers

ALWAYS ask human before:

  1. Executing the binary - Even under QEMU, confirm sandbox
  2. Network operations - Prevent unintended phone-home
  3. Conflicting evidence - Resolve contradictory findings
  4. Privileged operations - Device access, root actions
  5. Major direction changes - Significant analysis pivots

Session Management

Starting New Analysis

1. Compute artifact hash: sha256sum binary
2. Search episodic memory: "[BINARY-RE] sha256:{hash}"
3. If previous analysis found:
   → "Found previous analysis from {date}. Resume or start fresh?"
4. If resuming: Load facts/hypotheses, continue from last phase
5. If fresh: Begin with triage phase

Resuming Interrupted Analysis

User: "Continue analyzing that thermostat binary"

Claude:
1. Invoke episodic-memory:search-conversations
   Query: "[BINARY-RE] thermostat"
2. Retrieve previous session findings
3. Summarize: "Last session identified ARM32/musl, found network
   functions. We were about to run dynamic analysis."
4. Continue from that phase

Searching Past Analyses

User: "Have we analyzed any ARM binaries with hardcoded passwords?"

Claude:
1. Search: "[BINARY-RE] FACT: hardcoded" or "[BINARY-RE] ARM"
2. Return matching artifacts and findings

Standard Analysis Flow

For typical unknown binary analysis:

1. Triage (binary-re-triage)
   └─ Architecture, ABI, dependencies, capabilities

2. Static Analysis (binary-re-static-analysis)
   └─ Functions, strings, xrefs, decompilation

3. Dynamic Analysis (binary-re-dynamic-analysis) - if safe
   └─ Syscalls, network, file access

4. Synthesis (binary-re-synthesis)
   └─ Structured report with evidence

Quick Reference

Essential Commands

# Fast triage
rabin2 -I binary              # Metadata
rabin2 -l binary              # Dependencies
rabin2 -zz binary             # Strings

# Static analysis
r2 -q -c 'aa; aflj' binary    # Functions
r2 -q -c 'izj' binary         # Strings

# Dynamic (ARM example)
qemu-arm -L /usr/arm-linux-gnueabihf -strace ./binary

Architecture Detection

Indicator Architecture QEMU Binary Ghidra Processor
e_machine=EM_386 (3) x86 32-bit qemu-i386 or Docker --platform linux/i386 x86:LE:32:default
e_machine=EM_ARM (40) ARM 32-bit qemu-arm or Docker --platform linux/arm/v7 ARM:LE:32:v7
e_machine=EM_AARCH64 (183) ARM 64-bit qemu-aarch64 or Docker --platform linux/arm64 AARCH64:LE:64:v8A
e_machine=EM_X86_64 (62) x86-64 Native or Docker --platform linux/amd64 x86:LE:64:default
e_machine=EM_MIPS (8) MIPS 32 LE qemu-mipsel MIPS:LE:32:default
e_machine=EM_MIPS (8) BE MIPS 32 BE qemu-mips MIPS:BE:32:default
e_machine=EM_RISCV (243) RISC-V 64 qemu-riscv64 RISCV:LE:64:RV64I
e_machine=EM_RISCV (243) 32 RISC-V 32 qemu-riscv32 RISCV:LE:32:RV32I

Libc Detection

Interpreter Libc
ld-linux-armhf.so.3 glibc (ARM hard-float)
ld-musl-arm.so.1 musl
ld-uClibc.so.0 uClibc

Error Recovery

Situation Action
Tool not found Use binary-re-tool-setup skill
Wrong architecture Re-run triage, verify file output
QEMU fails Try Qiling, Unicorn, or on-device
Analysis timeout Reduce scope, use aa not aaa
Conflicting evidence Ask human, document both interpretations

Documentation

See companion docs:

  • docs/r2-commands.md - Complete r2 reference for LLMs
  • docs/ghidra-headless.md - Ghidra scripting guide
  • docs/arch-adapters.md - Per-architecture quirks
  • docs/python-bytecode-re.md - Python .pyc/marshal obfuscation patterns

Integration

Works with other plugins:

  • remote-system-maintenance: Extract binaries from devices via SSH
  • fresh-eyes-review: Validate conclusions before documenting
  • scenario-testing: Create reproducible analysis environments