Fuzzing Nginx – Hunting vulnerabilities with afl-fuzz
lolware.net
lolware.net
I think you meant exits instead of exists.
Nice write up btw.
My experience was pretty fun. The setup wasn't that difficult if you RTFM. I rebuilt OpenSSL from source the way AFL wanted and started throwing test cases at asn1parse. The test cases it was coming up with were really cool. Got one or two hits in my hour or two running it but they ended up being false positives.
For a side project, there is really just a ton of work that has gone into it. lcamtuf is doing a great job.
Given that this specific form of fuzzing - basically non-directed randomization of inputs (it is pattern based to an extent, but...) performance matters. You want to cover a good portion of a huge surface. Performance tweaks add up in this case.
How many bugs will mucking with intercepting syscalls introduce? More importantly, how many bugs will be obscured since the tool is running Nginx in a decidedly non-standard and complex way?
Good questions - but in the overall workflow, these can be easily found by first running the fuzzing and getting a list of problematic inputs, and second, trying those inputs in a directed way against the unmodified version of nginx provides a nice filter.
As for the obscuring of other bugs - sure, this is always a problem with any form of testing. The goal with this or any tool isn't to find all bugs, its to help find a class of bugs. Other forms of testing will find other bugs. This is why unit tests are valuable, but don't obviate the need for integration and functional testing for example.
What you may want is to use something like `quickcheck` (scalacheck or clojure's test.check I guess?) to send lots of "arbitrary" xml at your code and see what breaks. With sufficiently interesting definitions of "arbitrary" you can probably find bugs.
That approach would be testing inside the process, as opposed to passing in whole http requests. But if you know a section of code is more vulnerable than others, focus on it. No need to test all of tomcat's http parsing when you really care about your specific library.
Rust is designed to be memory safe by default, but fuzzing is still useful for testing unsafe code, and for finding assertion failures.
Otherwise, nice writeup -- I'm trying to fuzz Lwan right now using preeny.