-
Notifications
You must be signed in to change notification settings - Fork 456
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
fuzzing-created crashers #718
Comments
A first test: szukw000: gm animate relax.jp2 szukw000: animate relax.jp2 szukw000: flimage relax.jp2 A second test: diff -u relax.jp2 id:000000,sig:11,src:000008,op:flip2,pos:354.jp2 > test.dif //vim test.dif: A second test: szukw000: gm animate id:000000,sig:11,src:000008,op:flip2,pos:354.jp2 szukw000: animate id:000000,sig:11,src:000008,op:flip2,pos:354.jp2 szukw000: flimage id:000000,sig:11,src:000008,op:flip2,pos:354.jp2 GraphicsMagic and ImageMagic both use Jasper, FLIMAGE uses openjpeg-master-2015-12-27. winfried |
Here is another test: szukw000: kdu_expand -i relax.jp2 -o relax-jp2.tif Consumed 1 tile-part(s) from a total of 1 tile(s). szukw000: kdu_expand -i id:000000,sig:11,src:000008,op:flip2,pos:354.jp2 -o id:000000,sig:11,src:000008,op:flip2,pos:354-jp2.tif Both images are created by 'Kakadu-3.2'. The 'Illegal box length' may be here: relax: read_jp2.c:900: id: read_jp2.c:900: winfried |
@setharnold I am interested in doing some of my own fuzzing on openjpeg using AFL. Can you please tell me how you set this up? Thanks. |
@boxerab the quick way to get started: ccmake to change the CC to /usr/bin/afl-gcc It's probably best to start with just one or two images, maybe created from different sources if you can, and smaller is probably going to give better results faster than large images. If you've got a computer with enough cores, then it's worth running multiple fuzzers simultaneously; add -M to the first afl-fuzz command, and -S 1 .. -S n to subsequent commands. It's helpful to run it in tmux or screen, to manage all the fuzzers. It's probably worth fiddling with different sanitizers too -- ASAN is insanely useful, but is best done on 32-bit versions. UBSAN looks like it's probably also useful, but I haven't tried fuzzing with that yet. ( -fsanitize=address or -fsanitize=undefined -fno-sanitize-recover ) There's a nice writeup by the Fuzzing Project at https://fuzzing-project.org/tutorial3.html that may be more useful than my ramblings. Thanks |
Awesome, thanks Seth! I am going to try to automate through the entire set of j2k files in the OpenJPEG test suite. |
On Apr 11, 2016 17:56, "Aaron Boxer" [email protected] wrote:
It's slightly paradoxical but you'll probably see better results with fewer Have fun! |
I've set up a UBSAN build on a nightly basis for master branch, which run the entire test suite with UBSAN, exiting at first error ( -fno-sanitize-recover ). First results here : http://my.cdash.org/viewTest.php?onlyfailed&buildid=946315
|
Julien, can you tell me how you set up the UBSAN build? I tried doing this, with latest gcc or clang, I tried this on Ubuntu, with latest gcc and clang. Thanks, |
I'm using gcc-5 (from ubuntu precise, using the toolchain ppa). |
Thanks. Strange, I will have to try again.By the way, the results link you posted above was blank - no errors were listed. |
Actually, I can see the results now, Thanks. |
With an up-to-date cmake, UBScan results can be parsed by ctest_memcheck and posted to the Dashboard : The presentation is far from optimal, but certainly better than looking into every test output. |
Awesome - what is the command line for this ? I am running ctest manually on my Ubuntu VM, |
ahhhh, I see - ctest_memcheck goes in the cmake file. |
@boxerab you should learn about ctest script. Then :
This will build from scratch and push results to the dashboard |
Hum. I would have assumed you needed to replicate the CFLAGS onto the LDFLAGS. Eg:
|
@julienmalik yes, need to RTFM on ctest. @malaterre why would linker need to know about UBSAN setting ? |
@julienmalik thanks for running these tests. I don't think it is as bad as it looks : most of the errors are seemingly related to the three issues you mention. Left shift of negative number is indeed UB for C language. Solution is to multiply instead - I think I may have introduced this bug :) In this case, we are multiplying by a constant, so I don't think performance would suffer. For the shift exponent too large error, solution is to use 64 bit types for these few lines. So, all in all, not too hard to fix this. My feeling is these fixes should be in upcoming release. |
@boxerab technically one would need to do |
@malaterre thanks for this tip : turns out I do need |
@boxerab You can also use:
|
Cool. Could be used in production. |
On Apr 26, 2016 05:30, "Aaron Boxer" [email protected] wrote:
I know it's tempting but please don't turn on the sanitizers in production They are great aids for testing but not hardening tools, at least not yet. Thanks |
@julienmalik |
@mayeut yes I'm hacking the DynamicAnalysis.xml file before ctest_submit. |
@julienmalik, thanks, this cleans up the report for sure. I think you have one regex missing though: It wouldn't help much on your build for some reason (only one address reported) but certainly helps mine. I think all the trivial reports from UBSan are now gone. Remain the tricky ones... |
I will see about merging in #544 to get rid of these warnings then. |
I update lcmd to mm2/Little-CMS@0e8234e but this introduced |
@mayeut I see you upgraded LCMS to 2.8 beta version. With upcoming opj release, don't you think it is better to use latest LCMS release: 2.7 ? |
Ahh, never mind, I see this beta fixes some alignment issues |
@setharnold Does this issue still need to stay opened or is it an obsolete version of #811 ? |
@detonin, good question, I haven't re-tested these files with a new build of openjpeg. Thanks. |
With latest master, "for i in ../openjpeg-crashers/*; do echo $i; bin/opj_decompress -quiet -i $i -o out.bmp; done >log.txt 2>&1" on a -fsanitize=address,undefined now works cleanly |
Hello; I reviewed OpenJPEG recently for the Ubuntu Linux distribution. As part of this effort I ran our currently packaged 1.5.2 version through the AFL fuzzer for roughly a day and found several issues. I verified that these specific crashing files do not crash the 2.1.0 upstream release, but four hours of fuzzing time found a crashing file on 2.1.0.
I've uploaded the tarball of files that caused crashes to Launchpad:
https://bugs.launchpad.net/ubuntu/+source/openjpeg/+bug/711061/+attachment/4586223/+files/openjpeg-crashers.tar.gz
If that URL doesn't work, the bug is at:
https://bugs.launchpad.net/ubuntu/+source/openjpeg/+bug/711061
Please consider adding these files to your test suite.
When you've had an opportunity to diagnose and prepare fixes, it would be hugely beneficial to downstream consumers if you could also request CVEs on the oss-security mail list:
http://oss-security.openwall.org/wiki/mailing-lists/oss-security
I would be happy to help request CVEs when you're ready.
Thanks
The text was updated successfully, but these errors were encountered: