Overview
A Control-Flow Graph represents the structure of a program as a graph where:- Nodes are basic blocks (sequences of instructions with single entry/exit)
- Edges represent control flow (jumps, calls, returns)
CFGFast: Static Analysis
CFGFast uses static analysis to quickly recover the control-flow graph without executing code.
Basic Usage
Key Features
Function Detection
CFGFast identifies functions through:
- Binary symbols (for non-stripped binaries)
- Function prologues (architecture-specific patterns)
- Call targets
- Entry point analysis
Control Flow Recovery
- Lifts basic blocks to VEX IR
- Analyzes direct jumps and calls
- Resolves indirect jumps using jump table analysis
- Handles FakeRet edges for call returns
Configuration Options
Accessing CFG Data
CFGEmulated: Dynamic Analysis
CFGEmulated uses symbolic execution to build a more accurate CFG by actually executing the program.
Basic Usage
Context Sensitivity
Context sensitivity determines how many call stack frames to track:- Level 0
- Level 1
- Level 2+
Callee-only: Each function analyzed once
Advanced Options
Function Manager
Both CFG analyses populate the Function Manager in the knowledge base:CFGNode Properties
Indirect Jump Resolution
angr includes resolvers for common indirect jump patterns:Comparing CFGFast vs CFGEmulated
| Feature | CFGFast | CFGEmulated |
|---|---|---|
| Speed | ⚡ Very Fast (seconds) | 🐌 Slow (minutes to hours) |
| Accuracy | Good for most binaries | Higher (with caveats) |
| Indirect Jumps | Jump table analysis | Symbolic execution |
| State Tracking | ❌ No | ✅ Optional |
| Best For | Initial analysis, stripped binaries | Precise analysis, small functions |
Example: Full CFG Analysis
Next Steps
Data Flow Analysis
Build on CFG with DDG and VFG
Decompiler
Decompile functions using the CFG