afl入門學習
Ox9A82發表於2016-09-16
一個簡單的示例
安裝afl
- wget http://lcamtuf.coredump.cx/afl.tgz
- tar xfz afl.tgz
- cd afl-xxx
- sudo make install
用afl編譯程式,以便插樁
- ./afl-gcc tst.c -o tst
進行測試
- ./afl-fuzz -i testcase -o output/ ./test @@
指定一個要跑的test程式和輸出的output路徑即可。
檢視是否有插樁符號
- readelf -s ./7zDec | grep afl
引數說明
afl-fuzz 2.34b by <lcamtuf@google.com> afl-fuzz [ options ] -- /path/to/fuzzed_app [ ... ] Required parameters: -i dir - input directory with test cases -o dir - output directory for fuzzer findings Execution control settings: -f file - location read by the fuzzed program (stdin) -t msec - timeout for each run (auto-scaled, 50-1000 ms) -m megs - memory limit for child process (25 MB) -Q - use binary-only instrumentation (QEMU mode) Fuzzing behavior settings: -d - quick & dirty mode (skips deterministic steps) -n - fuzz without instrumentation (dumb mode) -x dir - optional fuzzer dictionary (see README) Other stuff: -T text - text banner -to show on the screen -M / -S id - distributed mode (see parallel_fuzzing.txt) -C - crash exploration mode (the peruvian rabbit thing) For additional tips, please consult /usr/local/share/doc/afl/README.
- -i 輸入的目錄
- -o 輸出的目錄
- -f 被fuzz的程式,透過標準輸入(stdin)讀入的資料
- -t 每一次的超時時間
- -m 給子程式分配的記憶體大小
- -Q 沒看懂啥意思。。
- -d 快速模式(跳過確認測試)
- -n 不使用插樁進行fuzz
- -x 設定fuzzer的目錄
- -T 要顯示在螢幕上的文字
- -M/-S 分散式fuzz
- -C crash探索模式
文件說明
3) Instrumenting programs for use with AFL ------------------------------------------ When source code is available, instrumentation can be injected by a companion tool that works as a drop-in replacement for gcc or clang in any standard build process for third-party code. The instrumentation has a fairly modest performance impact; in conjunction with other optimizations implemented by afl-fuzz, most programs can be fuzzed as fast or even faster than possible with traditional tools. The correct way to recompile the target program may vary depending on the specifics of the build process, but a nearly-universal approach would be: $ CC=/path/to/afl/afl-gcc ./configure $ make clean all For C++ programs, you'd would also want to set CXX=/path/to/afl/afl-g++. The clang wrappers (afl-clang and afl-clang++) can be used in the same way; clang users may also opt to leverage a higher-performance instrumentation mode, as described in llvm_mode/README.llvm. When testing libraries, you need to find or write a simple program that reads data from stdin or from a file and passes it to the tested library. In such a case, it is essential to link this executable against a static version of the instrumented library, or to make sure that the correct .so file is loaded at runtime (usually by setting LD_LIBRARY_PATH). The simplest option is a static build, usually possible via: $ CC=/path/to/afl/afl-gcc ./configure --disable-shared Setting AFL_HARDEN=1 when calling 'make' will cause the CC wrapper to automatically enable code hardening options that make it easier to detect simple memory bugs. Libdislocator, a helper library included with AFL (see libdislocator/README.dislocator) can help uncover heap corruption issues, too. PS. ASAN users are advised to review notes_for_asan.txt file for important caveats. 4) Instrumenting binary-only apps --------------------------------- When source code is *NOT* available, the fuzzer offers experimental support for fast, on-the-fly instrumentation of black-box binaries. This is accomplished with a version of QEMU running in the lesser-known "user space emulation" mode. QEMU is a project separate from AFL, but you can conveniently build the feature by doing: $ cd qemu_mode $ ./build_qemu_support.sh For additional instructions and caveats, see qemu_mode/README.qemu. The mode is approximately 2-5x slower than compile-time instrumentation, is less conductive to parallelization, and may have some other quirks.
相關文章
- AFL學習(一)對於AFL插樁的理解2020-11-08
- mybatis入門學習2020-07-05MyBatis
- Nginx入門學習2020-06-17Nginx
- Vue入門學習2021-04-27Vue
- ROS入門學習2018-11-10ROS
- nuxt 入門學習2019-01-07UX
- GORM學習入門2022-06-23GoORM
- Spark入門學習2018-01-10Spark
- React入門學習2016-02-03React
- Linux入門學習2019-05-28Linux
- MyBatisPlus入門學習2021-05-03MyBatis
- spring入門學習2020-12-12Spring
- Nacos整合學習入門2021-01-20
- Mybatis框架 入門學習2020-10-10MyBatis框架
- leaflet學習一 入門2018-05-14
- linux學習——入門2017-12-25Linux
- MyBatis入門學習(一)2015-03-13MyBatis
- Android學習 - 入門2015-12-10Android
- JavaScript入門學習學習筆記(上)2020-10-23JavaScript筆記
- Java入門學習-學習static的用法2017-05-26Java
- TS入門學習筆記2020-01-19筆記
- 【PostgreSQL】入門學習筆記2022-04-19SQL筆記
- Nacos入門學習&實踐2021-07-18
- 學習Java怎麼入門?2021-07-28Java
- Nestjs入門學習教程2021-02-09JS
- git入門學習筆記2018-11-15Git筆記
- iOS入門學習計劃2018-12-03iOS
- Egg入門學習(一)2019-01-03
- RPC學習入門(轉)2018-12-27RPC
- Docker入門學習筆記2018-07-25Docker筆記
- 整合學習入門介紹2020-12-12
- JavaScript新手入門學習系列2020-11-25JavaScript
- Unity學習筆記--入門2023-10-29Unity筆記
- Java學習路線·入門2022-04-02Java
- NLP入門-學習路徑2017-09-28
- 【mybatis學習之入門(一)】2017-06-18MyBatis
- smarty模板入門學習(share)2017-11-18
- React入門學習例項2015-03-10React