antonio-morales / Fuzzing101

An step by step fuzzing tutorial. A GitHub Security Lab initiative
https://securitylab.github.com/
Apache License 2.0
2.46k stars 323 forks source link

Exercise 1: Fork server crashed with signal 6 #36

Closed r00tb33 closed 1 year ago

r00tb33 commented 1 year ago

Hi All,

I am trying to run the first exercise and stuck at the following error... can anyone throw some light as to what went wrong here?

$ AFL_DEBUG=1 afl-fuzz -i $HOME/fuzzing/fuzzing_xpdf/pdf_examples/ -o $HOME/fuzzing/fuzzing_xpdf/out/ -s 123 -- $HOME/fuzzing/fuzzing_xpdf/install/bin/pdftotext @@ $HOME/fuzzing/fuzzing_xpdf/output
[+] Enabled environment variable AFL_DEBUG with value 10
[+] Enabled environment variable AFL_DEBUG with value 10
afl-fuzz++4.08a based on afl by Michal Zalewski and a large online community
[+] AFL++ is maintained by Marc "van Hauser" Heuse, Dominik Maier, Andrea Fioraldi and Heiko "hexcoder" Eißfeldt
[+] AFL++ is open source, get it at https://github.com/AFLplusplus/AFLplusplus
[+] NOTE: AFL++ >= v3 has changed defaults and behaviours - see README.md
[+] Running with fixed seed: 123
[+] No -M/-S set, autoconfiguring for "-S default"
[*] Getting to work...
[+] Using exponential power schedule (FAST)
[+] Enabled testcache with 50 MB
[+] Generating fuzz data with a length of min=1 max=1048576
[*] Checking core_pattern...
[!] WARNING: Could not check CPU scaling governor
[+] You have 6 CPU cores and 2 runnable tasks (utilization: 33%).
[+] Try parallel jobs - see /usr/local/share/doc/afl/fuzzing_in_depth.md#c-using-multiple-cores
[*] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[*] Deleting old session data...
[+] Output dir cleanup successful.
[*] Checking CPU core loadout...
[+] Found a free CPU core, try binding to #0.
[*] Scanning '/home/amit/fuzzing/fuzzing_xpdf/pdf_examples/'...
[+] Loaded a total of 3 seeds.
[*] Creating hard links for all input files...
[*] Validating target binary...
[*] Spinning up the fork server...
**==116305==ERROR: UndefinedBehaviorSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)**
==116305==Process memory map follows:
    0x000000400000-0x000000407000   /home/amit/fuzzing/fuzzing_xpdf/install/bin/pdftotext
    0x000000407000-0x000000504000   /home/amit/fuzzing/fuzzing_xpdf/install/bin/pdftotext
    0x000000504000-0x000000542000   /home/amit/fuzzing/fuzzing_xpdf/install/bin/pdftotext
    0x000000542000-0x00000054c000   /home/amit/fuzzing/fuzzing_xpdf/install/bin/pdftotext
    0x00000054c000-0x000000589000   /home/amit/fuzzing/fuzzing_xpdf/install/bin/pdftotext
    0x000000589000-0x00000109a000   
    0x00000269e000-0x0000026bf000   [heap]
    0x7f6bb43a8000-0x7f6bb43ad000   
    0x7f6bb43ad000-0x7f6bb43d5000   /usr/lib/x86_64-linux-gnu/libc.so.6
    0x7f6bb43d5000-0x7f6bb456a000   /usr/lib/x86_64-linux-gnu/libc.so.6
    0x7f6bb456a000-0x7f6bb45c2000   /usr/lib/x86_64-linux-gnu/libc.so.6
    0x7f6bb45c2000-0x7f6bb45c6000   /usr/lib/x86_64-linux-gnu/libc.so.6
    0x7f6bb45c6000-0x7f6bb45c8000   /usr/lib/x86_64-linux-gnu/libc.so.6
    0x7f6bb45c8000-0x7f6bb45d5000   
    0x7f6bb45d5000-0x7f6bb45d8000   /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
    0x7f6bb45d8000-0x7f6bb45ef000   /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
    0x7f6bb45ef000-0x7f6bb45f3000   /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
    0x7f6bb45f3000-0x7f6bb45f4000   /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
    0x7f6bb45f4000-0x7f6bb45f5000   /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
    0x7f6bb45f5000-0x7f6bb468f000   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30
    0x7f6bb468f000-0x7f6bb479f000   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30
    0x7f6bb479f000-0x7f6bb480e000   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30
    0x7f6bb480e000-0x7f6bb4819000   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30
    0x7f6bb4819000-0x7f6bb481c000   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30
    0x7f6bb481c000-0x7f6bb481f000   
    0x7f6bb481f000-0x7f6bb482d000   /usr/lib/x86_64-linux-gnu/libm.so.6
    0x7f6bb482d000-0x7f6bb48a9000   /usr/lib/x86_64-linux-gnu/libm.so.6
    0x7f6bb48a9000-0x7f6bb4904000   /usr/lib/x86_64-linux-gnu/libm.so.6
    0x7f6bb4904000-0x7f6bb4905000   /usr/lib/x86_64-linux-gnu/libm.so.6
    0x7f6bb4905000-0x7f6bb4906000   /usr/lib/x86_64-linux-gnu/libm.so.6
    0x7f6bb4906000-0x7f6bb4911000   
    0x7f6bb4911000-0x7f6bb4913000   /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
    0x7f6bb4913000-0x7f6bb493d000   /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
    0x7f6bb493d000-0x7f6bb4948000   /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
    0x7f6bb4948000-0x7f6bb4949000   
    0x7f6bb4949000-0x7f6bb494b000   /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
    0x7f6bb494b000-0x7f6bb494d000   /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
    0x7ffcbae77000-0x7ffcbae98000   [stack]
    0x7ffcbaee2000-0x7ffcbaee6000   [vvar]
    0x7ffcbaee6000-0x7ffcbaee8000   [vdso]
    0xffffffffff600000-0xffffffffff601000   [vsyscall]
==116305==End of process memory map.
**==116305==Sanitizer CHECK failed: /build/llvm-toolchain-11-mnvtwk/llvm-toolchain-11-11.1.0/compiler-rt/lib/sanitizer_common/sanitizer_common.cpp:54 ((0 && "unable to mmap")) != (0) (0, 0)**

[-] Whoops, the target binary crashed suddenly, before receiving any input
    from the fuzzer! You can try the following:

    - The target binary crashes because necessary runtime conditions it needs
      are not met. Try to:
      1. Run again with AFL_DEBUG=1 set and check the output of the target
         binary for clues.
      2. Run again with AFL_DEBUG=1 and 'ulimit -c unlimited' and analyze the
         generated core dump.

    - Possibly the target requires a huge coverage map and has CTORS.
      Retry with setting AFL_MAP_SIZE=10000000.

    - Less likely, there is a horrible bug in the fuzzer. If other options
      fail, poke the Awesome Fuzzing Discord for troubleshooting tips.

**[-] PROGRAM ABORT : Fork server crashed with signal 6
         Location : afl_fsrv_start(), src/afl-forkserver.c:1281**

Thanks.

kiwids0220 commented 1 year ago

same issue with UndefinedBehaviorSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)** when trying to re-compile the Xpdf as the doc suggested. Please let me know if you find a fix to it! Thanks in advance!!

kiwids0220 commented 1 year ago

A quick fix would be to download and recompile an older version of AFL++, AFLplusplus-3.11c worked for me