copyright | disclaimer | privacy | contact  
Australia's Leading Computer Emergency Response Team
 
Search this site

 
On this site

 > HOME
 > About AusCERT
 > Membership
 > Contact Us
 > PKI Services
 > Training
 > Publications
 > Sec. Bulletins
 > Conferences
 > News & Media
 > Services
 > Web Log
 > Site Map
 > Site Help
 > Member login





 

ESB-2005.0048 -- iDEFENSE Security Advisory 01.17.05 -- Multiple Vendor ImageMagick .psd Image File Decode Heap Overflow Vulnerability

Date: 18 January 2005
References: ESB-2005.0058  ESB-2005.0060  ESB-2005.0161  

Click here for printable version
Click here for PGP verifiable version
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

===========================================================================
             AUSCERT External Security Bulletin Redistribution

           ESB-2005.0048 -- iDEFENSE Security Advisory 01.17.05
          Multiple Vendor ImageMagick .psd Image File Decode Heap
                          Overflow Vulnerability
                              18 January 2005

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:           ImageMagick 6.1.7 and prior
Publisher:         iDEFENSE
Operating System:  BSD variants
                   Linux variants
                   UNIX variants
                   Mac OS
                   Mac OS X
                   Windows
Impact:            Execute Arbitrary Code/Commands
Access:            Remote/Unauthenticated
CVE Names:         CAN-2005-0005

Original Bulletin: http://www.idefense.com/application/poi/display?id=184

- --------------------------BEGIN INCLUDED TEXT--------------------

Multiple Vendor ImageMagick .psd Image File Decode Heap Overflow
Vulnerability

iDEFENSE Security Advisory 01.17.05
www.idefense.com/application/poi/display?id=184&type=vulnerabilities
January 17, 2005

I. BACKGROUND

ImageMagick provides a variety of graphics image-handling libraries and 
capabilities. These libraries are widely used and are shipped by default

on most Unix and Linux distributions. These libraries are commonly 
installed by default on computers where any other graphical image viewer
or X Desktop environment is installed (such as Gnome or KDE).

More information is available at the following site:

   http://www.imagemagick.org

II. DESCRIPTION

Remote exploitation of a buffer overflow vulnerability in The 
ImageMagick's Project's ImageMagick PSD image-decoding module could 
allow an attacker to execute arbitrary code. 

A heap overflow exists within ImageMagick, specifically in the decoding 
of Photoshop Document (PSD) files. The vulnerable code follows:

ImageMagick-6.1.0/coders/psd.c

for (j=0; j < (long) layer_info[i].channels; j++) 
{ 
  layer_info[i].channel_info[j].type=(short)ReadBlobMSBShort(image);
  layer_info[i].channel_info[j].size=ReadBlobMSBLong(image);
  [...]
} 

The array channel_info is only 24 elements large, and the loop variable,

"j", is bounded by a user-supplied value from the image file, thus 
allowing a heap overflow to occur when more than 24 layers are 
specified. If heap structures are overflowed in a controlled way, 
execution of arbitrary code is possible.

III. ANALYSIS

Exploitation may allow attackers to run arbitrary code on a victim's 
computer if the victim opens a specially formatted image. Such images 
could be delivered by e-mail or HTML, in some cases, and would likely 
not raise suspicion on the victim's part. Exploitation is also possible 
when a web-based application uses ImageMagick to process user-uploaded 
image files.

IV. DETECTION

iDEFENSE has confirmed this vulnerability in ImageMagick 6.1.0 and 
ImageMagick 6.1.7. Earlier versions are also suspected vulnerable.

The following vendors may include vulnerable ImageMagick packages: 
	
   The Debian Project 
   MandrakeSoft 
   Red Hat, Inc. 

V. WORKAROUND

Do not open files from untrusted sources. Do not allow untrusted sources

to process images using your web application.

VI. VENDOR RESPONSE

This vulnerability is addressed in ImageMagick 6.1.8-8, available for
download at:

   http://www.imagemagick.org/www/download.html

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
names CAN-2005-0005 to these issues. This is a candidate for inclusion
in the CVE list (http://cve.mitre.org), which standardizes names for
security problems.

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

VIII. DISCLOSURE TIMELINE

12/21/2004  Initial vendor notification
01/14/2004  Initial vendor response
01/17/2005  Public disclosure

IX. CREDIT

Andrei Nigmatulin is credited with this discovery.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp

X. LEGAL NOTICES

Copyright (c) 2004 iDEFENSE, 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
email customerservice@idefense.com 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.

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        http://www.auscert.org.au/render.html?cid=1980

If you believe that your computer system has been compromised or attacked in 
any way, we encourage you to let us know by completing the secure National IT 
Incident Reporting Form at:

        http://www.auscert.org.au/render.html?it=3192

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================

-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBQexPWyh9+71yA2DNAQJwIQP+Kvwd1jyp5+EIBaHswSy4D2FT/8MjytqB
6JZTRCdo5PvxYcQ07MiZwID1dnvhoxjznEGXB6M6VqTIh4oXLO5tFL/jkR1AoJEP
51J0OKrp8GWy2DuZd7BOvrJJxGEV6QlE37m1qEr98R121/EeKbhoy5K2d85Z2Xx/
J4doYUSxOGE=
=lR9x
-----END PGP SIGNATURE-----