Public Vulnerability Reports

Multiple Vendor ImageMagick DCM and XWD Buffer Overflow Vulnerabilities



ImageMagick is used as a suite of image manipulation tools (animate, composite, conjure, convert, display, identify, import, mogrify, and montage) which are sometimes used by other applications for processing image files. For more information about ImageMagick visit the following URL.


Remote exploitation of several buffer overflow vulnerabilities in ImageMagick, as included in various vendors' operating system distributions, allows attackers to execute arbitrary code with the credentials used for image processing.

An integer overflow exists ImageMagick's handling of DCM (Digital Imaging and Communications in Medicine) format files which allows an attacker to cause a heap-based buffer overflow. This vulnerability specifically exists in the ReadDCMImage() function.

Two integer overflows exists ImageMagick's handling of XWD (X Windows Dump) format files that allows an attacker to cause a heap-based buffer overflow. The vulnerabilities specifically exist in the ReadXWDImage() function. An integer overflow could occur when calculating the amount of memory to allocate for the 'colors' or 'comment' field.


Exploitation of these vulnerabilities allows attackers to execute arbitrary code in the context of the user that started the affected program. Since the tools that are part of ImageMagick are sometimes used as helper tools by web applications, this user may be the same as the httpd user.

To exploit these vulnerabilities, an attacker would need to get a maliciously constructed image file processed by one of the affected applications. This could be accomplished by uploading to a web-application or using social engineering tactics.

While neither aforementioned format is widely used, ImageMagick does not determine the file type by its extension, allowing it to be disguised as another file type.


iDefense has confirmed the existence of these vulnerabilities in ImageMagick version 6.3.x. Additionally, the source code for versions 6.3.1, 6.3.2, 6.3.3-3 and 6.2.9 contain the affected code. It is suspected that earlier versions of ImageMagick are also vulnerable.


Exposure to these vulnerabilities can be mitigated by moving or deleting the DCM and XWD module files from the ImageMagick modules directory. However, this will remove support for these image formats altogether.


The ImageMagick maintainers have addressed these vulnerabilities in version 6.3.3-5 of ImageMagick.


A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not been assigned yet.


02/28/2007 Initial vendor notification
03/20/2007 Initial vendor response
03/31/2007 Coordinated public disclosure


The discoverer of this vulnerability wishes to remain anonymous.

Get paid for vulnerability research

Free tools, research and upcoming events


Copyright © 2007 Verisign, Inc.

Permission is granted for the redistribution of this alert electronically. It may not be edited in any way without the express written consent of iDefense. If you wish to reprint the whole or any part of this alert in any other medium other than electronically, please e-mail customer service for permission.

Disclaimer: The information in the advisory is believed to be accurate at the time of publishing based on currently available information. Use of the information constitutes acceptance for use in an AS IS condition. There are no warranties with regard to this information. Neither the author nor the publisher accepts any liability for any direct, indirect, or consequential loss or damage arising from use of, or reliance on, this information.