Name Date Size #Lines LOC

..--

MakefileH A D25-Apr-2025396 2217

README.mdH A D25-Apr-20251.9 KiB6643

TODOH A D25-Apr-202546 32

afl-untracer.cH A D25-Apr-202521.2 KiB821489

ghidra_get_patchpoints.javaH A D25-Apr-20253 KiB8543

ida_get_patchpoints.pyH A D25-Apr-20251.8 KiB6438

libtestinstr.cH A D25-Apr-2025964 3617

patches.txtH A D25-Apr-2025201 3534

README.md

1# afl-untracer - fast fuzzing of binary-only libraries
2
3## Introduction
4
5afl-untracer is an example skeleton file which can easily be used to fuzz
6a closed source library.
7
8It requires less memory and is x3-5 faster than QEMU mode, however, it is way
9more course grained and does not provide interesting features like compcov or
10cmplog.
11
12Supported is so far Intel (i386/x86_64) and AARCH64.
13
14## How-to
15
16### Modify afl-untracer.c
17
18Read and modify afl-untracer.c, then `make`.
19To adapt afl-untracer.c to your needs, read the header of the file and then
20search and edit the `STEP 1`, `STEP 2` and `STEP 3` locations.
21
22### Generate patches.txt file
23
24To generate the `patches.txt` file for your target library use the
25`ida_get_patchpoints.py` script for IDA Pro or
26`ghidra_get_patchpoints.java` for Ghidra.
27
28The patches.txt file has to be pointed to by `AFL_UNTRACER_FILE`.
29
30To easily run the scripts without needing to run the GUI with Ghidra:
31
32```
33/opt/ghidra/support/analyzeHeadless /tmp/ tmp$$ -import libtestinstr.so -postscript ./ghidra_get_patchpoints.java
34rm -rf /tmp/tmp$$
35```
36
37The file is created at `~/Desktop/patches.txt`
38
39### Fuzzing
40
41Example (after modifying afl-untracer.c to your needs, compiling and creating
42patches.txt):
43
44```
45LD_LIBRARY_PATH=/path/to/target/library AFL_UNTRACER_FILE=./patches.txt afl-fuzz -i in -o out -- ./afl-untracer
46```
47
48(or even remote via afl-network-proxy).
49
50### Testing and debugging
51
52For testing/debugging you can try:
53
54```
55make DEBUG=1
56AFL_UNTRACER_FILE=./patches.txt AFL_DEBUG=1 gdb ./afl-untracer
57```
58
59and then you can easily set breakpoints to "breakpoint" and "fuzz".
60
61# Background
62
63This idea is based on [UnTracer](https://github.com/FoRTE-Research/UnTracer-AFL)
64and modified by [Trapfuzz](https://github.com/googleprojectzero/p0tools/tree/master/TrapFuzz).
65This implementation is slower because the traps are not patched out with each
66run, but on the other hand gives much better coverage information.