-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Milestone
Description
"zip bombs" are a somewhat know threat, but it also applies to images and can't be protected against by checking the filesystem size of the data:
- http://www.aerasec.de/security/advisories/decompression-bomb-vulnerability.html provides 2 PNG bomb demos, a 4KB 6000x6000 images decompressing to 100MB in memory and a 44KB 19000x19000 image decompressing to 1GB
- JPEG is somewhat less efficient, but e.g. NASA Visible Earth's Blue Marble has 21600x21600 tiles as small as 5MB (tile A2, southern pacific) decompressing to 1.4GB
This means it's possible to DOS e.g. a web application performing image resizing by sending one of these bombs. As far as I can tell the protection possibilities are limited:
- assert source image sizes before doing any operation which will need the image data, the documentation may benefit from a warning on that subject (similar to warnings about XML vulnerabilities in the Python documentation),
Image.opencould be augmented with e.g. amaximum_pixelsparameter raising an error in caseimage.h * image.wgoes above the specified limit to make this easier for users - during image loading/decompression, raise an error if the decompressed data size gets above a specific threshold
janoelze