Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upPanic on malformed input #27
Comments
est31
added
the
bug
label
Jun 20, 2018
This was referenced Jun 27, 2018
This comment has been minimized.
This comment has been minimized.
|
@Shnatsel could you try to minify that example in some way? 100 kb is a bit large, I'm sure it can be triggered by a shorter example. |
This comment has been minimized.
This comment has been minimized.
Shnatsel
commented
Jul 7, 2018
•
|
minimized_testcase.ogg.gz courtesy of AFL testcase minimization mode |
This comment has been minimized.
This comment has been minimized.
|
@Shnatsel thanks! |
This comment has been minimized.
This comment has been minimized.
|
@Shnatsel that file gives me an error and not a a panic. It says |
This comment has been minimized.
This comment has been minimized.
Shnatsel
commented
Jul 18, 2018
|
You probably haven't disabled checksum verification in |
This comment has been minimized.
This comment has been minimized.
|
Then I'd get a hash mismatch error. I actually can reproduce the panic with the 100kb example. @Shnatsel this is what I did: |
This comment has been minimized.
This comment has been minimized.
Shnatsel
commented
Jul 18, 2018
•
|
Hmm, in that case something is probably off with afl instrumentation. I have noticed that it detects considerably less distinct paths that cargo-fuzz (libfuzzer) even though they should be using pretty much the same thing to instrument binaries. |
This comment has been minimized.
This comment has been minimized.
|
@Shnatsel any news with a new minimal reproducable example? |
This comment has been minimized.
This comment has been minimized.
Shnatsel
commented
Sep 3, 2018
|
I've narrowed it down to 21kb so far. I'll see if I can reduce it further. |
This comment has been minimized.
This comment has been minimized.
Shnatsel
commented
Sep 3, 2018
|
I'm afraid 14kb is as small as I can get it. lewton_#27_min_testcase.ogg.gz AFL's testcase minimization mode produces a non-crashing file for whatever reason (this is probably a bug in AFL.rs), and cargo-fuzz cannot be used because lewton allocates enormous amounts of virtual memory, which causes address sanitizer to freak out on pretty much any malformed input. |
This comment has been minimized.
This comment has been minimized.
Shnatsel
commented
Sep 3, 2018
|
Ah, turns out the enormous allocations were throwing off AFL too. After I've disabled all memory limits |
This comment has been minimized.
This comment has been minimized.
est31
closed this
in
ddd2408
Sep 7, 2018
This comment has been minimized.
This comment has been minimized.
|
The bug is fixed now, still working on a regression test. |
This comment has been minimized.
This comment has been minimized.
|
Okay, using this file now instead: 27_really_minimized_testcase_crcfix.ogg.zip |
Shnatsel commentedJun 20, 2018
I have recently discovered that previous fuzzing attempts on lewton (namely the lewton target in https://github.com/rust-fuzz/targets) were using the OGG stream API and did not disable CRC32 check in
oggcrate. This caused almost any fuzzer input to be rejected due to crc32 mismatch, rendering fuzzers useless.I have patched the ogg crate to disable crc32 check during fuzzing. After this honggfuzz-rs has immediately discovered an input that causes an out-of-bounds access in lewton. Thanks to Rust's memory safety guarantees this is not a critical security issue (like it would be in C), but it could still be used to perform a denial-of-service attack.
The panic message is
index out of bounds: the len is 128 but the index is 1023at line 1098 inaudio.rs. The file triggering the crash is attached, I had to gzip it so that github would accept the upload. You should be able to reproduce the crash by disabling crc32 in unconditionally in a local copy ofoggcrate and feeding this file to lewton.My fuzzing setup is available at https://github.com/Shnatsel/lewton-fuzz, more info on using it can be found in the rust-fuzz/targets issue. This panic is blocking any further fuzzing attempts. I will run another round of fuzzing once this panic is resolved.