inspect_binary_layoutHow to REA Offline ELF Layout: Sections, Relocations & Static Mitigations
Inspect ELF64/ELF32 object layouts, symbol tables, section headers, dynamic relocations, and static binary exploit mitigations without running disassemblers or launching the binary.
In this official REA guide for Offline ELF Layout & Static Mitigations, AI coding agents (Claude Code, Cursor, Windsurf) execute 'REA_PWNTOOLS_PYTHON=/path/to/venv/bin/python rea inspect-binary-layout ./target.elf --json' to safely extract file layout, symbols, and code logic without launching unverified binaries.
The Problem & Target Artifact
CTF challenge binary or suspicious Linux executable audit: You need to determine compiler security mitigations (NX, Canary, PIE, RELRO), section offsets, and exported dynamic symbols before attaching live debuggers.
Natural Language Agent Instructions
Copy and paste this prompt directly into your AI coding agent when REA is registered via Model Context Protocol (MCP):
Use REA to inspect the binary layout of ./target.elf. Check for stack canaries, NX, and full RELRO, and list all undefined symbols in the dynamic symbol table.Run REA Analysis Command
Execute the following command in your terminal or inspect the MCP JSON-RPC call executed by your agent:
REA_PWNTOOLS_PYTHON=/path/to/venv/bin/python rea inspect-binary-layout ./target.elf --jsonWhat REA Extracts & Returns
Inspected Layout Evidence (JSON Output)
The verified findings and synthesized clean-room structures generated from this investigation:
{
"artifact": { "path": "/artifacts/target.elf", "sha256": "4a2b9...", "bytes": 16424 },
"format": "elf",
"architecture": { "machine": "EM_X86_64", "bits": 64, "byte_order": "little" },
"image_type": "ET_DYN",
"entry_point": { "reported_value": "0x1060", "meaning": "linked-virtual-address" },
"mitigations": {
"canary": true,
"nx": true,
"pie": true,
"relro": "full"
}
}Under-The-Hood: SHT_STRTAB Links & Relocation Addend Integrity
REA parses ELF section headers through an isolated Python worker. It enforces declared SHT_STRTAB links, ensuring symbol and section names reside inside bounded string buffers. For relocations, REA supports signed REL/RELA addends and decodes packed RELR tables without assuming an active load base. Symbol values are preserved as hexadecimal strings without unsafe floating-point truncation.