3

My goal is to modify some instructions and make some instrumentation in ELF executables or libraries(For example, modifying all memory writes instructions). Since there're so many instructions, I want to find them automatically and apply some modification. Are there any tools that I can leverage?

  • @w s I mean static instrumentation, and I want to modify elf files. – liubenxi Mar 7 '17 at 9:28
  • 2
    does it have to be static? there are many tools for dynamic instrumentation, why do you need specifically binary rewriting? – Igor Skochinsky Mar 7 '17 at 10:50
  • @IgorSkochinsky I want to change ELF files, and run them without any tools. – liubenxi Mar 9 '17 at 1:04
4

I just extracted the following list during my research of this paper:

"Reassembleable Disassembling" Shuai Wang, Pei Wang, and Dinghao Wu, The Pennsylvania State University

The following list consits of all mentioned tools (dynamic and static), perhaps there is something useful:


UROBOROS (Static, x86/x64 ELF)

So the paper itself introduces UROBOROS. I think it's one of the best options for you:

https://github.com/s3team/uroboros

"Reassembleable Disassembling" Shuai Wang, Pei Wang, and Dinghao Wu, The Pennsylvania State University

In this paper, we present UROBOROS, a tool that can disassemble executables to the extent that the gener- ated code can be assembled back to working binaries without manual effort. [...]

We have implemented a prototype of UROBOROS in OCaml and Python, with a total of 13,209 lines of code. Our prototype works for both x86 and x64 ELF binaries. [...]

We have presented UROBOROS, a tool that can disassem- ble stripped binaries and produce reassembleable assem- bly code in a fully automated manner. We call this tech- nique reassembleable disassembling and have developed a prototype called UROBOROS. Our experiments show that reassembled programs incur negligible execution overhead, and thus UROBOROS can be potentially used as a foundation for binary-based software retrofitting.


Dyninst [10, 20] (Static+Dynamic)

BUCK, B., AND HOLLINGSWORTH, J. K. An API for runtime code patching. Int. J. High Perform. Comput. Appl. 14, 4 (2000), 317–329.


Vulcan [16] (Static, binaries compiled by special compilers, not stripped)

EDWARDS, A., VO, H., SRIVASTAVA, A., AND SRIVASTAVA, A. Vulcan binary transformation in a distributed environment. Tech. Rep. MSR-TR-2001-50, Microsoft Research, 2001.


Alto [35] (Static, binaries compiled by special compilers, not stripped)

MUTH, R., DEBRAY, S. K., WATTERSON, S., AND DE BOSS- CHERE, K. Alto: A link-time optimizer for the Compaq Alpha. Softw. Pract. Exper. 31, 1 (2001), 67–101.


Diablo [13] (Static, binaries compiled by special compilers, not stripped)

DE SUTTER, B., DE BUS, B., AND DE BOSSCHERE, K. Link- time binary rewriting techniques for program compaction. ACM Trans. Program. Lang. Syst. 27, 5 (2005), 882–945.


SecondWrite [3] (Static)

ANAND, K., SMITHSON, M., ELWAZEER, K., KOTHA, A., GRUEN, J., GILES, N., AND BARUA, R. A compiler-level inter- mediate representation based binary analysis and rewriting sys- tem. In Proceedings of the 8th ACM European Conference on Computer Systems (2013), ACM, pp. 295–308.


Pin [31] (Dynamic)

LUK, C.-K., COHN, R., MUTH, R., PATIL, H., KLAUSER, A., LOWNEY, G., WALLACE, S., REDDI, V. J., AND HAZELWOOD, K. Pin: Building customized program analysis tools with dy- namic instrumentation. In Proceedings of the 2005 ACM SIG- PLAN Conference on Programming Language Design and Im- plementation (2005), ACM, pp. 190–200.


DynamoRIO [7] (Dynamic)

BRUENING, D. L. Efficient, transparent, and comprehensive runtime code manipulation. PhD thesis, Massachusetts Institute of Technology, 2004.


miasm2

Miasm is a free and open source (GPLv2) reverse engineering framework. Miasm aims to analyze / modify / generate binary programs. https://github.com/cea-sec/miasm


VxStripper (dynamic)

Josse, Sébastien. "Malware Dynamic Recompilation." System Sciences (HICSS), 2014 47th Hawaii International Conference on. IEEE, 2014.

  • 1
    Miasm2 is also able to rewrite binary code. – perror Mar 7 '17 at 13:34
  • I added miasm2 and VxStripper. – kn0x Mar 7 '17 at 14:01
  • The authors have extended their work, UROBOROS, and it is also able to rewrite binary code. – liubenxi Mar 9 '17 at 1:13
  • I read the paper yesterday and I will add it to my answer. I think it's probably a good option for you. – kn0x Mar 9 '17 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.