PT-2012-16: Buffer Overflow in Pillow library

Vulnerable software

Pillow library
Version: 1.7.8 and earlier

Link:
https://github.com/python-imaging/Pillow

Severity level

Severity level: Medium
Impact: Buffer Overflow
Access Vector: Remote

CVSS v2:
Base Score: 4.3
Vector: (AV:N/AC:M/Au:N/C:N/I:N/A:P)

CVE: not assigned

Software description

Pillow is an open source Python library that is developed to handle images.

Vulnerability description

The specialists of the Positive Research center have detected a Buffer Overflow vulnerability in Pillow library.

Vulnerablity in  libImaging/Storage.c file

Vulnerable code:

im->mode is an array of 5 bytes. If an attacker manages to load an image with YCbCr color space, it cause off-by-one error because of terminated NULL-byte.

Example of a vulnerable code:

How to fix

Update your software up to the latest version

Advisory status

25.06.2012 - Vendor gets vulnerability details
18.07.2012 - Vulnerability details were sent to CERT
15.03.2013 - Vendor releases fixed version and details 
10.10.2013 - Public disclosure

Credits

The vulnerability was detected by Pavel Toporkov, Positive Research Center (Positive Technologies Company)

References

http://en.securitylab.ru/lab/PT-2012-16

Reports on the vulnerabilities previously discovered by Positive Research:

http://www.ptsecurity.com/research/advisory/
http://en.securitylab.ru/lab/

Threatscape
Visionary WAF – Constant innovation