Skip to main content

Overview

The /crash-analysis command provides autonomous root-cause analysis for C/C++ crashes. It uses deterministic record-replay debugging (rr), function tracing, and coverage analysis to identify the exact cause of security bugs.

Syntax

Parameters

string
required
URL to the bug tracker report (e.g., Trac, GitHub Issues, Bugzilla)
string
required
URL to the Git repository containing the vulnerable code

What It Does

  1. Fetches bug report from the provided URL
  2. Clones repository from Git URL
  3. Reads README to determine build process
  4. Rebuilds with instrumentation (AddressSanitizer + debug symbols)
  5. Reproduces the crash using inputs from bug report
  6. Generates execution traces with function-level granularity
  7. Collects coverage data using gcov
  8. Records with rr for deterministic replay
  9. Performs root-cause analysis with validation loop
  10. Produces confirmed hypothesis with evidence

Workflow Agents

The crash analysis workflow orchestrates multiple specialized agents:

Main Orchestrator

  • crash-analysis-agent: Coordinates the entire workflow

Analysis Agents

  • crash-analyzer-agent: Performs deep root-cause analysis using rr traces
  • crash-analyzer-checker-agent: Validates analysis rigorously

Data Collection Agents

  • function-trace-generator-agent: Creates function execution traces
  • coverage-analysis-generator-agent: Generates gcov coverage data

Examples

Analyze FFmpeg Crash

Analyzes a reported crash in FFmpeg.

Analyze ImageMagick Vulnerability

Investigates a security bug in ImageMagick.

Analyze OpenSSL Issue

Analyzes a reported issue in OpenSSL.

Prerequisites

Required Tools

tool
required
Record-replay debugger for deterministic debugging
tool
required
Compiler with AddressSanitizer support
tool
required
GNU Debugger for debugging rr traces
tool
required
Code coverage tool (bundled with gcc)

Analysis Features

Deterministic Replay with rr

rr records program execution and allows perfect replay:
Benefits:
  • Exact reproduction of crash every time
  • Reverse execution to find root cause
  • No Heisenbugs (observer effect eliminated)
  • Shareable traces for collaboration

Function Tracing

Instruments code to log all function calls:
Visualize in Perfetto for execution flow analysis.

Coverage Analysis

Collects line-level coverage data:
Identifies which lines executed during crash.

Hypothesis-Validation Loop

The analysis follows a rigorous validation process:
  1. Analyzer forms hypothesis about root cause
  2. Checker validates hypothesis against evidence
  3. If rejected, analyzer revises with feedback
  4. If confirmed, produces final report
This ensures high-quality, evidence-backed analysis.

Output Structure

Root Cause Report Format

Attack Vector

  1. Attacker creates malicious image with header size > 1024
  2. Application reads size: 4096 bytes
  3. memcpy writes beyond buffer bounds
  4. Heap corruption occurs

Evidence

  • rr trace: Crash at memcpy+0x42
  • ASAN report: Heap-buffer-overflow write
  • Coverage: Line 142 executed
  • Function trace: parse_image_header called from main

Impact

  • Remote code execution via heap corruption
  • Denial of service via crash
  • Information disclosure via memory leaks

Recommendations

  1. Validate size from header: if (len > 1024) return ERROR;
  2. Use safe memory functions: memcpy_s(buffer, sizeof(buffer), data, len)
  3. Add fuzzing to test suite
  4. Enable ASAN in CI/CD pipeline

Reverse Execution

Step backwards through program execution:

Integration with Fuzzing

Combine with /fuzz for comprehensive analysis:

Workflow Integration

/fuzz

Find crashes through fuzzing

/exploit

Generate exploits from analysis

/validate

Validate exploitability

/patch

Generate fixes for vulnerabilities

Skills Referenced

The crash analysis workflow uses skills from .claude/skills/crash-analysis/:
  • rr-debugger: Deterministic record-replay debugging
  • function-tracing: Function instrumentation with -finstrument-functions
  • gcov-coverage: Code coverage collection
  • line-execution-checker: Fast line execution queries

Notes

  • Requires Linux (rr only supports Linux)
  • Works best with C/C++ applications
  • rr traces can be large (hundreds of MBs)
  • Analysis follows hypothesis-validation loop for accuracy
  • Produces shareable, reproducible crash traces
  • For security research and authorized testing only