<aside>
💡 A Benchmark for Stateful Protocol Fuzzing
</aside>
Set up
Step 0. Set up environmental variables
git clone <https://github.com/profuzzbench/profuzzbench.git>
cd profuzzbench
# 아래 부분은 없어도 됨. 하지만 있으면 다음 단계의 스크립트를 고대로 실행할 수 있다.
export PFBENCH=$(pwd)
export PATH=$PATH:$PFBENCH/scripts/execution:$PFBENCH/scripts/analysis
Step 1. Build a docker image
cd $PFBENCH
cd subjects/FTP/LightFTP
docker build . -t lightftp
Step 2. Run fuzzing
- Params
- 1st argument (DOCIMAGE) : name of the docker image
- 2nd argument (RUNS) : number of runs, one isolated Docker container is spawned for each run
- 3rd argument (SAVETO) : path to a folder keeping the results
- 4th argument (FUZZER) : fuzzer name (e.g., aflnet) -- this name must match the name of the fuzzer folder inside the Docker container (e.g., /home/ubuntu/aflnet)
- 5th argument (OUTDIR) : name of the output folder created inside the docker container
- 6th argument (OPTIONS) : all options needed for fuzzing in addition to the standard options written in the target-specific run.sh script
- 7th argument (TIMEOUT) : time for fuzzing in seconds
- 8th argument (SKIPCOUNT): used for calculating coverage over time. e.g., SKIPCOUNT=5 means we run gcovr after every 5 test cases because gcovr takes time and we do not want to run it after every single test case
cd $PFBENCH
mkdir results-lightftp
profuzzbench_exec_common.sh lightftp 4 results-lightftp aflnet out-lightftp-aflnet "-P FTP -D 10000 -q 3 -s 3 -E -K" 3600 5 &
profuzzbench_exec_common.sh lightftp 4 results-lightftp aflnwe out-lightftp-aflnwe "-D 10000 -K" 3600 5
정상 종료 시의 스크립트
AFLNET: Fuzzing in progress ...
AFLNET: Waiting for the following containers to stop: f2da4b72b002 b7421386b288 cebbbc741f93 5c54104ddb86
AFLNET: Collecting results and save them to results-lightftp
AFLNET: Collecting results from container f2da4b72b002
AFLNET: Collecting results from container b7421386b288
AFLNET: Collecting results from container cebbbc741f93
AFLNET: Collecting results from container 5c54104ddb86
AFLNET: I am done!
Step 3. Collect the result
- Params
- 1st argument (PROG) : name of the subject program (e.g., lightftp)
- 2nd argument (RUNS) : number of runs
- 3rd argument (FUZZER) : fuzzer name (e.g., aflnet)
- 4th argument (COVFILE): CSV-formatted output file keeping the results
- 5th argument (APPEND) : append mode; set this to 0 for the first fuzzer and 1 for the subsequent fuzzer(s).
cd $PFBENCH/results-lightftp
profuzzbench_generate_csv.sh lightftp 4 aflnet results.csv 0
profuzzbench_generate_csv.sh lightftp 4 aflnwe results.csv 1
Step 4. Analyze the results
- Params
- 1st argument (FILE) : Full path to results.csv
- 2nd argument (PUT) : Name of the subject program
- 3rd argument (RUNS) : Number of runs in the experiment
- 4th argument (CUT OFF): Cut-off time in minutes
- 5th argument (OUT FILE) : Output file path with file name
cd $PFBENCH/results-lightftp
profuzzbench_plot.py -i results.csv -p lightftp -r 4 -c 60 -s 1 -o cov_over_time.png