README 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. Fuzzing the lwIP stack (afl-fuzz requires linux/unix or similar)
  2. This directory contains a small app that reads Ethernet frames from stdin and
  3. processes them. It is used together with the 'american fuzzy lop' tool (found
  4. at http://lcamtuf.coredump.cx/afl/) and the sample inputs to test how
  5. unexpected inputs are handled. The afl tool will read the known inputs, and
  6. try to modify them to exercise as many code paths as possible, by instrumenting
  7. the code and keeping track of which code is executed.
  8. Just running make will produce the test program.
  9. Then run afl with:
  10. afl-fuzz -i inputs/<INPUT> -o output ./lwip_fuzz
  11. and it should start working. It will probably complain about CPU scheduler,
  12. set AFL_SKIP_CPUFREQ=1 to ignore it.
  13. If it complains about invalid "/proc/sys/kernel/core_pattern" setting, try
  14. executing "sudo bash -c 'echo core > /proc/sys/kernel/core_pattern'".
  15. The input is split into different subdirectories since they test different
  16. parts of the code, and since you want to run one instance of afl-fuzz on each
  17. core.
  18. When afl finds a crash or a hang, the input that caused it will be placed in
  19. the output directory. If you have hexdump and text2pcap tools installed,
  20. running output_to_pcap.sh <outputdir> will create pcap files for each input
  21. file to simplify viewing in wireshark.
  22. The lwipopts.h file needs to have checksum checking off, otherwise almost every
  23. packet will be discarded because of that. The other options can be tuned to
  24. expose different parts of the code.