libjpeg-turbo: DoS via progressive image decoding
Categories
(Core :: Graphics: ImageLib, defect, P3)
Tracking
()
People
(Reporter: jaas, Unassigned)
References
Details
(Keywords: csectype-dos, sec-low, Whiteboard: [gfx-noted])
Attachments
(2 files)
Updated•9 years ago
|
Updated•9 years ago
|
Updated•8 years ago
|
Updated•7 years ago
|
Comment 9•5 years ago
|
||
Note that this issue is - AFAICT - unaddressed in the standard (or libjpegturbo, based on the lack of consensus about how to proceed.) https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf was authored to draw attention to this issue.
Updated•5 years ago
|
Comment 10•2 years ago
|
||
In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.
Comment 11•2 years ago
|
||
This isn't really a bug per se. What's happening is that a compression feature of the progressive JPEG format-- the ability to represent large runs of zeroes using a very small amount of data-- is being exploited to generate a relatively small JPEG file that contains an unreasonable number of scans (tens or hundreds of thousands), so the amount of time the file takes to decompress is unreasonable relative to its size. djpeg in libjpeg-turbo 2.1.x has a -maxscans argument that demonstrates how to limit the number of progressive scans to a reasonable number, thus working around this issue. Per my comments above, I believe that that is the most appropriate way for browsers to work around it. (You should also consider making libjpeg API warnings fatal, because that decreases the attack surface for this and other issues. djpeg in libjpeg-turbo 2.1.x demonstrates how to do that as well.) Per above, it is possible to create a perfectly valid progressive JPEG image that exhibits this issue, due to the fact that the JPEG format places no limit on the number of scans. Thus, it is incumbent upon applications to work around it by refusing to decompress images beyond a certain reasonable number of scans. Even a limit of 1000 scans effectively works around the issue, and I dare you to find a legitimate JPEG image with that many scans. (Note that the TJFLAG_LIMITSCANS flag in the TurboJPEG API, which is used by libjpeg-turbo's OSS_Fuzz targets, implements a scan limit of 500.)
Updated•2 years ago
|
Comment 12•2 years ago
|
||
Filed bug 1823614 to give us a finite limit on the number of scans. Not sure if there are more/separate problems here from that.
Description
•