-
Notifications
You must be signed in to change notification settings - Fork 85
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
Support directed fuzzing #62
Comments
Cool! Definitely interested in this :) I actually did something very similar for an older version of Magma, but never got around to porting this to the current version. Please let me know if you have any issues with the remaining targets; happy to help out where I can. Are there other directed fuzzers we could add to compare against AFLGo? I know of Hawkeye, but afaik it was never open sourced. |
Hi Adrian, Great! And thank you! Would you mind helping me to see why they fail to compile with AFLGo when you have time? For For
which are the additional flags set for AFLGo. The errors come from setting $CFLAGS in the cmd
Do you know which level should we set these additional flags then? For other directed fuzzers, I honestly don't have any in mind now that's patch-testing oriented and opensource like AFLGo. Btw, I may be trying to evaluate some hybrid fuzzers (Driller, QSYM, etc) with Magma as well soon. So scripts for those fuzzers can be expected. We can see if you would like to include them by then.
|
Cool! I just checked out your repo and aflgo branch to try to build the various targets. Currently libpng fails to build with an ~Adrian |
Ah yes, that's something I set up in purpose. It happens quite a lot in targeting different patches. But I think it should be able to locate all patches for libpng. |
Ah I think it was my fault. When running Is the intention to have a separate target per bug? |
Okay so I got a bit further with sqlite3 by changing the compile command at the end of
I still get an |
Re. openssl: I had a quick look, and for some reason
However, I have no idea why |
Yes. It is necessary to build separately for each bug, at least for AFLGo. AFLGo compiles target program twice: first to generate CFGs and calculate distances with given locations, then it takes the results to compile the final instrumented binary. (This is one of the fews things I find AFLGo tricky to use: double compiling time plus time-consuming distance calculation)
Thanks! I'll update the scripts and try to run them. For openssl I'll see if I can fix it and let you know. Thanks again! |
Hi guys, I have been also integrating AFLGO into MAGMA repo. For openssl, my quick fix is given as below:
As you already noticed, some CCFLAGS are expanded twice and LLVM pops up error for AFLGO specific options (e.g., output-dir flag). I just removed duplication after generating the Makefile. Also, no-asm flag needs to be there. So far, I could make libpng, libxml2, openssl, libtiff, sqlite3 work. Currently, I am working on PHP, and sometimes later I will give a shot to poppler. "For sqlite3, somehow the last step (compiling ossfuzz.c) cannot link external symbols properly." Yes, I also observed this. The problem is that the plugin-opt flag makes some external symbols internal for a reason and this results in a linker error. It is most probably originating from the clang version (it is very old). There is probably a bug (maybe still exists) in clang but I did not spend much time on it. For now, you can simply ignore the linker error since you do not have to create the final executable in the first step. Even if you do not link properly, you will still generate all necessary files to generate the necessary CFGs. I updated some scripts to make sure that docker does not stop after facing this error for sqlite3. (please check build.sh changes in scanakci@d6bea7f) My fork is provided below (aflgo branch). libsqlite3 and libpng should work fine but it is better not to use it for now until I verify that I added all of my local changes and test in a clean environment. I should probably fix if any issue exists during this weekend. |
@scanakci cool! Do you also get the same problem where some bugs result in empty Ftargets files, or is this due to the approach taken by @spencerwuwu? Also, does anyone know why CFLAGS get duplicated? Is this particular to the afl-clang-fast wrapper or something in the openssl build process? |
" Do you also get the same problem where some bugs result in empty Ftargets files, or is this due to the approach taken by @spencerwuwu?" I did not get any problem for around 25 bugs that I tested so far. From libpng, I tested 5 bugs and they all went well. "Also, does anyone know why CFLAGS get duplicated? Is this particular to the afl-clang-fast wrapper or something in the openssl build process?" I do not know. I walk around in some openssl build scripts but it did not look like an easy task :). |
@adrianherrera Related to this, I get "/magma/targets/openssl/corpus/server/001c159fc891438181a8255e5587c48e25efb408: exit_code 137" for around 250 inputs from the corpus folder when using openssl library with aflgo. In your evaluation, did you use -m 100M for all fuzzers and for all programs (afl-based ones)? For libpng, libxml2, sqlite3, 100M was enough but I guess it is not for openssl. It may be related to aflgo, I will check with afl, moptafl soon. |
Php also worked fine on my end. I got a linker error in the first stage similar to sqlite3 but it did not cause any problem when generating CFGs in the next step. I tested openssl with afl and moptafl with 100M and got exit_code 137 (i.e. out of memory) error. I believe memory is not enough in aflgo case because of the additional instrumentation in the code. I will increase 100M and see if there is any change. poppler is the last benchmark that needs to be fixed. I got some compilation errors that I can spend time fixing the following week. |
@scanakci yeah for our evaluation we used the configurations provided in the v1.1 branch. Try to increase the memory limit and let me know what happens. |
https://twitter.com/mboehme_/status/1372884402020122627 It seems an updated version of AFLGo has been released, and it's a lot faster |
That is great. It is also perfect that they switched to LLVM 11. All libraries worked fine with AFLGo with the previous version. To make poppler work, I needed to update build.sh I used -M 500M for openssl, but it was not enough. Unfortunately, I do not have time to test recent AFLGo in near future but I can probably test after finalizing some other works on my end. |
@spencerwuwu
Could you please provide some assistance? Thank you. Edit: Finished. Thanks. |
Hello! I am also working on integrating AFLGo into magma and fuzzing some of the bugs. I am having an issue with the empty |
Hi!
I'm trying to use magma to evaluate the performance of directed fuzzing.
I think the idea of having patches with ground-truth bugs really makes it a wonderful data set.
I made some changes to make magma work for directed fuzzers. I use the 'patches/bugs' as goals for directed fuzzers to reach.
You can find them in this fork:
https://github.com/usc-isi-bass/magma/tree/aflgo
It is not yet completed though. I'm opening this issue to see if you guys are interested in this feature, and I can create a PR later.
Currently my fork can run aflgo on libpng, libxml2 without any issues.
For other targets, I'm still trying to compile them. Also, the 'distance calculation' phase of aflgo for libxml2 takes extremely long time to compute.
I might open an issue at aflgo to see if the authors can help for these problems.
The text was updated successfully, but these errors were encountered: