Analyzing Specific Addresses
analyze_gadget() - Single Gadget
Analyze a specific address and filter out conditional branches:- Filters out gadgets with conditional branches
- Returns a single
RopGadgetobject orNone - Automatically adds the gadget to the ROP chain builder
- Re-screens all gadgets based on current badbytes
analyze_addr() - Multiple Gadgets with Branches
For addresses with conditional branches, get all possible execution paths:- Includes gadgets with conditional branches
- Returns a list of gadgets (different execution paths)
- Useful for analyzing complex gadgets with multiple outcomes
Source Code Reference
Fromangrop/rop.py:104-128:
Analyzing Custom Gadget Lists
analyze_gadget_list() - Batch Analysis
If you have a list of addresses from another tool (like ROPgadget or ropper), analyze them all:Practical Examples
Example 1: Verifying Manual Gadgets
Example 2: Analyzing After Info Leak
Example 3: Combining Full Search with Custom Gadgets
Understanding Gadget Screening
When you callanalyze_gadget() or analyze_addr(), angrop automatically:
- Analyzes the address using symbolic execution
- Adds to internal list (
self._all_gadgets) - Re-screens all gadgets based on:
- Current badbytes
- Gadget type (ROP, syscall, pivot)
- Updates public lists:
rop.rop_gadgetsrop.syscall_gadgetsrop.pivot_gadgets
- Bootstraps chain builder to use new gadgets
Handling Badbytes
If a gadget address contains badbytes, angrop tries to find equivalent gadgets:angrop/rop.py:78-91):
Gadget Properties
Once you have a gadget, you can inspect its properties:When to Use Each Method
| Method | Use Case |
|---|---|
analyze_gadget(addr) | Known good address, want simple gadget |
analyze_addr(addr) | Complex gadget with branches, want all paths |
analyze_gadget_list(addrs) | Batch import from external tool |
find_gadgets() | Full automatic search |
Performance Tips
- Use multiprocessing for large address lists
- Disable optimization initially with
optimize=Falseif you’re still exploring - Cache gadgets with
save_gadgets()andload_gadgets() - Set badbytes early to avoid analyzing unusable gadgets
Related Examples
- Kernel Escape Chain - Real-world kernel exploitation
- Complex Chains - Advanced chain composition