-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup for persistent fuzzing #18
base: master
Are you sure you want to change the base?
Conversation
8e3120e
to
d8cd4db
Compare
9f060f7
to
ebff4a1
Compare
All is done, I also fixed the failing Docker part: on older CMakes it will now EDIT: I implemented a fall back to a regular expression to extract the file stem for older CMakes. |
5e15ea8
to
b43c98c
Compare
b43c98c
to
47ce529
Compare
fb7c08e
to
cd5834a
Compare
I'm having trouble getting it to work, with errors like Do you have the ability to run the saved test case outside afl and see the crash (in a debugger)? If you do |
BTW, you may have a bug in your test. You need to catch |
The Right now I'm using a freshly baked version: quinox@gofu ~> ~/tmp/AFLplusplus/afl-clang-lto --version
afl-cc++4.21a by Michal Zalewski, Laszlo Szekeres, Marc Heuse - mode: LLVM-LTO-PCGUARD
clang version 17.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/17/bin
Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg Their documentation can be found here: README.persistent_mode
Thanks, that fixed the majority of the findings. It took 10 minutes of fuzzing to a new set of crashes but it's only reproducible on a |
I did find those macros in the AFL source. I even tried setting an include path, but just couldn't get it to work.
You're also missing a call to There are some other considerations. I wrote a simple test case using simple brute-force fuzzing to illustrate them: Add test to briefly perform some fuzzing on parsing packets Also, of importance is Add assert to document initial size restriction on buffer. |
cd5834a
to
da3314b
Compare
The
After adding this the last crash disappeared.
For sure. The data that crashes the program is great, but also logging the backtrace etc. would be most helpful.
Yeah, at this point I'm out of my depth writing the fuzz tests themselves. For example calling For the most speed you also want to do as much initialization of your own code before the call to I limit the scope of this PR to "POC of real fast fuzzing using persistent mode". I'm happy to help you figure out why your AFL++ isn't correctly substituting its own macros, most of the other work is either knowing FlashMQ and/or making decisions about how to structure the codebase: I'll leave that to you. |
I do want to merge this setup in, that's for sure. The current fuzzing harness that writes to the That fd/buf issue is probably (somewhat) easily solved by using something like a socketpair; it's like |
DO NOT MERGE AS-IS
There's a bomb in the code to show that the fuzzing is finding results. You might want to verify for yourself that the setup is doing what it's supposed to do + remove the bomb. Feel free to canibalize this PR to your heart's content.
Also: the docker build fails. Something to do with an older cmake?Setup works correctly even on Debian now.What's this about
A setup for doing persistent mode fuzzing with AFL++ using shared memory instead of files as input. This gives superior speed and makes it easy to target different parts of the code.
I made it as easy as possible to add new fuzzing targets: copy a tiny file into
fuzz-persistent/targets/
and you're good to go. There's magic in the Makefile to auto-generate targets, and thefuzz-helper.sh
also contains magic to auto-find stuff. Compilation is a bit slow because it adds all*.ccp
files even those you don't need but on a modern machine it shouldn't be much of a problem. The alternative is writing out a CMake entry for every fuzzing target which sounds annoying.(I foresee it's possible to build a hybrid solution where you use the autogenerated setup unless you configure something specific in the
CMakeLists.txt
.)How to use
cd fuzz-persistent/ ./fuzz-helper.sh
See also
fuzz-persistent/README.md
.