Retrofitting XoM for Stripped Binaries without Embedded Data Relocation
đĄ Research Summary
The paper addresses the growing threat of justâinâtime returnâoriented programming (JITâROP), a sophisticated codeâreuse attack that exploits memoryâdisclosure vulnerabilities to harvest gadgets from a running program and assemble a malicious payload on the fly. Traditional defenses such as WâX (writeâxorâexecute) prevent writableâexecutable pages but still allow arbitrary reads of code, which JITâROP leverages to bypass fineâgrained code randomization. Executeâonly memory (XoM) has been proposed as a countermeasure because it revokes read permission from executable pages, thereby blocking gadget discovery.
Existing XoM implementations suffer from two major drawbacks. First, they either rely on software emulation or on hardware features (e.g., extended page tables) that impose significant performance penalties or require virtualization. Second, they assume a strict separation between code and data within a page. In practice, modern compilers, inline assembly, jump tables, and static readâonly data frequently embed data bytes inside code sections. When XoM is applied at page granularity, legitimate dataâinâcode reads trigger false positives, causing program crashes or severe compatibility issues. Prior work therefore either requires recompilation with custom toolchains, binary patching with debug symbols, or architectural modificationsânone of which are feasible for legacy or commercialâoffâtheâshelf (COTS) binaries.
PXoM (Practical XoM) introduces a hardwareâassisted, fineâgrained protection scheme that works on stripped x86â64 binaries without any embeddedâdata relocation. The core idea is to exploit Intel Memory Protection Keys (MPK), a feature that assigns a 4âbit key to each page and allows perâthread permission changes via a fast register write. PXoM extends this concept by subdividing a page into smaller blocks (e.g., 64âbyte granules) and assigning distinct MPK keys to âcodeâonlyâ blocks and âdataâallowedâ blocks. This enables the kernel to enforce readâonly (executeâonly) permissions on genuine code while still permitting legitimate reads of embedded data.
To identify which bytes belong to code and which to data, the authors devise a Unidirectional Disassembly algorithm. Starting from known entry points, the algorithm walks forward, decoding instructions until it encounters an undecodable byte or a controlâflow break; the subsequent region is then classified as data. By proceeding in a single direction, the method avoids the ambiguities that plague bidirectional or global disassembly tools, achieving high precision even without debug symbols.
Implementation details: a modified Linux ELF loader parses the binary, creates MPKâprotected mappings, and tags each block with the appropriate key. At runtime, a kernelâlevel monitor intercepts every read request to executable pages. If the address falls within a codeâonly block, the read is denied; if it falls within a dataâallowed block, the request proceeds. To reduce the cost of frequent key switches, PXoM adds a lightweight cacheâlike optimization that keeps the mostâaccessed dataâblocksâ keys active for the current thread.
Security evaluation shows that after PXoM protection, the number of discoverable gadgets drops dramatically, leaving insufficient variety to construct a functional JITâROP chain. Performance evaluation spans microbenchmarks (lmbench), macrobenchmarks (SPEC CPU2006/2017), and realâworld workloads (three web servers and four database systems). Across all tests, PXoM incurs an average runtime overhead of only 0.22âŻ%â0.82âŻ%, with negligible memory overhead.
The paperâs contributions are threefold: (1) a novel hardwareâassisted fineâgrained permission model using MPK, (2) a reliable, symbolâfree method for separating code and embedded data, eliminating the need for errorâprone data relocation, and (3) an endâtoâend, kernelâintegrated XoM solution that works on unmodified, stripped binaries. The authors release the source code and datasets on Zenodo, facilitating reproducibility and future research. In summary, PXoM demonstrates that practical, lowâoverhead XoM protection for legacy binaries is achievable, substantially raising the bar against memoryâdisclosureâbased JITâROP attacks.
Comments & Academic Discussion
Loading comments...
Leave a Comment