-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

                    ESB-2007.0722 -- [Win][UNIX/Linux]
                   Multiple ImageMagick Vulnerabilities
                             24 September 2007

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

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

Product:              ImageMagick
Publisher:            iDEFENSE
Operating System:     UNIX variants (UNIX, Linux, OSX)
                      Windows
Impact:               Execute Arbitrary Code/Commands
                      Denial of Service
Access:               Remote/Unauthenticated
CVE Names:            CVE-2007-4985 CVE-2007-4986 CVE-2007-4987
                      CVE-2007-4988

Original Bulletin:  
  http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=594
  http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=595
  http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=596
  http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=597

Comment: This bulletin contains four advisories from iDefense concerning
         multiple ImageMagick vulnerabilities.

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

Multiple Vendor ImageMagick Multiple Integer Overflow Vulnerabilities

iDefense Security Advisory 09.19.07
http://labs.idefense.com/intelligence/vulnerabilities/
Sep 19, 2007

I. BACKGROUND

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

http://www.imagemagick.org/

II. DESCRIPTION

Remote exploitation of multiple integer overflow vulnerabilities in
ImageMagick, as included in various vendors' operating system
distributions, allows attackers to crash applications using the
ImageMagick library, and in some cases, execute arbitrary code.

Several integer overflow vulnerabilities have been identified in
ImageMagick's handling of various file formats. By creating a specially
crafted DCM, DIB, XBM, XCF, or XWD image file, an attacker can cause a
heap buffer of insufficient size to be allocated. This results in a
heap-based buffer overflow.

III. ANALYSIS

Exploitation of these vulnerabilities allows an attacker to crash the
programs using ImageMagick library, or execute arbitrary code in the
context of the user.

One way of exploiting these vulnerabilities is to persuade a targeted
user to open a malicious image file with a program that utilizes the
ImageMagick library.

As the tools that are part of ImageMagick are sometimes used as helper
tools by other applications, this user may be the same as the web
server user. This scenario is somewhat more severe than the previously
described attack vector since the image processing can occur
automatically.

IV. DETECTION

iDefense Labs confirmed that ImageMagick version 6.3.4 is vulnerable. It
is suspected that other versions of ImageMagick are also vulnerable.

V. WORKAROUND

Exposure to some of these vulnerabilities can be mitigated by moving or
deleting the related module files. The file locations may vary between
distributions. The globbing expressions listed below correspond to a
Red Hat Linux system.

  /usr/lib/ImageMagick-*/modules*/coders/dcm.*
  /usr/lib/ImageMagick-*/modules*/coders/dib.*
  /usr/lib/ImageMagick-*/modules*/coders/xbm.*
  /usr/lib/ImageMagick-*/modules*/coders/xcf.*
  /usr/lib/ImageMagick-*/modules*/coders/xwd.*

VI. VENDOR RESPONSE

The ImageMagick maintainers have addressed these vulnerabilities with
the release of version 6.3.5-9. More information is available from the
following URL.

http://studio.imagemagick.org/pipermail/magick-announce/2007-September/000037.html

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CVE-2007-4986 to this issue. This is a candidate for inclusion in
the CVE list (http://cve.mitre.org/), which standardizes names for
security problems.

VIII. DISCLOSURE TIMELINE

09/04/2007  Initial vendor notification
09/05/2007  Initial vendor response
09/19/2007  Coordinated public disclosure

IX. CREDIT

These vulnerabilities were reported to iDefense by regenrecht.

Get paid for vulnerability research
http://labs.idefense.com/methodology/vulnerability/vcp.php

Free tools, research and upcoming events
http://labs.idefense.com/

X. LEGAL NOTICES

Copyright © 2007 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 e-mail 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.


Multiple Vendor ImageMagick Off-By-One Vulnerability

iDefense Security Advisory 09.19.07
http://labs.idefense.com/intelligence/vulnerabilities/
Sep 19, 2007

I. BACKGROUND

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

http://www.imagemagick.org/

II. DESCRIPTION

Remote exploitation of an off-by-one vulnerability in ImageMagick, as
included in various vendors' operating system distributions, allows
attackers to execute arbitrary code.

This vulnerability specifically exists in the ReadBlobString() function
in magick/blob.c as shown below.

  3110    for (i=0; i < (long) MaxTextExtent; i++)
  3111    {
  3112      p=ReadBlobStream(image,1,buffer,&count);
  ...
  3119      string[i]=(char) (*p);
  3120      if ((string[i] == '\n') || (string[i] == '\r'))
  3121        break;
  3122    }
  3123    string[i]='\0';

The variable "string" is a character array of length "MaxTextExtent". An
off-by-one buffer overflow will occur on line 3123 when "i" is exactly
"MaxTextExtent". This function is called from several image file
processing routines. Most of the buffers involved are stack based,
although some are on the heap.

III. ANALYSIS

Exploitation of this vulnerability allows an attacker to execute
arbitrary code in the context of the user.

One way of exploiting this vulnerability is to persuade a targeted user
to open a malicious image file with a program that utilizes the
ImageMagick library.

As the tools that are part of ImageMagick are sometimes used as helper
tools by other applications, this user may be the same as the web
server user. This scenario is somewhat more severe than the previously
described attack vector since the image processing can occur
automatically.

Exploitation in stack-based scenarios depends on the stack layout, which
depends on the compiler and compiler options used to build the library.

IV. DETECTION

iDefense Labs confirmed that ImageMagick version 6.3.4 is vulnerable. It
is suspected that other versions of ImageMagick are also vulnerable.

V. WORKAROUND

iDefense is unaware of any effective workaround for this vulnerability.

VI. VENDOR RESPONSE

The ImageMagick maintainers have addressed this vulnerability with the
release of version 6.3.5-9. More information is available from the
following URL.

http://studio.imagemagick.org/pipermail/magick-announce/2007-September/000037.html

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CVE-2007-4987 to this issue. This is a candidate for inclusion in
the CVE list (http://cve.mitre.org/), which standardizes names for
security problems.

VIII. DISCLOSURE TIMELINE

09/04/2007  Initial vendor notification
09/05/2007  Initial vendor response
09/19/2007  Coordinated public disclosure

IX. CREDIT

This vulnerability was reported to iDefense by regenrecht.

Get paid for vulnerability research
http://labs.idefense.com/methodology/vulnerability/vcp.php

Free tools, research and upcoming events
http://labs.idefense.com/

X. LEGAL NOTICES

Copyright © 2007 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 e-mail 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.


Multiple Vendor ImageMagick Multiple Denial of Service Vulnerabilities

iDefense Security Advisory 09.19.07
http://labs.idefense.com/intelligence/vulnerabilities/
Sep 19, 2007

I. BACKGROUND

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

http://www.imagemagick.org/

II. DESCRIPTION

Remote exploitation of multiple denial of service vulnerabilities in
ImageMagick, as included in various vendors' operating system
distributions, allows attackers to consume excessive CPU resources on
the target system.

The first vulnerability exists in the ReadDCMImage() function. Since the
return value of ReadBlobByte() is not properly checked, it can enter an
infinite loop.

The second vulnerability exists in the ReadXCFImage() function. Since
the return value of ReadBlobMSBLong() is not properly checked, it can
enter an infinite loop.

III. ANALYSIS

Exploitation of these vulnerabilities allows an attacker to consume
excessive CPU resource on the system using the ImageMagick library to
process images.

One way of exploiting these vulnerabilities is to persuade a targeted
user to open a malicious image file with a program that utilizes the
ImageMagick library.

As the tools that are part of ImageMagick are sometimes used as helper
tools by other applications, this user may be the same as the web
server user. This scenario is somewhat more severe than the previously
described attack vector since the image processing can occur
automatically.

IV. DETECTION

iDefense Labs confirmed that ImageMagick version 6.3.4 is vulnerable. It
is suspected that other versions of ImageMagick are also vulnerable.

V. WORKAROUND

Exposure to some of these vulnerabilities can be mitigated by moving or
deleting the related module files. The file locations may vary between
distributions. The globbing expressions listed below correspond to a
Red Hat Linux system.

  /usr/lib/ImageMagick-*/modules*/coders/dcm.*
  /usr/lib/ImageMagick-*/modules*/coders/xcf.*

VI. VENDOR RESPONSE

The ImageMagick maintainers have addressed these vulnerabilities with
the release of version 6.3.5-9. More information is available from the
following URL.

http://studio.imagemagick.org/pipermail/magick-announce/2007-September/000037.html

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CVE-2007-4985 to this issue. This is a candidate for inclusion in
the CVE list (http://cve.mitre.org/), which standardizes names for
security problems.

VIII. DISCLOSURE TIMELINE

09/04/2007  Initial vendor notification
09/05/2007  Initial vendor response
09/19/2007  Coordinated public disclosure

IX. CREDIT

These vulnerabilities were reported to iDefense by regenrecht.

Get paid for vulnerability research
http://labs.idefense.com/methodology/vulnerability/vcp.php

Free tools, research and upcoming events
http://labs.idefense.com/

X. LEGAL NOTICES

Copyright © 2007 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 e-mail 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.


Multiple Vendor ImageMagick Sign Extension Vulnerability

iDefense Security Advisory 09.19.07
http://labs.idefense.com/intelligence/vulnerabilities/
Sep 19, 2007

I. BACKGROUND

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

http://www.imagemagick.org/

II. DESCRIPTION

Remote exploitation of a sign extension vulnerability in ImageMagick, as
included in various vendors' operating system distributions, allows
attackers to execute arbitrary code.

This vulnerability specifically exists in the ReadDIBImage() as shown
below.

  558    image->columns=(unsigned long) dib_info.width
  ...
  620    bytes_per_line=4*((image->columns*dib_info.bits_per_pixel+31)/32);
  621    length=bytes_per_line*image->rows;
  622    pixels=(unsigned char *) AcquireMagickMemory((size_t) MagickMax(
  623      bytes_per_line,image->columns+256)*image->rows*sizeof(*pixels));
  ...
  629       count=ReadBlob(image,length,pixels);
  ...
  638       status=DecodeImage(image,dib_info.compression ? MagickTrue :
MagickFalse,pixels);

At line 558, "dib_info.width" is a signed short, which is extended to an
unsigned long and assigned to "image->columns". For example, a value of
0x8000 will be extended to 0xffff8000. Later, it is used as a
multiplier when calculating the allocation size. An integer overflow
occurs, leading to a heap block of insufficient size being allocated.
Consequently, a heap buffer overflow occurs.

III. ANALYSIS

Exploitation of this vulnerability allows an attacker to execute
arbitrary code in the context of the user.

One way of exploiting this vulnerability is to persuade a targeted user
to open a malicious image file with a program that utilizes the
ImageMagick library.

As the tools that are part of ImageMagick are sometimes used as helper
tools by other applications, this user may be the same as the web
server user. This scenario is somewhat more severe than the previously
described attack vector since the image processing can occur
automatically.

IV. DETECTION

iDefense Labs confirmed that ImageMagick version 6.3.4 is vulnerable. It
is suspected that other versions of ImageMagick are also vulnerable.

V. WORKAROUND

Exposure to this vulnerability can be mitigated by moving or deleting
the related module files. The file locations may vary between
distributions. The globbing expression listed below corresponds to a
Red Hat Linux system.

  /usr/lib/ImageMagick-*/modules*/coders/dib.*

VI. VENDOR RESPONSE

The ImageMagick maintainers have addressed this vulnerability with the
release of version 6.3.5-9. More information is available from the
following URL.

http://studio.imagemagick.org/pipermail/magick-announce/2007-September/000037.html

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CVE-2007-4988 to this issue. This is a candidate for inclusion in
the CVE list (http://cve.mitre.org/), which standardizes names for
security problems.

VIII. DISCLOSURE TIMELINE

09/04/2007  Initial vendor notification
09/05/2007  Initial vendor response
09/19/2007  Public disclosure

IX. CREDIT

This vulnerability was reported to iDefense by regenrecht.

Get paid for vulnerability research
http://labs.idefense.com/methodology/vulnerability/vcp.php

Free tools, research and upcoming events
http://labs.idefense.com/

X. LEGAL NOTICES

Copyright © 2007 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 e-mail 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

iQCVAwUBRvdcwih9+71yA2DNAQLVHgP/ch6CWv5Qs/f5poEIrf/QoY14vFgdOiTT
3kUOBJ4j7m3VCyQVJU3p21BB3AXSq9xWFNhq+7QUlfUXCz7/zEa1v3GaCFKzl2eM
2cw7xFSh977+CP08UTcpaB8VxsqsFH+cxD8/ZZMvN8htwT8vTTTcn+osfr1HaRrL
BPvGAf0qWAw=
=18uT
-----END PGP SIGNATURE-----