CVE-2015-8895: Integer Overflow

Published Oct 7, 2015
·
Updated

A vulnerability of integer overflow and subsequent buffer overflow was found in coders/icon.c. Memory is allocated based on the sum of a user-supplied value and a fixed value. That sum can overflow, causing only a small amount of memory to be allocated, while the program assumes more was allocated.

Vulnerable code:

iconfile.directory[i].offset=ReadBlobLSBLong(image);

On this line, it reads in 4byte value from the image and stores it in iconfile.directory[i].size.

length=iconfile.directory[i].size; png=(unsigned char ) AcquireQuantumMemory(length+16,sizeof(png));

Here the value of length is set to the value stored in iconfile.directory[i].size. At following line, 16 is added to length and allocates that amount of png structures. However, if length+16 overflows (for example, length == 2^32 - 15), it will only allocate memory for a single png. This is a problem, because the following lines assume that at least 16 bytes was allocated:

(void) CopyMagickMemory(png,"\211PNG\r\n\032\n\000\000\000\015",12); png[12]=(unsigned char) iconinfo.planes; png[13]=(unsigned char) (iconinfo.planes >> 8); png[14]=(unsigned char) iconinfo.bitsperpixel; png[15]=(unsigned char) (iconinfo.bitsperpixel >> 8);

And then the following line has a call to ReadBlob, and since length-16 will underflow (and the length is treated as a sizet), it will effectively execute a strcpy with the remaining data in the image file.

count=ReadBlob(image,length-16,png+16);

Detailed stacktrace with reproducer can be found here:

https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1459747

Upstream patch (only the "coders/icon.c" subsection of the commit is relevant):

https://github.com/ImageMagick/ImageMagick/commit/0f6fc2d5bf8f500820c3dbcf0d23ee14f2d9f734

CVE request:

http://seclists.org/oss-sec/2015/q4/45

Other sources

Integer overflow in coders/icon.c in ImageMagick 6.9.1-3 and later allows remote attackers to cause a denial of service (application crash) via a crafted length value, which triggers a buffer overflow.

MITRE

Affected Software

74 affected components
ImageMagick=6.9.1-3
ImageMagick=6.9.1-4
ImageMagick=6.9.1-5
ImageMagick=6.9.1-6
ImageMagick=6.9.1-7
ImageMagick=6.9.1-8
ImageMagick=6.9.1-9
ImageMagick=6.9.2-0
ImageMagick=6.9.2-1
ImageMagick=6.9.2-2
ImageMagick=6.9.2-3
ImageMagick=6.9.2-4
ImageMagick=6.9.2-5
ImageMagick=6.9.2-6
ImageMagick=6.9.2-7
ImageMagick=6.9.2-8
ImageMagick=6.9.2-9
ImageMagick=6.9.2-10
ImageMagick=6.9.3-0
ImageMagick=6.9.3-1
ImageMagick=6.9.3-2
ImageMagick=6.9.3-3
ImageMagick=6.9.3-4
ImageMagick=6.9.3-5
ImageMagick=6.9.3-6
ImageMagick=6.9.3-7
ImageMagick=6.9.3-8
ImageMagick=6.9.3-9
ImageMagick=6.9.3-10
ImageMagick=7.0.1-0
ImageMagick=7.0.1-1
ImageMagick=7.0.1-2
ImageMagick=7.0.1-3
ImageMagick=7.0.1-4
ImageMagick=7.0.1-5
ImageMagick=7.0.1-6
ImageMagick=7.0.1-7
ImageMagick=7.0.1-8
ImageMagick=7.0.1-9
ImageMagick=7.0.1-10
ImageMagick=7.0.2-0
ImageMagick=7.0.2-1
ImageMagick=7.0.2-2
ImageMagick=7.0.2-3
ImageMagick=7.0.2-4
ImageMagick=7.0.2-5
ImageMagick=7.0.2-6
ImageMagick=7.0.2-7
ImageMagick=7.0.2-8
ImageMagick=7.0.2-9
ImageMagick=7.0.2-10
ImageMagick=7.0.3-0
ImageMagick=7.0.3-1
ImageMagick=7.0.3-2
ImageMagick=7.0.3-3
ImageMagick=7.0.3-4
ImageMagick=7.0.3-5
ImageMagick=7.0.3-6
ImageMagick=7.0.3-7
ImageMagick=7.0.3-8
ImageMagick=7.0.3-9
ImageMagick=7.0.3-10
ImageMagick=7.0.4-0
ImageMagick=7.0.4-1
ImageMagick=7.0.4-2
ImageMagick=7.0.4-3
ImageMagick=7.0.4-4
ImageMagick=7.0.4-5
ImageMagick=7.0.4-6
ImageMagick=7.0.4-7
ImageMagick=7.0.4-8
ImageMagick=7.0.4-9
ImageMagick=7.0.4-10
ImageMagick=7.0.5-0

Event History

Oct 7, 2015
Data Sourced
via Red Hat·02:29 PM
DescriptionSeverityAffected Software
Mar 15, 2017
CVE Published
via MITRE·07:00 PM
Data Sourced
via MITRE·07:00 PM
Description

Frequently Asked Questions

1

What is the severity of CVE-2015-8895?

CVE-2015-8895 has a high severity rating due to its potential to cause a denial of service through a buffer overflow.

2

How do I fix CVE-2015-8895?

To fix CVE-2015-8895, you should update to a patched version of ImageMagick beyond 6.9.1-9.

3

What types of systems are affected by CVE-2015-8895?

CVE-2015-8895 affects multiple versions of ImageMagick including versions from 6.9.1-3 to 7.0.5-0.

4

What is the impact of CVE-2015-8895 on applications?

The impact of CVE-2015-8895 can lead to application crashes and potential service interruptions.

5

Can CVE-2015-8895 be exploited remotely?

Yes, CVE-2015-8895 can be exploited remotely by sending specially crafted input to the ImageMagick application.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203