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-2004.0809 -- iDEFENSE Security Advisory 12.21.04 -- Multiple Vendor xpdf PDF Viewer Buffer Overflow Vulnerability

Date: 22 December 2004
References: ESB-2004.0823  ESB-2005.0001  ESB-2005.0003  

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

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

           ESB-2004.0809 -- iDEFENSE Security Advisory 12.21.04
       Multiple Vendor xpdf PDF Viewer Buffer Overflow Vulnerability
                             22 December 2004

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

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

Product:           Xpdf 3.00 and prior
Publisher:         iDEFENSE
Operating System:  UNIX variants
                   Linux variants
Impact:            Execute Arbitrary Code/Commands
Access:            Remote/Unauthenticated
CVE Names:         CAN-2004-1125

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

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

Multiple Vendor xpdf PDF Viewer Buffer Overflow Vulnerability 

iDEFENSE Security Advisory 12.21.04
www.idefense.com/application/poi/display?id=172&type=vulnerabilities
December 21, 2004

I. BACKGROUND

Xpdf is an open-source viewer for Portable Document Format (PDF) files.

II. DESCRIPTION

Remote exploitation of a buffer overflow vulnerability in the xpdf PDF 
viewer, as included in multiple Linux distributions, could allow 
attackers to execute arbitrary code as the user viewing a PDF file. The 
offending code can be found in the Gfx::doImage() function in the source
file xpdf/Gfx.cc. 

void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
  Dict *dict;
  int width, height;
  int bits;
  GBool mask;
  GBool invert;
  GfxColorSpace *colorSpace;
  GfxImageColorMap *colorMap;
  Object maskObj;
  GBool haveMask;
  int maskColors[2*gfxColorMaxComps];
  Object obj1, obj2;
  int i;

  ...
    // get the mask
    haveMask = gFalse;
    dict->lookup("Mask", &maskObj);
        if (maskObj.isArray()) {
          for (i = 0; i < maskObj.arrayGetLength(); ++i) {
        maskObj.arrayGet(i, &obj1);
[!]         maskColors[i] = obj1.getInt();
            obj1.free();
          }
          haveMask = gTrue;
        }
  ...
}  


Due to the fact that the loop boundaries are not less than the storage 
area, the maskColors array is eventually filled up. After that, local 
variables and other stack memory is overwritten. This ultimately leads 
to control of program flow and arbitrary code execution.

III. ANALYSIS

The severity of this issue is mitigated by the fact that several of the 
local overwritten variables in doImage() are referenced prior to EIP 
being restored; therefore, before the attack gains control of the target
process. However, an attacker with knowledge of the remote operating 
system can construct and validate a malicious payload before attempting 
exploitation, thus increasing the chances of success. An attacker must 
convince a target user to open the malicious file to exploit this 
vulnerability.

IV. DETECTION

iDEFENSE has confirmed the existence of this vulnerability in version 
3.00 of xpdf. It is suspected previous versions are also vulnerable. 

The following Linux distributions are affected by this vulnerability:

	SUSE Linux 
	Redhat Linux 
	Fedora Linux 
	Debian Linux 
	Gentoo Linux 
	FreeBSD (ports) 
	OpenBSD 

V. WORKAROUND

Only open PDF files from trusted individuals.

VI. VENDOR RESPONSE

A patch to address this vulnerability is available from:
    ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.00pl2.patch

Updated binaries (version 3.00pl2) are available from:
    http://www.foolabs.com/xpdf/download.html

VII. CVE INFORMATION

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

VIII. DISCLOSURE TIMELINE

11/23/2004  Initial vendor notification
11/29/2004  Initial vendor response
12/21/2004  Coordinated public disclosure

IX. CREDIT

The discoverer of this vulnerability wishes to remain anonymous.

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

iQCVAwUBQci6ayh9+71yA2DNAQINsAQAgL+w5XQ3chJcccGn08unqlhKvt7HMDYj
N0Qocl+hGO2YcMNhhLRA4SLZ4zelfpxkZ6k4XQIO2klIuk1frePuq4Ikqx1u/xUD
S9j6if4nexH3Z6Hquc7I//Wh/X4Xly0GxQUPVP4XlIpE9T3uRrmIncNyUllxjlzL
yHerL7hHLYE=
=goZL
-----END PGP SIGNATURE-----