mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-08 08:11:34 +00:00
* use atomic read-modify-write increment for LLVM CLASSIC * Change other LLVM modes to atomic increments * sync (#886) * Create FUNDING.yml * Update FUNDING.yml * moved custom_mutator examples * unicorn speedtest makefile cleanup * fixed example location * fix qdbi * update util readme * work in progress: not working correctly yet * Frida persistent (#880) * Added x64 support for persistent mode (function call only), in-memory teest cases and complog * Review changes, fix NeverZero and code to parse the .text section of the main executable. Excluded ranges TBC * Various minor fixes and finished support for AFL_INST_LIBS * Review changes Co-authored-by: Your Name <you@example.com> * nits * fix frida mode * Integer overflow/underflow fixes in libdislocator (#889) * libdislocator: fixing integer overflow in 'max_mem' variable and setting 'max_mem' type to 'size_t' * libdislocator: fixing potential integer underflow in 'total_mem' variable due to its different values in different threads * Bumped warnings up to the max and fixed remaining issues (#890) Co-authored-by: Your Name <you@example.com> * nits * frida mode - support non-pie * nits * nit * update grammar mutator * Fixes for aarch64, OSX and other minor issues (#891) Co-authored-by: Your Name <you@example.com> * nits * nits * fix PCGUARD, build aflpp_driver with fPIC * Added representative fuzzbench test and test for libxml (#893) * Added representative fuzzbench test and test for libxml * Added support for building FRIDA from source with FRIDA_SOURCE=1 Co-authored-by: Your Name <you@example.com> * nits * update changelog * typos * still not working * fixed potential double free in custom trim (#881) * error handling, freeing mem * frida: complog -> cmplog * fix statsd writing * let aflpp_qemu_driver_hook.so build fail gracefully * fix stdin trimming * Support for AFL_ENTRYPOINT (#898) Co-authored-by: Your Name <you@example.com> * remove the input file .cur_input at the end of the fuzzing, if AFL_TMPDIR is used * reverse push (#901) * Create FUNDING.yml * Update FUNDING.yml * disable QEMU static pie Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> * clarify that no modifications are required. * add new test for frida_mode (please review) * typos * fix persistent mode (64-bit) * set ARCH for linux intel 32-bit for frida-gum-devkit * prepare for 32-bit support (later) * not on qemu 3 anymore * unicorn mips fixes * instrumentation further move to C++11 (#900) * unicorn fixes * first working NeverZero implementation * more unicorn fixes * Fix memory errors when trim causes testcase growth (#881) (#903) * Revert "fixed potential double free in custom trim (#881)" This reverts commit e9d2f72382cab75832721d859c3e731da071435d. * Revert "fix custom trim for increasing data" This reverts commit 86a8ef168dda766d2f25f15c15c4d3ecf21d0667. * Fix memory errors when trim causes testcase growth Modify trim_case_custom to avoid writing into in_buf because some custom mutators can cause the testcase to grow rather than shrink. Instead of modifying in_buf directly, we write the update out to the disk when trimming is complete, and then the caller is responsible for refreshing the in-memory buffer from the file. This is still a bit sketchy because it does need to modify q->len in order to notify the upper layers that something changed, and it could end up telling upper layer code that the q->len is *bigger* than the buffer (q->testcase_buf) that contains it, which is asking for trouble down the line somewhere... * Fix an unlikely situation Put back some `unlikely()` calls that were in the e9d2f72382cab75832721d859c3e731da071435d commit that was reverted. * add some comments * typo * Exit on time (#904) * Variable AFL_EXIT_ON_TIME description has been added. Variables AFL_EXIT_ON_TIME and afl_exit_on_time has been added. afl->exit_on_time variable initialization has been added. The asignment of a value to the afl->afl_env.afl_exit_on_time variable from environment variables has been added. Code to exit on timeout if new path not found has been added. * Type of afl_exit_on_time variable has been changed. Variable exit_on_time has been added to the afl_state_t structure. * Command `export AFL_EXIT_WHEN_DONE=1` has been added. * Millisecond to second conversion has been added. Call get_cur_time() has been added. * Revert to using the saved current time value. * Useless check has been removed. * fix new path to custom-mutators * ensure crashes/README.txt exists * fix * Changes to bump FRIDA version and to clone FRIDA repo in to build directory rather than use a submodule as the FRIDA build scripts don't like it (#906) Co-authored-by: Your Name <you@example.com> * Fix numeric overflow in cmplog implementation (#907) Co-authored-by: Your Name <you@example.com> * testcase fixes for unicorn * remove merge conflict artifacts * fix afl-plot * Changes to remove binaries from frida_mode (#913) Co-authored-by: Your Name <you@example.com> * Frida cmplog fail fast (#914) * Changes to remove binaries from frida_mode * Changes to make cmplog fail fast Co-authored-by: Your Name <you@example.com> * afl-plot: relative time * arch linux and mac os support for afl-system-config * typo * code-format * update documentation * github workflow for qemu * OSX-specific improvements (#912) * Fix afl-cc to work correctly by default on OSX using xcode - CLANG_ENV_VAR must be set for afl-as to work - Use clang mode by default if no specific compiler selected * Add OSX-specific documentation for configuring shared memory * Fixes to memory operands for complog (#916) Co-authored-by: Your Name <you@example.com> * fix a few cur_time uses * added bounds check to pivot_inputs (fixes #921) * additional safety checks for restarts * restrict afl-showmap in_file size * fix seed crash disable * add warning for afl-showmap partial read * no core dumps * AFL_PRINT_FILENAMES added * more documentation for AFL_EXIT_ON_TIME * Flushing for AFL_PRINT_FILENAMES * FASAN Support (#918) * FASAN Support * Fix handling of Address Sanitizer DSO * Changes to identification of Address Sanitizer DSO Co-authored-by: Your Name <you@example.com> * Support for x86 (#920) Co-authored-by: Your Name <you@example.com> * Update frida_mode readme (#925) * libqasan: use syscalls for read and write * update readme * Minor integration tweaks (#926) Co-authored-by: Your Name <you@example.com> * merge * fix afl-fuzz.c frida preload * cleaned up AFL_PRINT_FILENAMES env * Changes to have persistent mode exit at the end of the loop (#928) Co-authored-by: Your Name <you@example.com> * fix llvm-dict2file * push to stable (#931) (#932) * sync (#886) * Create FUNDING.yml * Update FUNDING.yml * moved custom_mutator examples * unicorn speedtest makefile cleanup * fixed example location * fix qdbi * update util readme * Frida persistent (#880) * Added x64 support for persistent mode (function call only), in-memory teest cases and complog * Review changes, fix NeverZero and code to parse the .text section of the main executable. Excluded ranges TBC * Various minor fixes and finished support for AFL_INST_LIBS * Review changes Co-authored-by: Your Name <you@example.com> * nits * fix frida mode * Integer overflow/underflow fixes in libdislocator (#889) * libdislocator: fixing integer overflow in 'max_mem' variable and setting 'max_mem' type to 'size_t' * libdislocator: fixing potential integer underflow in 'total_mem' variable due to its different values in different threads * Bumped warnings up to the max and fixed remaining issues (#890) Co-authored-by: Your Name <you@example.com> * nits * frida mode - support non-pie * nits * nit * update grammar mutator * Fixes for aarch64, OSX and other minor issues (#891) Co-authored-by: Your Name <you@example.com> * nits * nits * fix PCGUARD, build aflpp_driver with fPIC * Added representative fuzzbench test and test for libxml (#893) * Added representative fuzzbench test and test for libxml * Added support for building FRIDA from source with FRIDA_SOURCE=1 Co-authored-by: Your Name <you@example.com> * nits * update changelog * typos * fixed potential double free in custom trim (#881) * error handling, freeing mem * frida: complog -> cmplog * fix statsd writing * let aflpp_qemu_driver_hook.so build fail gracefully * fix stdin trimming * Support for AFL_ENTRYPOINT (#898) Co-authored-by: Your Name <you@example.com> * remove the input file .cur_input at the end of the fuzzing, if AFL_TMPDIR is used * reverse push (#901) * Create FUNDING.yml * Update FUNDING.yml * disable QEMU static pie Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> * clarify that no modifications are required. * add new test for frida_mode (please review) * typos * fix persistent mode (64-bit) * set ARCH for linux intel 32-bit for frida-gum-devkit * prepare for 32-bit support (later) * not on qemu 3 anymore * unicorn mips fixes * instrumentation further move to C++11 (#900) * unicorn fixes * more unicorn fixes * Fix memory errors when trim causes testcase growth (#881) (#903) * Revert "fixed potential double free in custom trim (#881)" This reverts commit e9d2f72382cab75832721d859c3e731da071435d. * Revert "fix custom trim for increasing data" This reverts commit 86a8ef168dda766d2f25f15c15c4d3ecf21d0667. * Fix memory errors when trim causes testcase growth Modify trim_case_custom to avoid writing into in_buf because some custom mutators can cause the testcase to grow rather than shrink. Instead of modifying in_buf directly, we write the update out to the disk when trimming is complete, and then the caller is responsible for refreshing the in-memory buffer from the file. This is still a bit sketchy because it does need to modify q->len in order to notify the upper layers that something changed, and it could end up telling upper layer code that the q->len is *bigger* than the buffer (q->testcase_buf) that contains it, which is asking for trouble down the line somewhere... * Fix an unlikely situation Put back some `unlikely()` calls that were in the e9d2f72382cab75832721d859c3e731da071435d commit that was reverted. * typo * Exit on time (#904) * Variable AFL_EXIT_ON_TIME description has been added. Variables AFL_EXIT_ON_TIME and afl_exit_on_time has been added. afl->exit_on_time variable initialization has been added. The asignment of a value to the afl->afl_env.afl_exit_on_time variable from environment variables has been added. Code to exit on timeout if new path not found has been added. * Type of afl_exit_on_time variable has been changed. Variable exit_on_time has been added to the afl_state_t structure. * Command `export AFL_EXIT_WHEN_DONE=1` has been added. * Millisecond to second conversion has been added. Call get_cur_time() has been added. * Revert to using the saved current time value. * Useless check has been removed. * fix new path to custom-mutators * ensure crashes/README.txt exists * fix * Changes to bump FRIDA version and to clone FRIDA repo in to build directory rather than use a submodule as the FRIDA build scripts don't like it (#906) Co-authored-by: Your Name <you@example.com> * Fix numeric overflow in cmplog implementation (#907) Co-authored-by: Your Name <you@example.com> * testcase fixes for unicorn * remove merge conflict artifacts * fix afl-plot * Changes to remove binaries from frida_mode (#913) Co-authored-by: Your Name <you@example.com> * Frida cmplog fail fast (#914) * Changes to remove binaries from frida_mode * Changes to make cmplog fail fast Co-authored-by: Your Name <you@example.com> * afl-plot: relative time * arch linux and mac os support for afl-system-config * typo * code-format * update documentation * github workflow for qemu * OSX-specific improvements (#912) * Fix afl-cc to work correctly by default on OSX using xcode - CLANG_ENV_VAR must be set for afl-as to work - Use clang mode by default if no specific compiler selected * Add OSX-specific documentation for configuring shared memory * Fixes to memory operands for complog (#916) Co-authored-by: Your Name <you@example.com> * fix a few cur_time uses * added bounds check to pivot_inputs (fixes #921) * additional safety checks for restarts * restrict afl-showmap in_file size * fix seed crash disable * add warning for afl-showmap partial read * no core dumps * AFL_PRINT_FILENAMES added * more documentation for AFL_EXIT_ON_TIME * Flushing for AFL_PRINT_FILENAMES * FASAN Support (#918) * FASAN Support * Fix handling of Address Sanitizer DSO * Changes to identification of Address Sanitizer DSO Co-authored-by: Your Name <you@example.com> * Support for x86 (#920) Co-authored-by: Your Name <you@example.com> * Update frida_mode readme (#925) * libqasan: use syscalls for read and write * update readme * Minor integration tweaks (#926) Co-authored-by: Your Name <you@example.com> * merge * fix afl-fuzz.c frida preload * cleaned up AFL_PRINT_FILENAMES env * Changes to have persistent mode exit at the end of the loop (#928) Co-authored-by: Your Name <you@example.com> * fix llvm-dict2file Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: hexcoder- <heiko@hexco.de> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: hexcoder- <heiko@hexco.de> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> * improve error msg * Added documentation for wine LoadLibrary workaround (#933) * Fix cmake target compilation command example (#934) - Fix typo DCMAKE_C_COMPILERC -> DCMAKE_C_COMPILER. - Add `cd build` after `mkdir build`. * showmap passes queue items in alphabetical order * added tmp files to gitignore * lenient dict parsing, no map size enum for binary fuzzing * added info about showmap queue directions * update binary-only doc * turn off map size detection if skip_bin_check is set * Typo * update docs * update afl-system-config * Set kill signal before using it in afl-showmap (#935) * fix afl-cc help output * add libafl to binary-only doc * update docs * less executions on variable paths * AFL_SKIP_CRASHES is obsolete since 3.0 * add AFL_TRY_AFFINITY * Typo * Typo * Typo/wording * tweaks * typos * fix afl-whatsup help output * fix afl-plot output * fix for MacOS * fix cmpcov doc for qemu * fix tmpfile removal * update dockerfile * Frida (#940) * Added re2 test * Added libpcap test * Fix validation of setting of ADDR_NO_RANDOMIZE * Added support for printing original and instrumented code Co-authored-by: Your Name <you@example.com> * Support for AFL_FRIDA_PERSISTENT_RET (#941) Co-authored-by: Your Name <you@example.com> * Changes to add missing exclusion of ranges (#943) Co-authored-by: Your Name <you@example.com> * add --afl-noopt to afl-cc * docs: fix link to README in QuickStartGuide (#946) * Support writing Stalker stats (#945) * Support writing Stalker stats * Fixed string handling in print functions Co-authored-by: Your Name <you@example.com> * afl-cmin help fix, aflpp_driver - + @@ support * fix for afl-showmap * support new env var AFL_LLVM_THREADSAFE_INST to enable atomic counters. add new test case for that. * add documentation for AFL_LLVM_THREADSAFE_INST * add support for AFL_LLVM_THREADSAFE_INST to other LLVM passes * add missing include for _exit() * threadsafe doc fixes, code format * Wording: "never zero" -> NeverZero * fix afl_custom_post_process with multiple custom mutators * fix docs * debug ck_write * fixed potential diff by 0 * fixes * fix classic threadsafe counters * v3.13c release * back push (#952) * Dev (#949) * use atomic read-modify-write increment for LLVM CLASSIC * Change other LLVM modes to atomic increments * sync (#886) * Create FUNDING.yml * Update FUNDING.yml * moved custom_mutator examples * unicorn speedtest makefile cleanup * fixed example location * fix qdbi * update util readme * work in progress: not working correctly yet * Frida persistent (#880) * Added x64 support for persistent mode (function call only), in-memory teest cases and complog * Review changes, fix NeverZero and code to parse the .text section of the main executable. Excluded ranges TBC * Various minor fixes and finished support for AFL_INST_LIBS * Review changes Co-authored-by: Your Name <you@example.com> * nits * fix frida mode * Integer overflow/underflow fixes in libdislocator (#889) * libdislocator: fixing integer overflow in 'max_mem' variable and setting 'max_mem' type to 'size_t' * libdislocator: fixing potential integer underflow in 'total_mem' variable due to its different values in different threads * Bumped warnings up to the max and fixed remaining issues (#890) Co-authored-by: Your Name <you@example.com> * nits * frida mode - support non-pie * nits * nit * update grammar mutator * Fixes for aarch64, OSX and other minor issues (#891) Co-authored-by: Your Name <you@example.com> * nits * nits * fix PCGUARD, build aflpp_driver with fPIC * Added representative fuzzbench test and test for libxml (#893) * Added representative fuzzbench test and test for libxml * Added support for building FRIDA from source with FRIDA_SOURCE=1 Co-authored-by: Your Name <you@example.com> * nits * update changelog * typos * still not working * fixed potential double free in custom trim (#881) * error handling, freeing mem * frida: complog -> cmplog * fix statsd writing * let aflpp_qemu_driver_hook.so build fail gracefully * fix stdin trimming * Support for AFL_ENTRYPOINT (#898) Co-authored-by: Your Name <you@example.com> * remove the input file .cur_input at the end of the fuzzing, if AFL_TMPDIR is used * reverse push (#901) * Create FUNDING.yml * Update FUNDING.yml * disable QEMU static pie Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> * clarify that no modifications are required. * add new test for frida_mode (please review) * typos * fix persistent mode (64-bit) * set ARCH for linux intel 32-bit for frida-gum-devkit * prepare for 32-bit support (later) * not on qemu 3 anymore * unicorn mips fixes * instrumentation further move to C++11 (#900) * unicorn fixes * first working NeverZero implementation * more unicorn fixes * Fix memory errors when trim causes testcase growth (#881) (#903) * Revert "fixed potential double free in custom trim (#881)" This reverts commit e9d2f72382cab75832721d859c3e731da071435d. * Revert "fix custom trim for increasing data" This reverts commit 86a8ef168dda766d2f25f15c15c4d3ecf21d0667. * Fix memory errors when trim causes testcase growth Modify trim_case_custom to avoid writing into in_buf because some custom mutators can cause the testcase to grow rather than shrink. Instead of modifying in_buf directly, we write the update out to the disk when trimming is complete, and then the caller is responsible for refreshing the in-memory buffer from the file. This is still a bit sketchy because it does need to modify q->len in order to notify the upper layers that something changed, and it could end up telling upper layer code that the q->len is *bigger* than the buffer (q->testcase_buf) that contains it, which is asking for trouble down the line somewhere... * Fix an unlikely situation Put back some `unlikely()` calls that were in the e9d2f72382cab75832721d859c3e731da071435d commit that was reverted. * add some comments * typo * Exit on time (#904) * Variable AFL_EXIT_ON_TIME description has been added. Variables AFL_EXIT_ON_TIME and afl_exit_on_time has been added. afl->exit_on_time variable initialization has been added. The asignment of a value to the afl->afl_env.afl_exit_on_time variable from environment variables has been added. Code to exit on timeout if new path not found has been added. * Type of afl_exit_on_time variable has been changed. Variable exit_on_time has been added to the afl_state_t structure. * Command `export AFL_EXIT_WHEN_DONE=1` has been added. * Millisecond to second conversion has been added. Call get_cur_time() has been added. * Revert to using the saved current time value. * Useless check has been removed. * fix new path to custom-mutators * ensure crashes/README.txt exists * fix * Changes to bump FRIDA version and to clone FRIDA repo in to build directory rather than use a submodule as the FRIDA build scripts don't like it (#906) Co-authored-by: Your Name <you@example.com> * Fix numeric overflow in cmplog implementation (#907) Co-authored-by: Your Name <you@example.com> * testcase fixes for unicorn * remove merge conflict artifacts * fix afl-plot * Changes to remove binaries from frida_mode (#913) Co-authored-by: Your Name <you@example.com> * Frida cmplog fail fast (#914) * Changes to remove binaries from frida_mode * Changes to make cmplog fail fast Co-authored-by: Your Name <you@example.com> * afl-plot: relative time * arch linux and mac os support for afl-system-config * typo * code-format * update documentation * github workflow for qemu * OSX-specific improvements (#912) * Fix afl-cc to work correctly by default on OSX using xcode - CLANG_ENV_VAR must be set for afl-as to work - Use clang mode by default if no specific compiler selected * Add OSX-specific documentation for configuring shared memory * Fixes to memory operands for complog (#916) Co-authored-by: Your Name <you@example.com> * fix a few cur_time uses * added bounds check to pivot_inputs (fixes #921) * additional safety checks for restarts * restrict afl-showmap in_file size * fix seed crash disable * add warning for afl-showmap partial read * no core dumps * AFL_PRINT_FILENAMES added * more documentation for AFL_EXIT_ON_TIME * Flushing for AFL_PRINT_FILENAMES * FASAN Support (#918) * FASAN Support * Fix handling of Address Sanitizer DSO * Changes to identification of Address Sanitizer DSO Co-authored-by: Your Name <you@example.com> * Support for x86 (#920) Co-authored-by: Your Name <you@example.com> * Update frida_mode readme (#925) * libqasan: use syscalls for read and write * update readme * Minor integration tweaks (#926) Co-authored-by: Your Name <you@example.com> * merge * fix afl-fuzz.c frida preload * cleaned up AFL_PRINT_FILENAMES env * Changes to have persistent mode exit at the end of the loop (#928) Co-authored-by: Your Name <you@example.com> * fix llvm-dict2file * push to stable (#931) (#932) * sync (#886) * Create FUNDING.yml * Update FUNDING.yml * moved custom_mutator examples * unicorn speedtest makefile cleanup * fixed example location * fix qdbi * update util readme * Frida persistent (#880) * Added x64 support for persistent mode (function call only), in-memory teest cases and complog * Review changes, fix NeverZero and code to parse the .text section of the main executable. Excluded ranges TBC * Various minor fixes and finished support for AFL_INST_LIBS * Review changes Co-authored-by: Your Name <you@example.com> * nits * fix frida mode * Integer overflow/underflow fixes in libdislocator (#889) * libdislocator: fixing integer overflow in 'max_mem' variable and setting 'max_mem' type to 'size_t' * libdislocator: fixing potential integer underflow in 'total_mem' variable due to its different values in different threads * Bumped warnings up to the max and fixed remaining issues (#890) Co-authored-by: Your Name <you@example.com> * nits * frida mode - support non-pie * nits * nit * update grammar mutator * Fixes for aarch64, OSX and other minor issues (#891) Co-authored-by: Your Name <you@example.com> * nits * nits * fix PCGUARD, build aflpp_driver with fPIC * Added representative fuzzbench test and test for libxml (#893) * Added representative fuzzbench test and test for libxml * Added support for building FRIDA from source with FRIDA_SOURCE=1 Co-authored-by: Your Name <you@example.com> * nits * update changelog * typos * fixed potential double free in custom trim (#881) * error handling, freeing mem * frida: complog -> cmplog * fix statsd writing * let aflpp_qemu_driver_hook.so build fail gracefully * fix stdin trimming * Support for AFL_ENTRYPOINT (#898) Co-authored-by: Your Name <you@example.com> * remove the input file .cur_input at the end of the fuzzing, if AFL_TMPDIR is used * reverse push (#901) * Create FUNDING.yml * Update FUNDING.yml * disable QEMU static pie Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> * clarify that no modifications are required. * add new test for frida_mode (please review) * typos * fix persistent mode (64-bit) * set ARCH for linux intel 32-bit for frida-gum-devkit * prepare for 32-bit support (later) * not on qemu 3 anymore * unicorn mips fixes * instrumentation further move to C++11 (#900) * unicorn fixes * more unicorn fixes * Fix memory errors when trim causes testcase growth (#881) (#903) * Revert "fixed potential double free in custom trim (#881)" This reverts commit e9d2f72382cab75832721d859c3e731da071435d. * Revert "fix custom trim for increasing data" This reverts commit 86a8ef168dda766d2f25f15c15c4d3ecf21d0667. * Fix memory errors when trim causes testcase growth Modify trim_case_custom to avoid writing into in_buf because some custom mutators can cause the testcase to grow rather than shrink. Instead of modifying in_buf directly, we write the update out to the disk when trimming is complete, and then the caller is responsible for refreshing the in-memory buffer from the file. This is still a bit sketchy because it does need to modify q->len in order to notify the upper layers that something changed, and it could end up telling upper layer code that the q->len is *bigger* than the buffer (q->testcase_buf) that contains it, which is asking for trouble down the line somewhere... * Fix an unlikely situation Put back some `unlikely()` calls that were in the e9d2f72382cab75832721d859c3e731da071435d commit that was reverted. * typo * Exit on time (#904) * Variable AFL_EXIT_ON_TIME description has been added. Variables AFL_EXIT_ON_TIME and afl_exit_on_time has been added. afl->exit_on_time variable initialization has been added. The asignment of a value to the afl->afl_env.afl_exit_on_time variable from environment variables has been added. Code to exit on timeout if new path not found has been added. * Type of afl_exit_on_time variable has been changed. Variable exit_on_time has been added to the afl_state_t structure. * Command `export AFL_EXIT_WHEN_DONE=1` has been added. * Millisecond to second conversion has been added. Call get_cur_time() has been added. * Revert to using the saved current time value. * Useless check has been removed. * fix new path to custom-mutators * ensure crashes/README.txt exists * fix * Changes to bump FRIDA version and to clone FRIDA repo in to build directory rather than use a submodule as the FRIDA build scripts don't like it (#906) Co-authored-by: Your Name <you@example.com> * Fix numeric overflow in cmplog implementation (#907) Co-authored-by: Your Name <you@example.com> * testcase fixes for unicorn * remove merge conflict artifacts * fix afl-plot * Changes to remove binaries from frida_mode (#913) Co-authored-by: Your Name <you@example.com> * Frida cmplog fail fast (#914) * Changes to remove binaries from frida_mode * Changes to make cmplog fail fast Co-authored-by: Your Name <you@example.com> * afl-plot: relative time * arch linux and mac os support for afl-system-config * typo * code-format * update documentation * github workflow for qemu * OSX-specific improvements (#912) * Fix afl-cc to work correctly by default on OSX using xcode - CLANG_ENV_VAR must be set for afl-as to work - Use clang mode by default if no specific compiler selected * Add OSX-specific documentation for configuring shared memory * Fixes to memory operands for complog (#916) Co-authored-by: Your Name <you@example.com> * fix a few cur_time uses * added bounds check to pivot_inputs (fixes #921) * additional safety checks for restarts * restrict afl-showmap in_file size * fix seed crash disable * add warning for afl-showmap partial read * no core dumps * AFL_PRINT_FILENAMES added * more documentation for AFL_EXIT_ON_TIME * Flushing for AFL_PRINT_FILENAMES * FASAN Support (#918) * FASAN Support * Fix handling of Address Sanitizer DSO * Changes to identification of Address Sanitizer DSO Co-authored-by: Your Name <you@example.com> * Support for x86 (#920) Co-authored-by: Your Name <you@example.com> * Update frida_mode readme (#925) * libqasan: use syscalls for read and write * update readme * Minor integration tweaks (#926) Co-authored-by: Your Name <you@example.com> * merge * fix afl-fuzz.c frida preload * cleaned up AFL_PRINT_FILENAMES env * Changes to have persistent mode exit at the end of the loop (#928) Co-authored-by: Your Name <you@example.com> * fix llvm-dict2file Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: hexcoder- <heiko@hexco.de> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: hexcoder- <heiko@hexco.de> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> * improve error msg * Added documentation for wine LoadLibrary workaround (#933) * Fix cmake target compilation command example (#934) - Fix typo DCMAKE_C_COMPILERC -> DCMAKE_C_COMPILER. - Add `cd build` after `mkdir build`. * showmap passes queue items in alphabetical order * added tmp files to gitignore * lenient dict parsing, no map size enum for binary fuzzing * added info about showmap queue directions * update binary-only doc * turn off map size detection if skip_bin_check is set * Typo * update docs * update afl-system-config * Set kill signal before using it in afl-showmap (#935) * fix afl-cc help output * add libafl to binary-only doc * update docs * less executions on variable paths * AFL_SKIP_CRASHES is obsolete since 3.0 * add AFL_TRY_AFFINITY * Typo * Typo * Typo/wording * tweaks * typos * fix afl-whatsup help output * fix afl-plot output * fix for MacOS * fix cmpcov doc for qemu * fix tmpfile removal * update dockerfile * Frida (#940) * Added re2 test * Added libpcap test * Fix validation of setting of ADDR_NO_RANDOMIZE * Added support for printing original and instrumented code Co-authored-by: Your Name <you@example.com> * Support for AFL_FRIDA_PERSISTENT_RET (#941) Co-authored-by: Your Name <you@example.com> * Changes to add missing exclusion of ranges (#943) Co-authored-by: Your Name <you@example.com> * add --afl-noopt to afl-cc * docs: fix link to README in QuickStartGuide (#946) * Support writing Stalker stats (#945) * Support writing Stalker stats * Fixed string handling in print functions Co-authored-by: Your Name <you@example.com> * afl-cmin help fix, aflpp_driver - + @@ support * fix for afl-showmap * support new env var AFL_LLVM_THREADSAFE_INST to enable atomic counters. add new test case for that. * add documentation for AFL_LLVM_THREADSAFE_INST * add support for AFL_LLVM_THREADSAFE_INST to other LLVM passes * add missing include for _exit() * threadsafe doc fixes, code format * Wording: "never zero" -> NeverZero * fix afl_custom_post_process with multiple custom mutators * fix docs * debug ck_write * fixed potential diff by 0 * fixes * fix classic threadsafe counters Co-authored-by: van Hauser <vh@thc.org> Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> Co-authored-by: 0x4d5a-ctf <51098072+0x4d5a-ctf@users.noreply.github.com> Co-authored-by: Tommy Chiang <oToToT@users.noreply.github.com> Co-authored-by: buherator <buherator@silentsignal.hu> Co-authored-by: Dag Heyman Kajevic <dag.heyman@gmail.com> * v3.13c release (#950) * use atomic read-modify-write increment for LLVM CLASSIC * Change other LLVM modes to atomic increments * sync (#886) * Create FUNDING.yml * Update FUNDING.yml * moved custom_mutator examples * unicorn speedtest makefile cleanup * fixed example location * fix qdbi * update util readme * work in progress: not working correctly yet * Frida persistent (#880) * Added x64 support for persistent mode (function call only), in-memory teest cases and complog * Review changes, fix NeverZero and code to parse the .text section of the main executable. Excluded ranges TBC * Various minor fixes and finished support for AFL_INST_LIBS * Review changes Co-authored-by: Your Name <you@example.com> * nits * fix frida mode * Integer overflow/underflow fixes in libdislocator (#889) * libdislocator: fixing integer overflow in 'max_mem' variable and setting 'max_mem' type to 'size_t' * libdislocator: fixing potential integer underflow in 'total_mem' variable due to its different values in different threads * Bumped warnings up to the max and fixed remaining issues (#890) Co-authored-by: Your Name <you@example.com> * nits * frida mode - support non-pie * nits * nit * update grammar mutator * Fixes for aarch64, OSX and other minor issues (#891) Co-authored-by: Your Name <you@example.com> * nits * nits * fix PCGUARD, build aflpp_driver with fPIC * Added representative fuzzbench test and test for libxml (#893) * Added representative fuzzbench test and test for libxml * Added support for building FRIDA from source with FRIDA_SOURCE=1 Co-authored-by: Your Name <you@example.com> * nits * update changelog * typos * still not working * fixed potential double free in custom trim (#881) * error handling, freeing mem * frida: complog -> cmplog * fix statsd writing * let aflpp_qemu_driver_hook.so build fail gracefully * fix stdin trimming * Support for AFL_ENTRYPOINT (#898) Co-authored-by: Your Name <you@example.com> * remove the input file .cur_input at the end of the fuzzing, if AFL_TMPDIR is used * reverse push (#901) * Create FUNDING.yml * Update FUNDING.yml * disable QEMU static pie Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> * clarify that no modifications are required. * add new test for frida_mode (please review) * typos * fix persistent mode (64-bit) * set ARCH for linux intel 32-bit for frida-gum-devkit * prepare for 32-bit support (later) * not on qemu 3 anymore * unicorn mips fixes * instrumentation further move to C++11 (#900) * unicorn fixes * first working NeverZero implementation * more unicorn fixes * Fix memory errors when trim causes testcase growth (#881) (#903) * Revert "fixed potential double free in custom trim (#881)" This reverts commit e9d2f72382cab75832721d859c3e731da071435d. * Revert "fix custom trim for increasing data" This reverts commit 86a8ef168dda766d2f25f15c15c4d3ecf21d0667. * Fix memory errors when trim causes testcase growth Modify trim_case_custom to avoid writing into in_buf because some custom mutators can cause the testcase to grow rather than shrink. Instead of modifying in_buf directly, we write the update out to the disk when trimming is complete, and then the caller is responsible for refreshing the in-memory buffer from the file. This is still a bit sketchy because it does need to modify q->len in order to notify the upper layers that something changed, and it could end up telling upper layer code that the q->len is *bigger* than the buffer (q->testcase_buf) that contains it, which is asking for trouble down the line somewhere... * Fix an unlikely situation Put back some `unlikely()` calls that were in the e9d2f72382cab75832721d859c3e731da071435d commit that was reverted. * add some comments * typo * Exit on time (#904) * Variable AFL_EXIT_ON_TIME description has been added. Variables AFL_EXIT_ON_TIME and afl_exit_on_time has been added. afl->exit_on_time variable initialization has been added. The asignment of a value to the afl->afl_env.afl_exit_on_time variable from environment variables has been added. Code to exit on timeout if new path not found has been added. * Type of afl_exit_on_time variable has been changed. Variable exit_on_time has been added to the afl_state_t structure. * Command `export AFL_EXIT_WHEN_DONE=1` has been added. * Millisecond to second conversion has been added. Call get_cur_time() has been added. * Revert to using the saved current time value. * Useless check has been removed. * fix new path to custom-mutators * ensure crashes/README.txt exists * fix * Changes to bump FRIDA version and to clone FRIDA repo in to build directory rather than use a submodule as the FRIDA build scripts don't like it (#906) Co-authored-by: Your Name <you@example.com> * Fix numeric overflow in cmplog implementation (#907) Co-authored-by: Your Name <you@example.com> * testcase fixes for unicorn * remove merge conflict artifacts * fix afl-plot * Changes to remove binaries from frida_mode (#913) Co-authored-by: Your Name <you@example.com> * Frida cmplog fail fast (#914) * Changes to remove binaries from frida_mode * Changes to make cmplog fail fast Co-authored-by: Your Name <you@example.com> * afl-plot: relative time * arch linux and mac os support for afl-system-config * typo * code-format * update documentation * github workflow for qemu * OSX-specific improvements (#912) * Fix afl-cc to work correctly by default on OSX using xcode - CLANG_ENV_VAR must be set for afl-as to work - Use clang mode by default if no specific compiler selected * Add OSX-specific documentation for configuring shared memory * Fixes to memory operands for complog (#916) Co-authored-by: Your Name <you@example.com> * fix a few cur_time uses * added bounds check to pivot_inputs (fixes #921) * additional safety checks for restarts * restrict afl-showmap in_file size * fix seed crash disable * add warning for afl-showmap partial read * no core dumps * AFL_PRINT_FILENAMES added * more documentation for AFL_EXIT_ON_TIME * Flushing for AFL_PRINT_FILENAMES * FASAN Support (#918) * FASAN Support * Fix handling of Address Sanitizer DSO * Changes to identification of Address Sanitizer DSO Co-authored-by: Your Name <you@example.com> * Support for x86 (#920) Co-authored-by: Your Name <you@example.com> * Update frida_mode readme (#925) * libqasan: use syscalls for read and write * update readme * Minor integration tweaks (#926) Co-authored-by: Your Name <you@example.com> * merge * fix afl-fuzz.c frida preload * cleaned up AFL_PRINT_FILENAMES env * Changes to have persistent mode exit at the end of the loop (#928) Co-authored-by: Your Name <you@example.com> * fix llvm-dict2file * push to stable (#931) (#932) * sync (#886) * Create FUNDING.yml * Update FUNDING.yml * moved custom_mutator examples * unicorn speedtest makefile cleanup * fixed example location * fix qdbi * update util readme * Frida persistent (#880) * Added x64 support for persistent mode (function call only), in-memory teest cases and complog * Review changes, fix NeverZero and code to parse the .text section of the main executable. Excluded ranges TBC * Various minor fixes and finished support for AFL_INST_LIBS * Review changes Co-authored-by: Your Name <you@example.com> * nits * fix frida mode * Integer overflow/underflow fixes in libdislocator (#889) * libdislocator: fixing integer overflow in 'max_mem' variable and setting 'max_mem' type to 'size_t' * libdislocator: fixing potential integer underflow in 'total_mem' variable due to its different values in different threads * Bumped warnings up to the max and fixed remaining issues (#890) Co-authored-by: Your Name <you@example.com> * nits * frida mode - support non-pie * nits * nit * update grammar mutator * Fixes for aarch64, OSX and other minor issues (#891) Co-authored-by: Your Name <you@example.com> * nits * nits * fix PCGUARD, build aflpp_driver with fPIC * Added representative fuzzbench test and test for libxml (#893) * Added representative fuzzbench test and test for libxml * Added support for building FRIDA from source with FRIDA_SOURCE=1 Co-authored-by: Your Name <you@example.com> * nits * update changelog * typos * fixed potential double free in custom trim (#881) * error handling, freeing mem * frida: complog -> cmplog * fix statsd writing * let aflpp_qemu_driver_hook.so build fail gracefully * fix stdin trimming * Support for AFL_ENTRYPOINT (#898) Co-authored-by: Your Name <you@example.com> * remove the input file .cur_input at the end of the fuzzing, if AFL_TMPDIR is used * reverse push (#901) * Create FUNDING.yml * Update FUNDING.yml * disable QEMU static pie Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> * clarify that no modifications are required. * add new test for frida_mode (please review) * typos * fix persistent mode (64-bit) * set ARCH for linux intel 32-bit for frida-gum-devkit * prepare for 32-bit support (later) * not on qemu 3 anymore * unicorn mips fixes * instrumentation further move to C++11 (#900) * unicorn fixes * more unicorn fixes * Fix memory errors when trim causes testcase growth (#881) (#903) * Revert "fixed potential double free in custom trim (#881)" This reverts commit e9d2f72382cab75832721d859c3e731da071435d. * Revert "fix custom trim for increasing data" This reverts commit 86a8ef168dda766d2f25f15c15c4d3ecf21d0667. * Fix memory errors when trim causes testcase growth Modify trim_case_custom to avoid writing into in_buf because some custom mutators can cause the testcase to grow rather than shrink. Instead of modifying in_buf directly, we write the update out to the disk when trimming is complete, and then the caller is responsible for refreshing the in-memory buffer from the file. This is still a bit sketchy because it does need to modify q->len in order to notify the upper layers that something changed, and it could end up telling upper layer code that the q->len is *bigger* than the buffer (q->testcase_buf) that contains it, which is asking for trouble down the line somewhere... * Fix an unlikely situation Put back some `unlikely()` calls that were in the e9d2f72382cab75832721d859c3e731da071435d commit that was reverted. * typo * Exit on time (#904) * Variable AFL_EXIT_ON_TIME description has been added. Variables AFL_EXIT_ON_TIME and afl_exit_on_time has been added. afl->exit_on_time variable initialization has been added. The asignment of a value to the afl->afl_env.afl_exit_on_time variable from environment variables has been added. Code to exit on timeout if new path not found has been added. * Type of afl_exit_on_time variable has been changed. Variable exit_on_time has been added to the afl_state_t structure. * Command `export AFL_EXIT_WHEN_DONE=1` has been added. * Millisecond to second conversion has been added. Call get_cur_time() has been added. * Revert to using the saved current time value. * Useless check has been removed. * fix new path to custom-mutators * ensure crashes/README.txt exists * fix * Changes to bump FRIDA version and to clone FRIDA repo in to build directory rather than use a submodule as the FRIDA build scripts don't like it (#906) Co-authored-by: Your Name <you@example.com> * Fix numeric overflow in cmplog implementation (#907) Co-authored-by: Your Name <you@example.com> * testcase fixes for unicorn * remove merge conflict artifacts * fix afl-plot * Changes to remove binaries from frida_mode (#913) Co-authored-by: Your Name <you@example.com> * Frida cmplog fail fast (#914) * Changes to remove binaries from frida_mode * Changes to make cmplog fail fast Co-authored-by: Your Name <you@example.com> * afl-plot: relative time * arch linux and mac os support for afl-system-config * typo * code-format * update documentation * github workflow for qemu * OSX-specific improvements (#912) * Fix afl-cc to work correctly by default on OSX using xcode - CLANG_ENV_VAR must be set for afl-as to work - Use clang mode by default if no specific compiler selected * Add OSX-specific documentation for configuring shared memory * Fixes to memory operands for complog (#916) Co-authored-by: Your Name <you@example.com> * fix a few cur_time uses * added bounds check to pivot_inputs (fixes #921) * additional safety checks for restarts * restrict afl-showmap in_file size * fix seed crash disable * add warning for afl-showmap partial read * no core dumps * AFL_PRINT_FILENAMES added * more documentation for AFL_EXIT_ON_TIME * Flushing for AFL_PRINT_FILENAMES * FASAN Support (#918) * FASAN Support * Fix handling of Address Sanitizer DSO * Changes to identification of Address Sanitizer DSO Co-authored-by: Your Name <you@example.com> * Support for x86 (#920) Co-authored-by: Your Name <you@example.com> * Update frida_mode readme (#925) * libqasan: use syscalls for read and write * update readme * Minor integration tweaks (#926) Co-authored-by: Your Name <you@example.com> * merge * fix afl-fuzz.c frida preload * cleaned up AFL_PRINT_FILENAMES env * Changes to have persistent mode exit at the end of the loop (#928) Co-authored-by: Your Name <you@example.com> * fix llvm-dict2file Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: hexcoder- <heiko@hexco.de> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: hexcoder- <heiko@hexco.de> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> * improve error msg * Added documentation for wine LoadLibrary workaround (#933) * Fix cmake target compilation command example (#934) - Fix typo DCMAKE_C_COMPILERC -> DCMAKE_C_COMPILER. - Add `cd build` after `mkdir build`. * showmap passes queue items in alphabetical order * added tmp files to gitignore * lenient dict parsing, no map size enum for binary fuzzing * added info about showmap queue directions * update binary-only doc * turn off map size detection if skip_bin_check is set * Typo * update docs * update afl-system-config * Set kill signal before using it in afl-showmap (#935) * fix afl-cc help output * add libafl to binary-only doc * update docs * less executions on variable paths * AFL_SKIP_CRASHES is obsolete since 3.0 * add AFL_TRY_AFFINITY * Typo * Typo * Typo/wording * tweaks * typos * fix afl-whatsup help output * fix afl-plot output * fix for MacOS * fix cmpcov doc for qemu * fix tmpfile removal * update dockerfile * Frida (#940) * Added re2 test * Added libpcap test * Fix validation of setting of ADDR_NO_RANDOMIZE * Added support for printing original and instrumented code Co-authored-by: Your Name <you@example.com> * Support for AFL_FRIDA_PERSISTENT_RET (#941) Co-authored-by: Your Name <you@example.com> * Changes to add missing exclusion of ranges (#943) Co-authored-by: Your Name <you@example.com> * add --afl-noopt to afl-cc * docs: fix link to README in QuickStartGuide (#946) * Support writing Stalker stats (#945) * Support writing Stalker stats * Fixed string handling in print functions Co-authored-by: Your Name <you@example.com> * afl-cmin help fix, aflpp_driver - + @@ support * fix for afl-showmap * support new env var AFL_LLVM_THREADSAFE_INST to enable atomic counters. add new test case for that. * add documentation for AFL_LLVM_THREADSAFE_INST * add support for AFL_LLVM_THREADSAFE_INST to other LLVM passes * add missing include for _exit() * threadsafe doc fixes, code format * Wording: "never zero" -> NeverZero * fix afl_custom_post_process with multiple custom mutators * fix docs * debug ck_write * fixed potential diff by 0 * fixes * fix classic threadsafe counters * v3.13c release Co-authored-by: hexcoder- <heiko@hexco.de> Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> Co-authored-by: 0x4d5a-ctf <51098072+0x4d5a-ctf@users.noreply.github.com> Co-authored-by: Tommy Chiang <oToToT@users.noreply.github.com> Co-authored-by: buherator <buherator@silentsignal.hu> Co-authored-by: Dag Heyman Kajevic <dag.heyman@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> Co-authored-by: 0x4d5a-ctf <51098072+0x4d5a-ctf@users.noreply.github.com> Co-authored-by: Tommy Chiang <oToToT@users.noreply.github.com> Co-authored-by: buherator <buherator@silentsignal.hu> Co-authored-by: Dag Heyman Kajevic <dag.heyman@gmail.com> Co-authored-by: hexcoder- <heiko@hexco.de> * v3.14a init * remove redundant unsetenv (#947) * update MacOS Install information * add missing clean action for frida_mode * ensure memory is there before free * adapt to incompatible LLVM 13 API * fix stupid typos * add fix info * build afl-compiler-rt even with broken llvm * fix -F with slash option * dynamic_list and afl-compiler-rt rework * detect partial linking in afl-cc * partial linking with -Wl * Add proper name and URL for Zafl (#959) * move link * add known frontends for supported compiler infrastructures * add Rust * fix ui fuzzing stage index (#960) * fix overflowing UI fields 'now processing' * restored timeout handling (with SIGALRM for now) * On non-Linux systems make clean may fail for frida_mode * give hint how to set env var for path to llvm-config tool * setting AFL_CC for test-llvm.sh on FreeBSD is not necessary anymore * remove -D from -M * write target errors to out_dir/error.txt * add changelog entry * add changelog * format * more info for error logging * Forkserver for afl-analyze (#963) * afl-analyze forkserver * added missing vars to forkserver * synchronized a bit more with afl-tmin * more debugging, runs now, but need to suppress target output * fix dev/null setting * afl-analyze info: Co-authored-by: hexcoder- <heiko@hexco.de> * proper newlines * reenable LLVM 3.8 ( Ubuntu 16.04 ) * FRIDA AARCH64 support (#965) Co-authored-by: Your Name <you@example.com> * adapt docs to minimum LLVM version * adapt to minimum llvm version * remove warning regarding core_pattern (was wrong/unnecessary anyway) * avoid code duplication, symlink header file * clippy fixes * add test cases for splitting integer comparisons * Revert "add test cases for splitting integer comparisons" This reverts commit e0aa411647e1a525a3a0488d929ec71611388d54. * add test cases for splitting integer comparisons * FRIDA - Remove need for AFL_FRIDA_PERSISTENT_RETADDR_OFFSET (#970) Co-authored-by: Your Name <you@example.com> * fix AFL_CAL_FAST * fix cmplog screen update crash * Frida complog fix (#971) * Fix complog issue with changing address space * Added support for printing command line and environment during startup * Review fixes Co-authored-by: Your Name <you@example.com> * Improve tracing support to include real addresses and edge ids and also support logging edges only once (#972) Co-authored-by: Your Name <you@example.com> * split-comparison llvm pass refactor for smaller compilation times (and a small bug fix) (#964) * Refactored split compare pass to be more efficient in LTO usage and allow splitting to other minimum bitwidths. Efficiency: avoid looping over the whole llvm module N times, when once is also enough. Bitwidth: Previously, due to fallthrough in switch-case, all comparisons were split to 8-bit, which might not be desirable e.g., 16 or 32 bit might be enough. So now all comparison are split until they are smaller or equal to the target bitwidth, which is controlled through the `AFL_LLVM_LAF_SPLIT_COMPARES_BITW` environment variable. * fixed miscompilation due to incorrectly trying to split a signed comparison operator * minor formatting updates and use IRBuilder when inserting multiple instructions * added @hexcoder-'s test-int_cases.c to make test * Avoid recursion; switch to smallvector in splitAndSimplify; use switch case for icmp type; * Fixed issue when splitting < where the inverse comparison was not further split * some cleanup * code format * fix to instrument global c++ namespace functions * update changelog * document frida changes * Fix typo in README.md (#974) * adapt for LLVM 3.8.0 * fix README * little inline * Add debug output to alert user to calibration progress/issues (#969) * aflppdriver help output * code format Co-authored-by: hexcoder- <heiko@hexco.de> Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: Dmitry Zheregelya <zheregelya.d@gmail.com> Co-authored-by: hexcoder <hexcoder-@users.noreply.github.com> Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: realmadsci <71108352+realmadsci@users.noreply.github.com> Co-authored-by: Roman M. Iudichev <SecNotice@ya.ru> Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com> Co-authored-by: 0x4d5a-ctf <51098072+0x4d5a-ctf@users.noreply.github.com> Co-authored-by: Tommy Chiang <oToToT@users.noreply.github.com> Co-authored-by: buherator <buherator@silentsignal.hu> Co-authored-by: Dag Heyman Kajevic <dag.heyman@gmail.com> Co-authored-by: terrynini <terrynini38514@gmail.com> Co-authored-by: jdhiser <hiser@virginia.edu> Co-authored-by: yuan <ssspeed00@gmail.com> Co-authored-by: Michael Rodler <michael.rodler@paluno.uni-due.de> Co-authored-by: Artis <32833063+Artis24106@users.noreply.github.com>
661 lines
31 KiB
Markdown
661 lines
31 KiB
Markdown
# Environmental variables
|
|
|
|
This document discusses the environment variables used by American Fuzzy Lop++
|
|
to expose various exotic functions that may be (rarely) useful for power
|
|
users or for some types of custom fuzzing setups. See [README.md](README.md) for the general
|
|
instruction manual.
|
|
|
|
Note that most tools will warn on any unknown AFL environment variables.
|
|
This is for warning on typos that can happen. If you want to disable this
|
|
check then set the `AFL_IGNORE_UNKNOWN_ENVS` environment variable.
|
|
|
|
## 1) Settings for all compilers
|
|
|
|
Starting with afl++ 3.0 there is only one compiler: afl-cc
|
|
To select the different instrumentation modes this can be done by
|
|
1. passing the --afl-MODE command line option to the compiler
|
|
2. or using a symlink to afl-cc: afl-gcc, afl-g++, afl-clang, afl-clang++,
|
|
afl-clang-fast, afl-clang-fast++, afl-clang-lto, afl-clang-lto++,
|
|
afl-gcc-fast, afl-g++-fast
|
|
3. or using the environment variable `AFL_CC_COMPILER` with `MODE`
|
|
|
|
`MODE` can be one of `LTO` (afl-clang-lto*), `LLVM` (afl-clang-fast*), `GCC_PLUGIN`
|
|
(afl-g*-fast) or `GCC` (afl-gcc/afl-g++).
|
|
|
|
Because (with the exception of the --afl-MODE command line option) the
|
|
compile-time tools do not accept afl specific command-line options, they
|
|
make fairly broad use of environmental variables instead:
|
|
|
|
- Some build/configure scripts break with afl++ compilers. To be able to
|
|
pass them, do:
|
|
```
|
|
export CC=afl-cc
|
|
export CXX=afl-c++
|
|
export AFL_NOOPT=1
|
|
./configure --disable-shared --disabler-werror
|
|
unset AFL_NOOPT
|
|
make
|
|
```
|
|
|
|
- Most afl tools do not print any output if stdout/stderr are redirected.
|
|
If you want to get the output into a file then set the `AFL_DEBUG`
|
|
environment variable.
|
|
This is sadly necessary for various build processes which fail otherwise.
|
|
|
|
- Setting `AFL_HARDEN` automatically adds code hardening options when invoking
|
|
the downstream compiler. This currently includes `-D_FORTIFY_SOURCE=2` and
|
|
`-fstack-protector-all`. The setting is useful for catching non-crashing
|
|
memory bugs at the expense of a very slight (sub-5%) performance loss.
|
|
|
|
- By default, the wrapper appends `-O3` to optimize builds. Very rarely, this
|
|
will cause problems in programs built with -Werror, simply because `-O3`
|
|
enables more thorough code analysis and can spew out additional warnings.
|
|
To disable optimizations, set `AFL_DONT_OPTIMIZE`.
|
|
However if `-O...` and/or `-fno-unroll-loops` are set, these are not
|
|
overridden.
|
|
|
|
- Setting `AFL_USE_ASAN` automatically enables ASAN, provided that your
|
|
compiler supports it. Note that fuzzing with ASAN is mildly challenging
|
|
- see [notes_for_asan.md](notes_for_asan.md).
|
|
|
|
(You can also enable MSAN via `AFL_USE_MSAN`; ASAN and MSAN come with the
|
|
same gotchas; the modes are mutually exclusive. UBSAN can be enabled
|
|
similarly by setting the environment variable `AFL_USE_UBSAN=1`. Finally
|
|
there is the Control Flow Integrity sanitizer that can be activated by
|
|
`AFL_USE_CFISAN=1`)
|
|
|
|
- Setting `AFL_USE_LSAN` automatically enables Leak-Sanitizer, provided
|
|
that your compiler supports it. To perform a leak check within your
|
|
program at a certain point (such as at the end of an __AFL_LOOP),
|
|
you can run the macro __AFL_LEAK_CHECK(); which will cause
|
|
an abort if any memory is leaked (you can combine this with the
|
|
LSAN_OPTIONS=suppressions option to supress some known leaks).
|
|
|
|
- Setting `AFL_CC`, `AFL_CXX`, and `AFL_AS` lets you use alternate downstream
|
|
compilation tools, rather than the default 'clang', 'gcc', or 'as' binaries
|
|
in your `$PATH`.
|
|
|
|
- `AFL_PATH` can be used to point afl-gcc to an alternate location of afl-as.
|
|
One possible use of this is utils/clang_asm_normalize/, which lets
|
|
you instrument hand-written assembly when compiling clang code by plugging
|
|
a normalizer into the chain. (There is no equivalent feature for GCC.)
|
|
|
|
- Setting `AFL_INST_RATIO` to a percentage between 0 and 100 controls the
|
|
probability of instrumenting every branch. This is (very rarely) useful
|
|
when dealing with exceptionally complex programs that saturate the output
|
|
bitmap. Examples include v8, ffmpeg, and perl.
|
|
|
|
(If this ever happens, afl-fuzz will warn you ahead of the time by
|
|
displaying the "bitmap density" field in fiery red.)
|
|
|
|
Setting `AFL_INST_RATIO` to 0 is a valid choice. This will instrument only
|
|
the transitions between function entry points, but not individual branches.
|
|
|
|
Note that this is an outdated variable. A few instances (e.g. afl-gcc)
|
|
still support these, but state-of-the-art (e.g. LLVM LTO and LLVM PCGUARD)
|
|
do not need this.
|
|
|
|
- `AFL_NO_BUILTIN` causes the compiler to generate code suitable for use with
|
|
libtokencap.so (but perhaps running a bit slower than without the flag).
|
|
|
|
- `TMPDIR` is used by afl-as for temporary files; if this variable is not set,
|
|
the tool defaults to /tmp.
|
|
|
|
- If you are a weird person that wants to compile and instrument asm
|
|
text files then use the `AFL_AS_FORCE_INSTRUMENT` variable:
|
|
`AFL_AS_FORCE_INSTRUMENT=1 afl-gcc foo.s -o foo`
|
|
|
|
- Setting `AFL_QUIET` will prevent afl-cc and afl-as banners from being
|
|
displayed during compilation, in case you find them distracting.
|
|
|
|
## 2) Settings for LLVM and LTO: afl-clang-fast / afl-clang-fast++ / afl-clang-lto / afl-clang-lto++
|
|
|
|
The native instrumentation helpers (instrumentation and gcc_plugin) accept a subset
|
|
of the settings discussed in section 1, with the exception of:
|
|
|
|
- LLVM modes support `AFL_LLVM_DICT2FILE=/absolute/path/file.txt` which will
|
|
write all constant string comparisons to this file to be used later with
|
|
afl-fuzz' `-x` option.
|
|
|
|
- `AFL_AS`, since this toolchain does not directly invoke GNU as.
|
|
|
|
- `TMPDIR` and `AFL_KEEP_ASSEMBLY`, since no temporary assembly files are
|
|
created.
|
|
|
|
- `AFL_INST_RATIO`, as we by default use collision free instrumentation.
|
|
Not all passes support this option though as it is an outdated feature.
|
|
|
|
Then there are a few specific features that are only available in instrumentation mode:
|
|
|
|
### Select the instrumentation mode
|
|
|
|
- `AFL_LLVM_INSTRUMENT` - this configures the instrumentation mode.
|
|
Available options:
|
|
PCGUARD - our own pcgard based instrumentation (default)
|
|
NATIVE - clang's original pcguard based instrumentation
|
|
CLASSIC - classic AFL (map[cur_loc ^ prev_loc >> 1]++) (default)
|
|
LTO - LTO instrumentation (see below)
|
|
CTX - context sensitive instrumentation (see below)
|
|
NGRAM-x - deeper previous location coverage (from NGRAM-2 up to NGRAM-16)
|
|
GCC - outdated gcc instrumentation
|
|
CLANG - outdated clang instrumentation
|
|
In CLASSIC you can also specify CTX and/or NGRAM, seperate the options
|
|
with a comma "," then, e.g.:
|
|
`AFL_LLVM_INSTRUMENT=CLASSIC,CTX,NGRAM-4`
|
|
Note that this is actually not a good idea to use both CTX and NGRAM :)
|
|
|
|
### LTO
|
|
|
|
This is a different kind way of instrumentation: first it compiles all
|
|
code in LTO (link time optimization) and then performs an edge inserting
|
|
instrumentation which is 100% collision free (collisions are a big issue
|
|
in afl and afl-like instrumentations). This is performed by using
|
|
afl-clang-lto/afl-clang-lto++ instead of afl-clang-fast, but is only
|
|
built if LLVM 11 or newer is used.
|
|
|
|
- `AFL_LLVM_INSTRUMENT=CFG` will use Control Flow Graph instrumentation.
|
|
(not recommended for afl-clang-fast, default for afl-clang-lto as there
|
|
it is a different and better kind of instrumentation.)
|
|
|
|
None of the following options are necessary to be used and are rather for
|
|
manual use (which only ever the author of this LTO implementation will use).
|
|
These are used if several separated instrumentations are performed which
|
|
are then later combined.
|
|
|
|
- `AFL_LLVM_DOCUMENT_IDS=file` will document to a file which edge ID was given
|
|
to which function. This helps to identify functions with variable bytes
|
|
or which functions were touched by an input.
|
|
- `AFL_LLVM_MAP_ADDR` sets the fixed map address to a different address than
|
|
the default `0x10000`. A value of 0 or empty sets the map address to be
|
|
dynamic (the original afl way, which is slower)
|
|
- `AFL_LLVM_MAP_DYNAMIC` sets the shared memory address to be dynamic
|
|
- `AFL_LLVM_LTO_STARTID` sets the starting location ID for the instrumentation.
|
|
This defaults to 1
|
|
- `AFL_LLVM_LTO_DONTWRITEID` prevents that the highest location ID written
|
|
into the instrumentation is set in a global variable
|
|
|
|
See [instrumentation/README.lto.md](../instrumentation/README.lto.md) for more information.
|
|
|
|
### NGRAM
|
|
|
|
- Setting `AFL_LLVM_NGRAM_SIZE` or `AFL_LLVM_INSTRUMENT=NGRAM-{value}`
|
|
activates ngram prev_loc coverage, good values are 2, 4 or 8
|
|
(any value between 2 and 16 is valid).
|
|
It is highly recommended to increase the `MAP_SIZE_POW2` definition in
|
|
config.h to at least 18 and maybe up to 20 for this as otherwise too
|
|
many map collisions occur.
|
|
|
|
See [instrumentation/README.ngram.md](../instrumentation/README.ngram.md)
|
|
|
|
### CTX
|
|
|
|
- Setting `AFL_LLVM_CTX` or `AFL_LLVM_INSTRUMENT=CTX`
|
|
activates context sensitive branch coverage - meaning that each edge
|
|
is additionally combined with its caller.
|
|
It is highly recommended to increase the `MAP_SIZE_POW2` definition in
|
|
config.h to at least 18 and maybe up to 20 for this as otherwise too
|
|
many map collisions occur.
|
|
|
|
See [instrumentation/README.ctx.md](../instrumentation/README.ctx.md)
|
|
|
|
### LAF-INTEL
|
|
|
|
This great feature will split compares into series of single byte comparisons
|
|
to allow afl-fuzz to find otherwise rather impossible paths. It is not
|
|
restricted to Intel CPUs ;-)
|
|
|
|
- Setting `AFL_LLVM_LAF_TRANSFORM_COMPARES` will split string compare functions
|
|
|
|
- Setting `AFL_LLVM_LAF_SPLIT_SWITCHES` will split all `switch` constructs
|
|
|
|
- Setting `AFL_LLVM_LAF_SPLIT_COMPARES` will split all floating point and
|
|
64, 32 and 16 bit integer CMP instructions
|
|
|
|
- Setting `AFL_LLVM_LAF_SPLIT_FLOATS` will split floating points, needs
|
|
AFL_LLVM_LAF_SPLIT_COMPARES to be set
|
|
|
|
- Setting `AFL_LLVM_LAF_ALL` sets all of the above
|
|
|
|
See [instrumentation/README.laf-intel.md](../instrumentation/README.laf-intel.md) for more information.
|
|
|
|
### INSTRUMENT LIST (selectively instrument files and functions)
|
|
|
|
This feature allows selective instrumentation of the source
|
|
|
|
- Setting `AFL_LLVM_ALLOWLIST` or `AFL_LLVM_DENYLIST` with a filenames and/or
|
|
function will only instrument (or skip) those files that match the names
|
|
listed in the specified file.
|
|
|
|
See [instrumentation/README.instrument_list.md](../instrumentation/README.instrument_list.md) for more information.
|
|
|
|
### Thread safe instrumentation counters (in all modes)
|
|
|
|
- Setting `AFL_LLVM_THREADSAFE_INST` will inject code that implements thread
|
|
safe counters. The overhead is a little bit higher compared to the older
|
|
non-thread safe case. Note that this disables neverzero (see below).
|
|
|
|
### NOT_ZERO
|
|
|
|
- Setting `AFL_LLVM_NOT_ZERO=1` during compilation will use counters
|
|
that skip zero on overflow. This is the default for llvm >= 9,
|
|
however for llvm versions below that this will increase an unnecessary
|
|
slowdown due a performance issue that is only fixed in llvm 9+.
|
|
This feature increases path discovery by a little bit.
|
|
|
|
- Setting `AFL_LLVM_SKIP_NEVERZERO=1` will not implement the skip zero
|
|
test. If the target performs only few loops then this will give a
|
|
small performance boost.
|
|
|
|
See [instrumentation/README.neverzero.md](../instrumentation/README.neverzero.md)
|
|
|
|
### CMPLOG
|
|
|
|
- Setting `AFL_LLVM_CMPLOG=1` during compilation will tell afl-clang-fast to
|
|
produce a CmpLog binary.
|
|
|
|
See [instrumentation/README.cmplog.md](../instrumentation/README.cmplog.md)
|
|
|
|
## 3) Settings for GCC / GCC_PLUGIN modes
|
|
|
|
Then there are a few specific features that are only available in GCC and
|
|
GCC_PLUGIN mode.
|
|
|
|
- Setting `AFL_KEEP_ASSEMBLY` prevents afl-as from deleting instrumented
|
|
assembly files. Useful for troubleshooting problems or understanding how
|
|
the tool works. (GCC mode only)
|
|
To get them in a predictable place, try something like:
|
|
```
|
|
mkdir assembly_here
|
|
TMPDIR=$PWD/assembly_here AFL_KEEP_ASSEMBLY=1 make clean all
|
|
```
|
|
- Setting `AFL_GCC_INSTRUMENT_FILE` with a filename will only instrument those
|
|
files that match the names listed in this file (one filename per line).
|
|
See [instrumentation/README.instrument_list.md](../instrumentation/README.instrument_list.md) for more information.
|
|
(GCC_PLUGIN mode only)
|
|
|
|
## 4) Settings for afl-fuzz
|
|
|
|
The main fuzzer binary accepts several options that disable a couple of sanity
|
|
checks or alter some of the more exotic semantics of the tool:
|
|
|
|
- Setting `AFL_SKIP_CPUFREQ` skips the check for CPU scaling policy. This is
|
|
useful if you can't change the defaults (e.g., no root access to the
|
|
system) and are OK with some performance loss.
|
|
|
|
- `AFL_EXIT_WHEN_DONE` causes afl-fuzz to terminate when all existing paths
|
|
have been fuzzed and there were no new finds for a while. This would be
|
|
normally indicated by the cycle counter in the UI turning green. May be
|
|
convenient for some types of automated jobs.
|
|
|
|
- `AFL_EXIT_ON_TIME` Causes afl-fuzz to terminate if no new paths were
|
|
found within a specified period of time (in seconds). May be convenient
|
|
for some types of automated jobs.
|
|
|
|
- `AFL_EXIT_ON_SEED_ISSUES` will restore the vanilla afl-fuzz behaviour
|
|
which does not allow crashes or timeout seeds in the initial -i corpus.
|
|
|
|
- `AFL_MAP_SIZE` sets the size of the shared map that afl-fuzz, afl-showmap,
|
|
afl-tmin and afl-analyze create to gather instrumentation data from
|
|
the target. This must be equal or larger than the size the target was
|
|
compiled with.
|
|
|
|
- `AFL_CMPLOG_ONLY_NEW` will only perform the expensive cmplog feature for
|
|
newly found testcases and not for testcases that are loaded on startup
|
|
(`-i in`). This is an important feature to set when resuming a fuzzing
|
|
session.
|
|
|
|
- `AFL_TESTCACHE_SIZE` allows you to override the size of `#define TESTCASE_CACHE`
|
|
in config.h. Recommended values are 50-250MB - or more if your fuzzing
|
|
finds a huge amount of paths for large inputs.
|
|
|
|
- Setting `AFL_DISABLE_TRIM` tells afl-fuzz not to trim test cases. This is
|
|
usually a bad idea!
|
|
|
|
- Setting `AFL_NO_AFFINITY` disables attempts to bind to a specific CPU core
|
|
on Linux systems. This slows things down, but lets you run more instances
|
|
of afl-fuzz than would be prudent (if you really want to).
|
|
|
|
- Setting `AFL_TRY_AFFINITY` tries to attempt binding to a specific CPU core
|
|
on Linux systems, but will not terminate if that fails.
|
|
|
|
- Setting `AFL_NO_AUTODICT` will not load an LTO generated auto dictionary
|
|
that is compiled into the target.
|
|
|
|
- Setting `AFL_HANG_TMOUT` allows you to specify a different timeout for
|
|
deciding if a particular test case is a "hang". The default is 1 second
|
|
or the value of the `-t` parameter, whichever is larger. Dialing the value
|
|
down can be useful if you are very concerned about slow inputs, or if you
|
|
don't want AFL++ to spend too much time classifying that stuff and just
|
|
rapidly put all timeouts in that bin.
|
|
|
|
- Setting `AFL_FORKSRV_INIT_TMOUT` allows you to specify a different timeout
|
|
to wait for the forkserver to spin up. The default is the `-t` value times
|
|
`FORK_WAIT_MULT` from `config.h` (usually 10), so for a `-t 100`, the
|
|
default would wait for `1000` milliseconds. Setting a different time here is useful
|
|
if the target has a very slow startup time, for example when doing
|
|
full-system fuzzing or emulation, but you don't want the actual runs
|
|
to wait too long for timeouts.
|
|
|
|
- `AFL_NO_ARITH` causes AFL++ to skip most of the deterministic arithmetics.
|
|
This can be useful to speed up the fuzzing of text-based file formats.
|
|
|
|
- `AFL_NO_SNAPSHOT` will advice afl-fuzz not to use the snapshot feature
|
|
if the snapshot lkm is loaded
|
|
|
|
- `AFL_SHUFFLE_QUEUE` randomly reorders the input queue on startup. Requested
|
|
by some users for unorthodox parallelized fuzzing setups, but not
|
|
advisable otherwise.
|
|
|
|
- `AFL_TMPDIR` is used to write the `.cur_input` file to if exists, and in
|
|
the normal output directory otherwise. You would use this to point to
|
|
a ramdisk/tmpfs. This increases the speed by a small value but also
|
|
reduces the stress on SSDs.
|
|
|
|
- When developing custom instrumentation on top of afl-fuzz, you can use
|
|
`AFL_SKIP_BIN_CHECK` to inhibit the checks for non-instrumented binaries
|
|
and shell scripts; and `AFL_DUMB_FORKSRV` in conjunction with the `-n`
|
|
setting to instruct afl-fuzz to still follow the fork server protocol
|
|
without expecting any instrumentation data in return.
|
|
Note that this also turns off auto map size detection.
|
|
|
|
- When running in the `-M` or `-S` mode, setting `AFL_IMPORT_FIRST` causes the
|
|
fuzzer to import test cases from other instances before doing anything
|
|
else. This makes the "own finds" counter in the UI more accurate.
|
|
Beyond counter aesthetics, not much else should change.
|
|
|
|
- Note that `AFL_POST_LIBRARY` is deprecated, use `AFL_CUSTOM_MUTATOR_LIBRARY`
|
|
instead (see below).
|
|
|
|
- `AFL_KILL_SIGNAL`: Set the signal ID to be delivered to child processes on timeout.
|
|
Unless you implement your own targets or instrumentation, you likely don't have to set it.
|
|
By default, on timeout and on exit, `SIGKILL` (`AFL_KILL_SIGNAL=9`) will be delivered to the child.
|
|
|
|
- Setting `AFL_CUSTOM_MUTATOR_LIBRARY` to a shared library with
|
|
afl_custom_fuzz() creates additional mutations through this library.
|
|
If afl-fuzz is compiled with Python (which is autodetected during builing
|
|
afl-fuzz), setting `AFL_PYTHON_MODULE` to a Python module can also provide
|
|
additional mutations.
|
|
If `AFL_CUSTOM_MUTATOR_ONLY` is also set, all mutations will solely be
|
|
performed with the custom mutator.
|
|
This feature allows to configure custom mutators which can be very helpful,
|
|
e.g. fuzzing XML or other highly flexible structured input.
|
|
Please see [custom_mutators.md](custom_mutators.md).
|
|
|
|
- `AFL_FAST_CAL` keeps the calibration stage about 2.5x faster (albeit less
|
|
precise), which can help when starting a session against a slow target.
|
|
`AFL_CAL_FAST` works too.
|
|
|
|
- The CPU widget shown at the bottom of the screen is fairly simplistic and
|
|
may complain of high load prematurely, especially on systems with low core
|
|
counts. To avoid the alarming red color, you can set `AFL_NO_CPU_RED`.
|
|
|
|
- In QEMU mode (-Q) and Frida mode (-O), `AFL_PATH` will
|
|
be searched for afl-qemu-trace and afl-frida-trace.so.
|
|
|
|
- In QEMU mode (-Q), setting `AFL_QEMU_CUSTOM_BIN` cause afl-fuzz to skip
|
|
prepending `afl-qemu-trace` to your command line. Use this if you wish to use a
|
|
custom afl-qemu-trace or if you need to modify the afl-qemu-trace arguments.
|
|
|
|
- Setting `AFL_CYCLE_SCHEDULES` will switch to a different schedule everytime
|
|
a cycle is finished.
|
|
|
|
- Setting `AFL_EXPAND_HAVOC_NOW` will start in the extended havoc mode that
|
|
includes costly mutations. afl-fuzz automatically enables this mode when
|
|
deemed useful otherwise.
|
|
|
|
- Setting `AFL_PRELOAD` causes AFL++ to set `LD_PRELOAD` for the target binary
|
|
without disrupting the afl-fuzz process itself. This is useful, among other
|
|
things, for bootstrapping libdislocator.so.
|
|
|
|
- Setting `AFL_TARGET_ENV` causes AFL++ to set extra environment variables
|
|
for the target binary. Example: `AFL_TARGET_ENV="VAR1=1 VAR2='a b c'" afl-fuzz ... `
|
|
This exists mostly for things like `LD_LIBRARY_PATH` but it would theoretically
|
|
allow fuzzing of AFL++ itself (with 'target' AFL++ using some AFL_ vars that
|
|
would disrupt work of 'fuzzer' AFL++).
|
|
|
|
- Setting `AFL_NO_UI` inhibits the UI altogether, and just periodically prints
|
|
some basic stats. This behavior is also automatically triggered when the
|
|
output from afl-fuzz is redirected to a file or to a pipe.
|
|
|
|
- Setting `AFL_NO_COLOR` or `AFL_NO_COLOUR` will omit control sequences for
|
|
coloring console output when configured with USE_COLOR and not ALWAYS_COLORED.
|
|
|
|
- Setting `AFL_FORCE_UI` will force painting the UI on the screen even if
|
|
no valid terminal was detected (for virtual consoles)
|
|
|
|
- If you are using persistent mode (you should, see [instrumentation/README.persistent_mode.md](instrumentation/README.persistent_mode.md))
|
|
some targets keep inherent state due which a detected crash testcase does
|
|
not crash the target again when the testcase is given. To be able to still
|
|
re-trigger these crashes you can use the `AFL_PERSISTENT_RECORD` variable
|
|
with a value of how many previous fuzz cases to keep prio a crash.
|
|
if set to e.g. 10, then the 9 previous inputs are written to
|
|
out/default/crashes as RECORD:000000,cnt:000000 to RECORD:000000,cnt:000008
|
|
and RECORD:000000,cnt:000009 being the crash case.
|
|
NOTE: This option needs to be enabled in config.h first!
|
|
|
|
- If you are Jakub, you may need `AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES`.
|
|
Others need not apply, unless they also want to disable the
|
|
`/proc/sys/kernel/core_pattern` check.
|
|
|
|
- Benchmarking only: `AFL_BENCH_JUST_ONE` causes the fuzzer to exit after
|
|
processing the first queue entry; and `AFL_BENCH_UNTIL_CRASH` causes it to
|
|
exit soon after the first crash is found.
|
|
|
|
- Setting `AFL_DEBUG_CHILD` will not suppress the child output.
|
|
This lets you see all output of the child, making setup issues obvious.
|
|
For example, in an unicornafl harness, you might see python stacktraces.
|
|
You may also see other logs that way, indicating why the forkserver won't start.
|
|
Not pretty but good for debugging purposes.
|
|
Note that `AFL_DEBUG_CHILD_OUTPUT` is deprecated.
|
|
|
|
- Setting `AFL_NO_CPU_RED` will not display very high cpu usages in red color.
|
|
|
|
- Setting `AFL_AUTORESUME` will resume a fuzz run (same as providing `-i -`)
|
|
for an existing out folder, even if a different `-i` was provided.
|
|
Without this setting, afl-fuzz will refuse execution for a long-fuzzed out dir.
|
|
|
|
- Setting `AFL_MAX_DET_EXRAS` will change the threshold at what number of elements
|
|
in the `-x` dictionary and LTO autodict (combined) the probabilistic mode will
|
|
kick off. In probabilistic mode not all dictionary entires will be used all
|
|
of the times for fuzzing mutations to not slow down fuzzing.
|
|
The default count is `200` elements. So for the 200 + 1st element, there is a
|
|
1 in 201 chance, that one of the dictionary entries will not be used directly.
|
|
|
|
- Setting `AFL_NO_FORKSRV` disables the forkserver optimization, reverting to
|
|
fork + execve() call for every tested input. This is useful mostly when
|
|
working with unruly libraries that create threads or do other crazy
|
|
things when initializing (before the instrumentation has a chance to run).
|
|
|
|
Note that this setting inhibits some of the user-friendly diagnostics
|
|
normally done when starting up the forkserver and causes a pretty
|
|
significant performance drop.
|
|
|
|
- Setting `AFL_STATSD` enables StatsD metrics collection.
|
|
By default AFL++ will send these metrics over UDP to 127.0.0.1:8125.
|
|
The host and port are configurable with `AFL_STATSD_HOST` and `AFL_STATSD_PORT` respectively.
|
|
To enable tags (banner and afl_version) you should provide `AFL_STATSD_TAGS_FLAVOR` that matches
|
|
your StatsD server (see `AFL_STATSD_TAGS_FLAVOR`)
|
|
|
|
- Setting `AFL_STATSD_TAGS_FLAVOR` to one of `dogstatsd`, `librato`, `signalfx` or `influxdb`
|
|
allows you to add tags to your fuzzing instances. This is especially useful when running
|
|
multiple instances (`-M/-S` for example). Applied tags are `banner` and `afl_version`.
|
|
`banner` corresponds to the name of the fuzzer provided through `-M/-S`.
|
|
`afl_version` corresponds to the currently running afl version (e.g `++3.0c`).
|
|
Default (empty/non present) will add no tags to the metrics.
|
|
See [rpc_statsd.md](rpc_statsd.md) for more information.
|
|
|
|
- Setting `AFL_CRASH_EXITCODE` sets the exit code afl treats as crash.
|
|
For example, if `AFL_CRASH_EXITCODE='-1'` is set, each input resulting
|
|
in an `-1` return code (i.e. `exit(-1)` got called), will be treated
|
|
as if a crash had ocurred.
|
|
This may be beneficial if you look for higher-level faulty conditions in which your
|
|
target still exits gracefully.
|
|
|
|
- Outdated environment variables that are not supported anymore:
|
|
`AFL_DEFER_FORKSRV`
|
|
`AFL_PERSISTENT`
|
|
|
|
## 5) Settings for afl-qemu-trace
|
|
|
|
The QEMU wrapper used to instrument binary-only code supports several settings:
|
|
|
|
- It is possible to set `AFL_INST_RATIO` to skip the instrumentation on some
|
|
of the basic blocks, which can be useful when dealing with very complex
|
|
binaries.
|
|
|
|
- Setting `AFL_INST_LIBS` causes the translator to also instrument the code
|
|
inside any dynamically linked libraries (notably including glibc).
|
|
|
|
- Setting `AFL_COMPCOV_LEVEL` enables the CompareCoverage tracing of all cmp
|
|
and sub in x86 and x86_64 and memory comparions functions (e.g. strcmp,
|
|
memcmp, ...) when libcompcov is preloaded using `AFL_PRELOAD`.
|
|
More info at qemu_mode/libcompcov/README.md.
|
|
There are two levels at the moment, `AFL_COMPCOV_LEVEL=1` that instruments
|
|
only comparisons with immediate values / read-only memory and
|
|
`AFL_COMPCOV_LEVEL=2` that instruments all the comparions. Level 2 is more
|
|
accurate but may need a larger shared memory.
|
|
|
|
- Setting `AFL_QEMU_COMPCOV` enables the CompareCoverage tracing of all
|
|
cmp and sub in x86 and x86_64.
|
|
This is an alias of `AFL_COMPCOV_LEVEL=1` when `AFL_COMPCOV_LEVEL` is
|
|
not specified.
|
|
|
|
- The underlying QEMU binary will recognize any standard "user space
|
|
emulation" variables (e.g., `QEMU_STACK_SIZE`), but there should be no
|
|
reason to touch them.
|
|
|
|
- `AFL_DEBUG` will print the found entrypoint for the binary to stderr.
|
|
Use this if you are unsure if the entrypoint might be wrong - but
|
|
use it directly, e.g. `afl-qemu-trace ./program`
|
|
|
|
- `AFL_ENTRYPOINT` allows you to specify a specific entrypoint into the
|
|
binary (this can be very good for the performance!).
|
|
The entrypoint is specified as hex address, e.g. `0x4004110`
|
|
Note that the address must be the address of a basic block.
|
|
|
|
- When the target is i386/x86_64 you can specify the address of the function
|
|
that has to be the body of the persistent loop using
|
|
`AFL_QEMU_PERSISTENT_ADDR=start addr`.
|
|
|
|
- Another modality to execute the persistent loop is to specify also the
|
|
`AFL_QEMU_PERSISTENT_RET=end addr` env variable.
|
|
With this variable assigned, instead of patching the return address, the
|
|
specified instruction is transformed to a jump towards `start addr`.
|
|
|
|
- `AFL_QEMU_PERSISTENT_GPR=1` QEMU will save the original value of general
|
|
purpose registers and restore them in each persistent cycle.
|
|
|
|
- With `AFL_QEMU_PERSISTENT_RETADDR_OFFSET` you can specify the offset from the
|
|
stack pointer in which QEMU can find the return address when `start addr` is
|
|
hit.
|
|
|
|
- With `AFL_USE_QASAN` you can enable QEMU AddressSanitizer for dynamically
|
|
linked binaries.
|
|
|
|
- With `AFL_QEMU_FORCE_DFL` you force QEMU to ignore the registered signal
|
|
handlers of the target.
|
|
|
|
## 6) Settings for afl-cmin
|
|
|
|
The corpus minimization script offers very little customization:
|
|
|
|
- Setting `AFL_PATH` offers a way to specify the location of afl-showmap
|
|
and afl-qemu-trace (the latter only in `-Q` mode).
|
|
|
|
- `AFL_KEEP_TRACES` makes the tool keep traces and other metadata used for
|
|
minimization and normally deleted at exit. The files can be found in the
|
|
`<out_dir>/.traces/` directory.
|
|
|
|
- `AFL_ALLOW_TMP` permits this and some other scripts to run in /tmp. This is
|
|
a modest security risk on multi-user systems with rogue users, but should
|
|
be safe on dedicated fuzzing boxes.
|
|
|
|
- `AFL_PRINT_FILENAMES` prints each filename to stdout, as it gets processed.
|
|
This can help when embedding `afl-cmin` or `afl-showmap` in other scripts scripting.
|
|
|
|
## 7) Settings for afl-tmin
|
|
|
|
Virtually nothing to play with. Well, in QEMU mode (`-Q`), `AFL_PATH` will be
|
|
searched for afl-qemu-trace. In addition to this, `TMPDIR` may be used if a
|
|
temporary file can't be created in the current working directory.
|
|
|
|
You can specify `AFL_TMIN_EXACT` if you want afl-tmin to require execution paths
|
|
to match when minimizing crashes. This will make minimization less useful, but
|
|
may prevent the tool from "jumping" from one crashing condition to another in
|
|
very buggy software. You probably want to combine it with the `-e` flag.
|
|
|
|
## 8) Settings for afl-analyze
|
|
|
|
You can set `AFL_ANALYZE_HEX` to get file offsets printed as hexadecimal instead
|
|
of decimal.
|
|
|
|
## 9) Settings for libdislocator
|
|
|
|
The library honors these environmental variables:
|
|
|
|
- `AFL_LD_LIMIT_MB` caps the size of the maximum heap usage permitted by the
|
|
library, in megabytes. The default value is 1 GB. Once this is exceeded,
|
|
allocations will return NULL.
|
|
|
|
- `AFL_LD_HARD_FAIL` alters the behavior by calling `abort()` on excessive
|
|
allocations, thus causing what AFL++ would perceive as a crash. Useful for
|
|
programs that are supposed to maintain a specific memory footprint.
|
|
|
|
- `AFL_LD_VERBOSE` causes the library to output some diagnostic messages
|
|
that may be useful for pinpointing the cause of any observed issues.
|
|
|
|
- `AFL_LD_NO_CALLOC_OVER` inhibits `abort()` on `calloc()` overflows. Most
|
|
of the common allocators check for that internally and return NULL, so
|
|
it's a security risk only in more exotic setups.
|
|
|
|
- `AFL_ALIGNED_ALLOC=1` will force the alignment of the allocation size to
|
|
`max_align_t` to be compliant with the C standard.
|
|
|
|
## 10) Settings for libtokencap
|
|
|
|
This library accepts `AFL_TOKEN_FILE` to indicate the location to which the
|
|
discovered tokens should be written.
|
|
|
|
## 11) Third-party variables set by afl-fuzz & other tools
|
|
|
|
Several variables are not directly interpreted by afl-fuzz, but are set to
|
|
optimal values if not already present in the environment:
|
|
|
|
- By default, `LD_BIND_NOW` is set to speed up fuzzing by forcing the
|
|
linker to do all the work before the fork server kicks in. You can
|
|
override this by setting `LD_BIND_LAZY` beforehand, but it is almost
|
|
certainly pointless.
|
|
|
|
- By default, `ASAN_OPTIONS` are set to (among others):
|
|
```
|
|
abort_on_error=1
|
|
detect_leaks=0
|
|
malloc_context_size=0
|
|
symbolize=0
|
|
allocator_may_return_null=1
|
|
```
|
|
If you want to set your own options, be sure to include `abort_on_error=1` -
|
|
otherwise, the fuzzer will not be able to detect crashes in the tested
|
|
app. Similarly, include `symbolize=0`, since without it, AFL++ may have
|
|
difficulty telling crashes and hangs apart.
|
|
|
|
- In the same vein, by default, `MSAN_OPTIONS` are set to:
|
|
```
|
|
exit_code=86 (required for legacy reasons)
|
|
abort_on_error=1
|
|
symbolize=0
|
|
msan_track_origins=0
|
|
allocator_may_return_null=1
|
|
```
|
|
- Similarly, the default `LSAN_OPTIONS` are set to:
|
|
```
|
|
exit_code=23
|
|
fast_unwind_on_malloc=0
|
|
symbolize=0
|
|
print_suppressions=0
|
|
```
|
|
Be sure to include the first ones for LSAN and MSAN when customizing
|
|
anything, since some MSAN and LSAN versions don't call `abort()` on
|
|
error, and we need a way to detect faults.
|
|
|