IDA2Obj
Static Binary Instrumentation
Install / Use
/learn @jhftss/IDA2ObjREADME
IDA2Obj
IDA2Obj is a tool to implement SBI (Static Binary Instrumentation).
The working flow is simple:
- Dump object files (COFF) directly from one executable binary.
- Link the object files into a new binary, almost the same as the old one.
- During the dumping process, you can insert any data/code at any location.
- SBI is just one of the using scenarios, especially useful for black-box fuzzing.
How to use
-
Prepare the enviroment:
- Set
AUTOIMPORT_COMPAT_IDA695 = YESin theidapython.cfgto support the API with old IDA 6.x style. - Install dependency:
pip install cough
- Set
-
Create a folder as the workspace.
-
Copy the target binary which you want to fuzz into the workspace.
-
Load the binary into IDA Pro, choose Load resources and manually load to load all the segments from the binary.
<img src="pics/README/image-20210813134907705.png" alt="image-20210813134907705" style="zoom:50%;" /> -
Wait for the auto-analysis done.
-
Dump object files by running the script
MagicIDA/main.py.- The output object files will be inside
${workspace}/${module}/objs/afl. - If you create an empty file named
TRACE_MODEinside the workspace, then the output object files will be inside${workspace}/${module}/objs/trace. - By the way, it will also generate 3 files inside
${workspace}/${module}:- exports_afl.def (used for linking)
- exports_trace.def (used for linking)
- hint.txt (used for patching)
- The output object files will be inside
-
Generate lib files by running the script
utils/LibImports.py.- The output lib files will be inside
${workspace}/${module}/libs, used for linking later.
- The output lib files will be inside
-
Open a terminal and change the directory to the workspace.
-
Link all the object files and lib files by using
utils/link.bat.- e.g.
utils/link.bat GdiPlus dll afl /RELEASE - It will generate the new binary with the pdb file inside
${workspace}/${module}.
- e.g.
-
Patch the new built binary by using
utils/PatchPEHeader.py.- e.g.
utils/PatchPEHeader.py GdiPlus/GdiPlus.afl.dll - For the first time, you may need to run
utils/register_msdia_run_as_administrator.batas administrator.
- e.g.
-
Run & Fuzz.
More details
HITB Slides : https://github.com/jhftss/jhftss.github.io/blob/main/res/slides/HITB2021SIN%20-%20IDA2Obj%20-%20Mickey%20Jin.pdf
Demo : https://drive.google.com/file/d/1N3DXJCts5jG0Y5B92CrJOTIHedWyEQKr/view?usp=sharing
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
