Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
Makefile | H A D | 25-Apr-2025 | 396 | 22 | 17 | |
README.md | H A D | 25-Apr-2025 | 1.9 KiB | 66 | 43 | |
TODO | H A D | 25-Apr-2025 | 46 | 3 | 2 | |
afl-untracer.c | H A D | 25-Apr-2025 | 21.2 KiB | 821 | 489 | |
ghidra_get_patchpoints.java | H A D | 25-Apr-2025 | 3 KiB | 85 | 43 | |
ida_get_patchpoints.py | H A D | 25-Apr-2025 | 1.8 KiB | 64 | 38 | |
libtestinstr.c | H A D | 25-Apr-2025 | 964 | 36 | 17 | |
patches.txt | H A D | 25-Apr-2025 | 201 | 35 | 34 |
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.