Hash: SHA1

             AUSCERT External Security Bulletin Redistribution

           ESB-2005.0055 -- iDEFENSE Security Advisory 01.18.05
        Multiple Unix/Linux Vendor Xpdf makeFileKey2 Stack Overflow
                              19 January 2005


        AusCERT Security Bulletin Summary

Product:           Xpdf
Publisher:         iDEFENSE
Operating System:  BSD variants
                   Linux variants
                   UNIX variants
Impact:            Execute Arbitrary Code/Commands
Access:            Remote/Unauthenticated
CVE Names:         CAN-2005-0064

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

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

Multiple Unix/Linux Vendor Xpdf makeFileKey2 Stack Overflow 

iDEFENSE Security Advisory 01.18.05
January 18, 2005


Xpdf is an open-source viewer for PDF files. More information is 
available at the following site:



Remote exploitation of a buffer overflow vulnerability in the xpdf PDF 
viewer included in multiple Unix and Linux distributions could allow for

arbitrary code execution as the user viewing a PDF file. 

The vulnerability specifically exists due to insufficient bounds 
checking while processing a PDF file that provides malicious values in 
the /Encrypt /Length tag. The offending code can be found in the 
Decrypt::makeFileKey2 function in the source file xpdf/Decrypt.cc. 

GBool Decrypt::makeFileKey2(int encVersion, int encRevision,
                            int keyLength, GString *ownerKey,
                            GString *userKey, int permissions,
                            GString *fileID, String *userPassword,
                            Guchar *fileKey) {
      Guchar *buf;
      Guchar test[32];
      Guchar fState[256];
      Guchar tmpKey[16];
      Guchar fx, fy;
      int len, i, j;
      GBool ok;

            memcpy(test, userKey->getCString(), 32);
            for (i = 19; i >= 0; --i) {
                  for (j = 0; j < keyLength; ++j) {
[overflow]               tmpKey[j] = fileKey[j] ^ i; 

In this piece of code, the keyLength value is ultimately supplied by the

PDF file. This allows an attacker to specify an arbitrarily large value 
and overwrite portions of stack memory. As a consequence, arbitrary code

execution is possible.


Successful exploitation of this vulnerability leads to arbitrary code 
execution as the user who opened the malicious file. An attacker would 
have to convince a target to open the provided file in order to exploit 
this vulnerability, thus lessening the impact.

Exploitation can be performed reliably, especially with knowledge of the

target system.


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

The following Linux vendors may be affected by this vulnerability:

	Novell Inc. (SUSE) 
	Red Hat Inc. 
	The Fedora Project 
	Debian Project 
	Gentoo Foundation Inc. 
	The FreeBSD Project 


Only open PDF files from trusted individuals.


A patch to address this issue is available at:


Updated binaries (ver. 3.00pl3) to address this issue are available at:



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


01/06/2005  Initial vendor notification
01/12/2005  Initial vendor response
01/18/2005  Coordinated public disclosure


The discoverer of this vulnerability wishes to remain anonymous.

Get paid for vulnerability research


Copyright (c) 2005 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:


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:


Australian Computer Emergency Response Team
The University of Queensland
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.

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