-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial fuzzing support #422
Conversation
thanks @zlowram for taking the initiative to integrate PcapPlusPlus into OSS-Fuzz. I think it's a very important initiative that will definitely improve the security, stability and robustness of this project. Before merging the PR I have a few topics to discuss with you:
|
Replying inline:
I used the corpus from the libpcap fuzzer.
I wouldn't run it aiming to discover bugs as part of the CI. What I would include in the CI, though, is running the fuzzer with the ASAN build against samples that are known to trigger already fixed bugs to avoid regressions. E.g. when one of the reported bugs is fixed, the CI should run the fuzzer with the ASAN build of PcapPlusPlus passing that single sample as parameter (if there were multiple samples, one time for each of them).
Maybe I would just start with this simple one as it already handles parsing of any kind of packet (e.g. one of the bugs reported is DNS related). As time goes and bugs start appearing and being fixed, I would definitely add more checks to allow more coverage within the codebase.
Unfortunately I don't have the time to help you with fixing them. The OSSFuzz initiative will let you know about the bugs privately so they can be fixed prior to disclosure. The good part is that I think that thanks to oss-fuzz the project will have more visibility to atract other devs that can help. |
Good news! It has been accepted I will work on the integration there, and will try to help with the integration in the CI here. Do you want me to send the commits to this same PR? |
I have created Regression tests with the samples for #423 and #425, added them to both travis-ci and cirrus-ci on a separate task. Also, I've done a rebase from dev branch so the regression tests are green already and the commit history for the PR looks a little bit better. BTW, I've used a docker image that I created and uploaded to my docker hub repository but if you'd like to host it on yours, here's the Dockerfile:
|
Please, do not merge yet. I'm fixing some stuff to the build system to make it easier and compatible with OSS-Fuzz. |
I have slightly modified the build system to honor the This is usually a good idea to allow modifying then in the environment variables, and OSS-Fuzz requires it. |
I have added a configure flag for linux to allow linking against libpcap statically. Fuzz targets in OSSFuzz can't have any other dependencies than those installed in the base system, and I think it's also a nice feature to have. |
* Added support to build with AddressSanitizer and SanitizerCoverage * Added a first fuzzer
In particular: * CC * CXX * CFLAGS * CXXFLAGS
I've been auditing this project and, as part of the process, I wrote a fuzzer using libFuzzer for it. It works and it has already discovered some bugs that I'll be reporting to you as soon as I send this PR.
The idea behind this PR is to provide a fuzzer for this project to allow continuous fuzzing in order to improve its security. I will also apply to Google's OSS-Fuzz initiative. If the project gets accepted it will be fuzzed 24/7 in their cluster and the bugs will be automatically reported to you.
I tried to match your style for builds as much as I could, but feel free to adapt it as you wish.
Also, I would highly recommend to integrate regression tests with the samples that trigger bugs in your testing pipelines to avoid uncovering previously fixed bugs. You can do this by doing the linux build with the "--asan" option and calling the fuzzer built (located at Test/Fuzzers/Bin/fuzz_target, once built) passing as argument one of the samples at a time.
Thanks!