E9Patch - A Powerful Static Binary Rewriter
E9Patch is a powerful static binary rewriting tool for x86_64 Linux ELF
binaries.
E9Patch is:
Static binary rewriting takes an input binary (ELF executable or shared object) and generates an output binary with some patch/modification applied to it. The patched binary can be used as a drop-in replacement of the original.
Pre-built E9Patch binaries can be downloaded here:
Building E9Patch is very easy: simply run the build.sh script.
This will automatically build two tools:
e9patch: the binary rewriter backend; ande9tool: a linear disassembly frontend for E9Patch.E9Patch is usable via the E9Tool frontend.
For example, to add instruction printing instrumentation to all xor
instructions in xterm, we can use the following command:
$ ./e9tool -M 'asm=/xor.*/' -P print xterm
This will generate a modified version of xterm written to the a.out file.
The modified xterm can be run as normal, but will print the assembly
string of each executed xor instruction to stderr:
$ ./a.out
xorl %ebp, %ebp
xorl %ebx, %ebx
xorl %eax, %eax
xorl %edx, %edx
xorl %edi, %edi
...
For a full list of supported options and modes, see:
$ ./e9tool --help
Some other projects that use E9Patch include:
libc.so.E9Patch is a low-level tool that is designed to be integrable into other projects. To find out more, please see the following documentation:
Bugs can be reported here:
The current version of E9Patch is significantly improved compared to the original prototype evaluated in the PLDI'2020 paper. Specifically:
-O2 option to E9Tool.This software has been released under the GNU Public License (GPL) Version 3.
Some specific files are released under the MIT license (check the file preamble).
For more information, please see our PLDI'2020 paper:
Please cite our paper as follows:
@inproceedings{e9patch,
author = {Duck, Gregory J. and Gao, Xiang and Roychoudhury, Abhik},
title = {Binary rewriting without control flow recovery},
year = {2020},
publisher = {Association for Computing Machinery},
url = {https://doi.org/10.1145/3385412.3385972},
doi = {10.1145/3385412.3385972},
booktitle = {Programming Language Design and Implementation (PLDI)}
}
This work was partially supported by the National Satellite of Excellence in Trustworthy Software Systems, funded by National Research Foundation (NRF) Singapore under the National Cybersecurity R&D (NCR) programme.
$ claude mcp add e9patch \
-- python -m otcore.mcp_server <graph>