Fuzzing the kernel
Now, we are ready to launch our docker with TriforceAFL and ready to fuzz:
$: bunzip2 OWRT_x86.tar.bz2 && docker import OWRT_x86.tar $: docker run --rm -it -v $(pwd)/owrtKFuzz:/krn iot-fuzz/openwrt_x86 root@5930beaa2553:/TriforceLinuxSyscallFuzzer# md5sum krn/bzImage f59f429b02f6fa13a6598491032715ce krn/bzImage
As you can see, the Docker image is already equipped with our target kernel to fuzz. Now, we can launch the fuzzer, in this case, AFL 2.0, which is quite old and can be updated with some work:
$: ./runFuzz -M M0
The runFuzz
script contains some configuration and the startup of QEMU with 64 MB of memory – see the code in bold:
# run fuzzer and qemu-system $: export AFL_SKIP_CRASHES=1 $AFL/afl-fuzz $FARGS -t 500+ -i $INP -o outputs -QQ -- \ $AFL/afl-qemu-system-trace \ -L $AFL/qemu_mode/qemu/pc-bios \ -kernel $KERN/bzImage -initrd ./fuzzRoot.cpio...