Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 77932
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Sune Kloppenborg Jeppesen <jaervosz@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
psd_overflow.patch psd_overflow.patch patch Thierry Carrez (RETIRED) 2005-01-15 11:41 0000 530 bytes Details | Diff
psd_overflow2.patch psd_overflow2.patch patch Thierry Carrez (RETIRED) 2005-01-17 06:48 0000 879 bytes Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 77932 depends on: Show dependency tree
Bug 77932 blocks:

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2005-01-13 21:42 0000
Multiple Unix/Linux Vendor ImageMagick .psd Image File Decode Heap
Overflow Vulnerability

iDEFENSE Security Advisory 01.13.05
http://www.idefense.com/application/poi/display?type=vulnerabilities
January 13, 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 and 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 susceptible 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

Multiple unsuccessful attempts were made to inform ImageMagick.org about
this vulnerability.

VII. CVE INFORMATION

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

VIII. DISCLOSURE TIMELINE

12/21/2004  Initial vendor notification
12/22/2004  Rejection notification received from the Magick-bugs mailing
            list
01/13/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 

------- Comment #1 From Sune Kloppenborg Jeppesen 2005-01-13 21:42:01 0000 -------
Multiple Unix/Linux Vendor ImageMagick .psd Image File Decode Heap
Overflow Vulnerability

iDEFENSE Security Advisory 01.13.05
http://www.idefense.com/application/poi/display?type=vulnerabilities
January 13, 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 and 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 susceptible 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

Multiple unsuccessful attempts were made to inform ImageMagick.org about
this vulnerability.

VII. CVE INFORMATION

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

VIII. DISCLOSURE TIMELINE

12/21/2004  Initial vendor notification
12/22/2004  Rejection notification received from the Magick-bugs mailing
            list
01/13/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 © 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.

------- Comment #2 From Sune Kloppenborg Jeppesen 2005-01-13 21:49:57 0000 -------
Scheduled for release today and no fix currently available.

------- Comment #3 From Thierry Carrez (RETIRED) 2005-01-14 02:19:44 0000 -------
Declassifying: signoff=jaervosz/koon

------- Comment #4 From Sune Kloppenborg Jeppesen 2005-01-14 09:33:55 0000 -------
Coordinated release postponed until monday and a patch should be available by
that time.

------- Comment #5 From Thierry Carrez (RETIRED) 2005-01-15 11:41:01 0000 -------
Created an attachment (id=48565) [details]
psd_overflow.patch

Patch from Martin Schulze (Debian).

Applies to 6.1.3.4 and 6.1.6.0 with :
Hunk #1 succeeded at 667 with fuzz 2 (offset 109 lines).

------- Comment #6 From Thierry Carrez (RETIRED) 2005-01-15 11:45:26 0000 -------
Karol: This is a confidential bug. You should prepare revbump ebuilds that
include this patch for versions 6.1.3.4 and 6.1.6.0 at least. Please do not
commit them to the tree until the official announcement on Monday. You can
attach them here so that we'll ask arch testing.

------- Comment #7 From Thierry Carrez (RETIRED) 2005-01-17 06:48:03 0000 -------
Created an attachment (id=48753) [details]
psd_overflow2.patch

More complete patch from SuSE.

------- Comment #8 From Thierry Carrez (RETIRED) 2005-01-17 09:06:28 0000 -------
It's semi-public now : http://www.imagemagick.org/www/Changelog.html
You should doublecheck that 6.1.8-8 contains all fixes and commit it to portage.
We'll open this bug when iDEFENSE advisory will be officially out.

------- Comment #9 From Thierry Carrez (RETIRED) 2005-01-17 11:43:40 0000 -------
CAN-2005-0005
Now public @ http://www.idefense.com/application/poi/display?id=184&type=vulnerabilities

sekretarz/graphics herd: please bump to 6.1.8-8

------- Comment #10 From Karol Wojtaszek (RETIRED) 2005-01-17 11:53:49 0000 -------
Bumped imagemagick will be today in portage, i'm testing it now

------- Comment #11 From Karol Wojtaszek (RETIRED) 2005-01-17 13:51:50 0000 -------
imagemagick-6.1.8.8 is in portage, we don't need patch, because it is already
patched.

------- Comment #12 From Sune Kloppenborg Jeppesen 2005-01-17 14:54:07 0000 -------
Thx Karol.

Arches please test imagemagick-6.1.8.8 dev-perl/perlmagick-6.1.8.8

------- Comment #13 From Gustavo Zacarias (RETIRED) 2005-01-18 05:21:38 0000 -------
fpx support seems to be broken, snip:

coders/fpx.c: In function `WriteFPXImage':
coders/fpx.c:978: warning: passing arg 3 of `ImportQuantumPixels' makes integer from pointer without a cast
coders/fpx.c:978: error: too few arguments to function `ImportQuantumPixels'

There's a newer libfpx-1.2.0.9-1 in imagemagick's ftp but according to the changelog the changes are minimal and don't seem related to this.


------- Comment #14 From Karol Wojtaszek (RETIRED) 2005-01-18 06:47:42 0000 -------
Added patch to portage, which fixes compile problem with enabled fpx use flag

------- Comment #15 From Gustavo Zacarias (RETIRED) 2005-01-18 09:39:19 0000 -------
Thanks Karol, your patch did the trick.
sparc stable.

------- Comment #16 From Markus Rothe 2005-01-18 11:41:02 0000 -------
stable on ppc64

------- Comment #17 From Olivier Crete 2005-01-18 13:41:30 0000 -------
the upstream src_uri for Imagemagick seems to only have -9 now and its not on
the mirrors.. 

------- Comment #18 From Michael Hanselmann (hansmi) (RETIRED) 2005-01-18 14:00:30 0000 -------
ppc stable.

tester: you can take the file out of distfiles-local on toucan, it will hit the mirrors soon.

------- Comment #19 From Olivier Crete 2005-01-18 18:19:46 0000 -------
x86 stable

------- Comment #20 From Karol Wojtaszek (RETIRED) 2005-01-19 07:45:06 0000 -------
amd64 done

------- Comment #21 From Bryan Østergaard (RETIRED) 2005-01-19 16:49:11 0000 -------
Stable on alpha.

------- Comment #22 From Hardave Riar (RETIRED) 2005-01-20 12:21:44 0000 -------
Stable on mips.

------- Comment #23 From Sune Kloppenborg Jeppesen 2005-01-20 14:14:09 0000 -------
Thx everyone.

GLSA 200501-26

hppa and ia64 please remember to mark stable to benifit from the GLSA.

------- Comment #24 From René Nussbaumer 2005-06-26 05:35:13 0000 -------
Already stable on hppa

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug