$ python butler.py Traceback (most recent call last): File "butler.py", line 33, in <module> guard.check() File "src/local/butler/guard.py", line 41, in check check_virtualenv() File "src/local/butler/guard.py", line 30, in check_virtualenv 'You are not in a virtual env environment. Please install it with' Exception: You are not in a virtual env environment. Please install it with `./local/install_deps.bash` or load it with `pipenv shell`. Then, you can re-run this command.
Butler is here to help you with command-line tasks.
positional arguments: {bootstrap,py_unittest,js_unittest,format,lint,package,deploy,run_server,run,run_bot,remote,clean_indexes,create_config,integration_tests,reproduce} bootstrap Install all required dependencies for running an appengine, a bot,and a mapreduce locally. py_unittest Run Python unit tests. js_unittest Run Javascript unit tests. format Format changed code in current branch. lint Lint changed code in current branch. package Package clusterfuzz with a staging revision deploy Deploy to Appengine run_server Run the local Clusterfuzz server. run Run a one-off script against a datastore (e.g. migration). run_bot Run a local clusterfuzz bot. remote Run command-line tasks on a remote bot. clean_indexes Clean up undefined indexes (in index.yaml). create_config Create a new deployment config. integration_tests Run end-to-end integration tests. reproduce Reproduce a crash or error from a test case.
optional arguments: -h, --help show this help message and exit
$ python butler.py run_bot `pwd`/my-fuzzing-bot Created symlink: source: /root/clusterfuzz/configs/test, target /root/clusterfuzz/src/appengine/config. Bot directory already exists. Re-using... | /root/clusterfuzz/my-fuzzing-bot/clusterfuzz/src/python/crash_analysis/stack_parsing/stack_analyzer.py:84: FutureWarning: Possible nested set at position 4 | r'\s*[[][^]]*[:]([^](]*).*[]].*Check failed[:]\s*(.*)') | /root/clusterfuzz/my-fuzzing-bot/clusterfuzz/src/python/crash_analysis/stack_parsing/stack_analyzer.py:202: FutureWarning: Possible nested set at position 3 | r'.*[[][^]]*[:]([^](]*).*[]].*Security CHECK failed[:]\s*(.*)\.\s*') | /root/clusterfuzz/my-fuzzing-bot/clusterfuzz/src/python/crash_analysis/stack_parsing/stack_analyzer.py:204: FutureWarning: Possible nested set at position 3 | r'.*[[][^]]*[:]([^](]*).*[]].*Security DCHECK failed[:]\s*(.*)\.\s*')
在网页上也可以看bot的状态
可以看到bot应该是将clusterfuzz复制了一份
查看bot的log
1 2
cd /path/to/my-bot/clusterfuzz/bot/logs tail -f bot.log
可以看到先由于没有fuzzing任务所以显示Failed to get any fuzzing tasks
1 2 3 4 5 6 7 8 9 10 11
$ tail bot.log 2020-05-19 11:16:49,456 - run_bot - INFO - Using local source, skipping source code update. 2020-05-19 11:16:49,457 - run_bot - INFO - Running platform initialization scripts. 2020-05-19 11:16:49,993 - run_bot - INFO - Completed running platform initialization scripts. 2020-05-19 11:16:50,374 - run_bot - ERROR - Failed to get any fuzzing tasks. This should not happen. NoneType: None 2020-05-19 11:21:50,478 - run_bot - INFO - Using local source, skipping source code update. 2020-05-19 11:21:50,478 - run_bot - INFO - Running platform initialization scripts. 2020-05-19 11:21:51,009 - run_bot - INFO - Completed running platform initialization scripts. 2020-05-19 11:21:51,194 - run_bot - ERROR - Failed to get any fuzzing tasks. This should not happen. NoneType: None
# Download and unpack a vulnerable version of OpenSSL: curl -O https://ftp.openssl.org/source/old/1.0.1/openssl-1.0.1f.tar.gz tar xf openssl-1.0.1f.tar.gz
# Build OpenSSL with ASan and fuzzer instrumentation: cd openssl-1.0.1f/ ./config
# $CC must be pointing to clang binary, see the "compiler section" link above. make CC="$CC -g -fsanitize=address,fuzzer-no-link" cd ..
# Download the fuzz target and its data dependencies: curl -O https://raw.githubusercontent.com/google/clusterfuzz/master/docs/setting-up-fuzzing/heartbleed/handshake-fuzzer.cc curl -O https://raw.githubusercontent.com/google/clusterfuzz/master/docs/setting-up-fuzzing/heartbleed/server.key curl -O https://raw.githubusercontent.com/google/clusterfuzz/master/docs/setting-up-fuzzing/heartbleed/server.pem
zip openssl-fuzzer-build.zip handshake-fuzzer server.key server.pem
之后回到平台(9000端口那个),来到Jobs,看到ADD NEW JOB表单
依次填写:
1 2 3 4
“libfuzzer_asan_linux_openssl” for the “Name”. “LINUX” for the “Platform”. “libfuzzer” and “engine_asan” for the “Templates”. CORPUS_PRUNE = True for the “Environment String”.
$ tail ./my-bot2/clusterfuzz/bot/logs/bot.log 2020-05-26 11:16:22,389 - run_bot - INFO - Completed running platform initialization scripts. 2020-05-26 11:16:23,509 - run_bot - INFO - Executing command 'fuzz libFuzzer libfuzzer_asan_linux_openssl' 2020-05-26 11:16:28,551 - run_bot - INFO - Setting up fuzzer and data bundles. 2020-05-26 11:16:29,779 - run_bot - INFO - Retrieving custom binary build r1. 2020-05-26 11:17:47,563 - run_bot - INFO - Unpacked 3/3. 2020-05-26 11:17:47,578 - run_bot - INFO - Picked fuzz target handshake-fuzzer for fuzzing. 2020-05-26 11:17:47,579 - run_bot - INFO - Retrieved custom binary build r1. 2020-05-26 11:17:47,579 - run_bot - INFO - Setup application path. 2020-05-26 11:17:48,461 - run_bot - INFO - Checking for bad build. 2020-05-26 11:17:49,769 - run_bot - INFO - Recorded use of fuzz target libFuzzer_handshake-fuzzer.
但是报错了,ERROR - libFuzzer: engine encountered an error (target=handshake-fuzzer).
1 2 3 4 5 6 7 8 9 10 11
$ tail bot.log 2020-05-26 11:36:19,370 - run_bot - INFO - Strategy pool was generated according to default parameters. Chosen strategies: value_profile, corpus_mutations_ml_rnn, corpus_subset 2020-05-26 11:36:19,583 - run_bot - INFO - Corpus is empty. Skip generation. 2020-05-26 11:36:19,822 - run_bot - ERROR - libFuzzer: engine encountered an error (target=handshake-fuzzer). NoneType: None 2020-05-26 11:36:19,824 - run_bot - INFO - Skipped corpus merge since no new units added by fuzzing. 2020-05-26 11:36:19,824 - run_bot - INFO - Extracting and analyzing recommended dictionary for handshake-fuzzer. 2020-05-26 11:36:19,825 - run_bot - INFO - No recommended dictionary in output from handshake-fuzzer. 2020-05-26 11:36:19,825 - run_bot - INFO - Used strategies. 2020-05-26 11:36:20,287 - run_bot - INFO - Uploaded file to logs bucket. 2020-05-26 11:36:20,288 - run_bot - INFO - Uploaded file to logs bucket.
后来又分配给第一个bot了
一直没结果,我就换了一个简单的程序,命名项目为libfuzzer_asan_my_project
1 2 3 4 5 6
#include <stdint.h> #include <stdio.h> extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { uint8_t tmp = Data[10]; return 0; // Non-zero return values are reserved for future use. }