• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

wget_css_fuzzer.repro/H07-May-2022-11

Makefile.amH A D05-Jun-20213.5 KiB10780

Makefile.inH A D03-May-2022101.4 KiB2,6172,477

README.mdH A D04-May-20203.1 KiB8664

fuzzer.hH A D07-Sep-20211.3 KiB4319

main.cH A D07-Sep-20212.9 KiB14191

test-runner.shH A D05-Jun-2021190 105

wget_cookie_fuzzer.cH A D07-Sep-20212.2 KiB9356

wget_cookie_fuzzer.dictH A D07-Sep-202189 76

wget_css_fuzzer.cH A D07-Sep-20212.6 KiB12283

wget_ftpls_fuzzer.cH A D07-Sep-20212.6 KiB12886

wget_ftpls_fuzzer.dictH A D07-Sep-2021134 2120

wget_html_fuzzer.cH A D07-Sep-20212.2 KiB9861

wget_html_fuzzer.dictH A D07-Sep-2021258 2322

wget_netrc_fuzzer.cH A D07-Sep-20212.6 KiB12582

wget_netrc_fuzzer.dictH A D07-Sep-202173 98

wget_ntlm_fuzzer.cH A D07-Sep-20212.3 KiB10260

wget_options_fuzzer.cH A D07-Sep-20213 KiB13493

wget_options_fuzzer.dictH A D07-Sep-20212.6 KiB196195

wget_progress_fuzzer.cH A D07-Sep-20213.7 KiB14389

wget_read_hunk_fuzzer.cH A D07-Sep-20215 KiB207140

wget_robots_fuzzer.cH A D07-Sep-20212 KiB9153

wget_url_fuzzer.cH A D07-Sep-20212.3 KiB10665

README.md

1# Fuzzers
2
3These are fuzzers designed for use with `libFuzzer` or `afl`. They can
4be used to run on Google's OSS-Fuzz (https://github.com/google/oss-fuzz/).
5
6The convention used here is that the initial values for each parser fuzzer
7are taken from the $NAME.in directory.
8
9Crash reproducers from OSS-Fuzz are put into $NAME.repro directory for
10regression testing with top dir 'make check' or 'make check-valgrind'.
11
12
13# Running a fuzzer using clang
14
15Use the following commands on top dir:
16```
17export CC=clang
18export CXX=clang++
19# address sanitizer:
20#export CFLAGS="-O1 -g -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined,integer,nullability -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp"
21export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link"
22# undefined sanitizer;
23export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=bool,array-bounds,float-divide-by-zero,function,integer-divide-by-zero,return,shift,signed-integer-overflow,vla-bound,vptr -fno-sanitize-recover=bool,array-bounds,float-divide-by-zero,function,integer-divide-by-zero,return,shift,signed-integer-overflow,vla-bound,vptr -fsanitize=fuzzer-no-link"
24export CXXFLAGS="$CFLAGS -stdlib=libc++"
25export LIB_FUZZING_ENGINE="-lFuzzer -lstdc++"
26./configure --enable-fuzzing --without-metalink --without-zlib --disable-pcre --without-libuuid --enable-assert
27make clean
28make -j$(nproc)
29cd fuzz
30
31# run wget_options_fuzzer
32UBSAN_OPTIONS=print_stacktrace=1 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \
33  ./run-clang.sh wget_options_fuzzer
34```
35
36If you see a crash, then a crash corpora is written that can be used for further
37investigation. E.g.
38```
39==2410==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000004e90 at pc 0x00000049cf9c bp 0x7fffb5543f70 sp 0x7fffb5543720
40...
41Test unit written to ./crash-adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
42```
43
44To reproduce the crash:
45```
46./wget_options_fuzzer < ./crash-adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
47```
48
49You can also copy/move that file into wget_options_fuzzer.repro/
50and re-build the project without fuzzing for a valgrind run, if you like that better.
51Just a `./configure` and a `make check-valgrind` should reproduce it.
52
53
54# Running a fuzzer using AFL
55
56Use the following commands on top dir:
57
58```
59$ export LIB_FUZZING_ENGINE=""
60$ CC=afl-clang-fast ./configure --enable-fuzzing
61$ make -j$(nproc) clean all
62$ cd fuzz
63$ ./run-afl.sh wget_options_fuzzer
64```
65
66# Fuzz code coverage using the corpus directories *.in/
67
68Code coverage reports currently work best with gcc+lcov+genhtml.
69
70In the top directory:
71```
72CC=gcc CFLAGS="-O0 -g" ./configure
73make fuzz-coverage
74xdg-open lcov/index.html
75```
76
77To work on corpora for better coverage, `cd fuzz` and use e.g.
78`./view-coverage.sh wget_options_fuzzer`.
79
80
81# Creating wget_options_fuzzer.dict
82
83```
84for i in `../src/wget --help|tr ' ' '\n'|grep ^--|cut -c 3-|sort`;do echo \"$i\"; done >wget_options_fuzzer.dict
85```
86