PT-2012-16: Buffer Overflow in Pillow library

MEDIUM
(4.3) (AV:N/AC:M/Au:N/C:N/I:N/A:P)

(PT-2012-16) Positive Technologies Security Advisory
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:

186     strcpy(im->mode, mode);

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:

from PIL  import Image
Image.frombuffer('YCbCr',(1,1), '1')

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/

About Positive Technologies

Positive Technologies www.ptsecurity.com is among the key players in the IT security market in Russia.

The principal activities of the company include the development of integrated tools for information security monitoring (MaxPatrol); providing IT security consulting services and technical support; development of the Securitylab leading Russian information security portal.

Among the clients of Positive Technologies, there are more than 40 state enterprises, more than 50 banks and financial organizations, 20 telecommunication companies, more than 40 plant facilities, as well as IT, service and retail companies from Russia, the CIS countries, the Baltic States, China, Ecuador, Germany, Great Britain, Holland, Iran, Israel, Japan, Mexico, the Republic of South Africa, Thailand, Turkey, and the USA.

Positive Technologies is a team of highly skilled developers, advisers and experts with years of vast hands-on experience. The company specialists possess professional titles and certificates; they are the members of various international societies and are actively involved in the IT security field development.

Vendor:
Python Software Foundation
Vulnerable product:
Pillow 1.x

Get in touch

Fill in the form and our specialists
will contact you shortly