AUSCERT External Security Bulletin Redistribution

                 ESB-2002.129 -- CERT Advisory CA-2002-07
                Double Free Bug in zlib Compression Library
                               13 March 2002


        AusCERT Security Bulletin Summary

Product:                zlib
Vendor:                 Multiple Vendors
Impact:                 Root Compromise
                        Execute Arbitrary Code/Commands
                        Denial of Service
Access Required:        Existing Account

Ref:                    ESB-2002.125

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


CERT Advisory CA-2002-07 Double Free Bug in zlib Compression Library

   Original release date: March 12, 2002
   Last revised: --
   Source: CERT/CC

   A complete revision history can be found at the end of this file.

Systems Affected

     * Any  software  that  is  linked  to  zlib  1.1.3 or earlier may be
     * Data  compression libraries derived from zlib 1.1.3 or earlier may
       contain a similar bug


   There  is  a  bug  in  the  zlib compression library that may manifest
   itself  as a vulnerability in programs that are linked with zlib. This
   may  allow  an  attacker to conduct a denial-of-service attack, gather
   information, or execute arbitrary code.

   It  is important to note that the CERT/CC has not received any reports
   of  exploitation of this bug. Based on the information available to us
   at  this  time,  it  is difficult to determine whether this bug can be
   successfully  exploited.  However,  given the widespread deployment of
   zlib, we have published this document as a proactive measure.

I. Description

   There is a bug in the decompression algorithm used by the popular zlib
   compression   library.   If   an   attacker   is   able   to   pass  a
   specially-crafted  block  of invalid compressed data to a program that
   includes  zlib,  the  program's attempt to decompress the crafted data
   can  cause  the  zlib routines to corrupt the internal data structures
   maintained by malloc.

   The  bug  results  from  a  programming  error that causes segments of
   dynamically  allocated  memory  to  be  released more than once (i.e.,
   "double-freed"). Specifically, when inftrees.c:huft_build() encounters
   the   crafted   data,   it   returns   an  unexpected  Z_MEM_ERROR  to
   inftrees.c:inflate_trees_dynamic().  When a subsequent call is made to
   infblock.c:inflate_blocks(), the inflate_blocks function tries to free
   an internal data structure a second time.

   Because   this   bug   interferes   with  the  proper  allocation  and
   deallocation  of dynamic memory, it may be possible for an attacker to
   influence  the  operation  of  programs  that  include  zlib.  In most
   circumstances,  this influence will be limited to denial of service or
   information  leakage, but it is theoretically possible for an attacker
   to  insert  arbitrary  code into a running program. This code would be
   executed with the permissions of the vulnerable program.

   The CERT/CC is tracking this issue as VU#368819. This reference number
   corresponds to CVE candidate CAN-2002-0059.

II. Impact

   This  bug may introduce vulnerabilities into any program that includes
   the  affected  library. Depending upon how and where the zlib routines
   are  called  from  the  given program, the resulting vulnerability may
   have  one  or  more  of  the  following  impacts:  denial  of service,
   information leakage, or execution of arbitrary code.

III. Solution

Upgrade your version of zlib

   The  maintainers  of  zlib have released version 1.1.4 to address this
   vulnerability.  Upgrade any software that is linked to or derived from
   an earlier version of zlib. The latest version of zlib is available at

   These are the MD5 checksums for zlib version 1.1.4:

     abc405d0bdd3ee22782d7aa20e440f08 zlib-1.1.4.tar.gz
     9bf1d36ced334b0cf1f996f5c8171018 zlib114.zip

Apply a patch from your vendor

   The  zlib  compression  library  is  freely available and used by many
   vendors   in  a  wide  variety  of  applications.  Any  one  of  these
   applications  may  contain vulnerabilities that are introduced by this

   Appendix A contains information provided by vendors for this advisory.
   As  vendors report new information to the CERT/CC, we will update this
   section  and note the changes in our revision history. If a particular
   vendor  is  not  listed  below,  we  have not received their comments.
   Please contact your vendor directly.

Appendix A. - Vendor Information

   This  appendix  contains  information  provided  by  vendors  for this
   advisory.  As  vendors  report new information to the CERT/CC, we will
   update this section and note the changes in our revision history. If a
   particular  vendor  is  not  listed  below, we have not received their

Apple Computer, Inc.

   Mac OS X and Mac OS X Server do not contain this vulnerability.

Compaq Computer Corporation

   x-ref: SSRT0818 zlib

   At  the  time  of  writing this document, Compaq continues to evaluate
   this potential problem and impacts to Compaq released software. Compaq
   will implement solutions based on the conclusion of this evaluation as
   necessary.  Compaq  will provide notice of any new patches as a result
   any  required  solution through standard patch notification procedures
   and be available from your normal Compaq Services support channel.

Conectiva Linux

   Conectiva  Linux  supported  versions (5.0, 5.1, 6.0, 7.0, ferramentas
   graficas and ecomerce) are affected by the zlib vulnerability. Updates
   will be sent to our security mailing lists and be available at our ftp
   site  and  mirrors.  The  updates  will  include a new version of zlib
   itself and also other packages which include their own version of zlib
   or are linked statically to the system-wide copy of zlib.


   EnGarde Secure Linux Community and Professional are both vulnerable to
   the  zlib  bugs.  Guardian  Digital  addressed  this  vulnerability in
   ESA-20020311-008 which may be found at:


   EnGarde  Secure Professional users may upgrade their systems using the
   Guardian Digital Secure Network.


   FreeBSD  is  not  vulnerable,  as  the  FreeBSD  malloc implementation
   detects  and complains about several programming errors including this
   kind of double free.


   Fujitsu's   UXP/V  operating  system  is  not  affected  by  the  zlib
   vulnerability because it does not support zlib.

Hewlett-Packard Company

   HP is not vulnerable.

IBM Corporation

   IBM's   AIX   operating   system,   version   5.1,   ships  with  open
   source-originated  zlib  that  is used with the Redhat Package Manager
   (rpm)  to  install  applications  that  are  included in the AIX-Linux
   Affinity Toolkit. zlib (libz.a) is a shared library in AIX. AIX 5.1 is
   susceptible  to  the  described vulnerability. AIX 4.3.x does not ship
   with zlib, but customers who install zlib and use it will be similarly
   vulnerable.  IBM  will  make  the patched version of zlib available as
   soon as it is made available to us.


   OpenBSD  is  not vulnerable as OpenBSD's malloc implementation detects
   double freeing of memory. The zlib shipped with OpenBSD has been fixed
   in OpenBSD-current in January 2002.

Openwall GNU/*/Linux

   All  versions  of  Openwall  GNU/*/Linux (Owl) prior to the 2002/02/15
   Owl-current   snapshot   are   affected   by   the   zlib  double-free
   vulnerability.  Owl-current after 2002/02/15 includes the proper fixes
   in  its  userland  packages.  In order to not place the users of other
   vendors'  products  at  additional  risk,  we  have  agreed  to  delay
   documenting  this  as a security change and including the fixes in Owl
   0.1-stable  until  there's a coordinated public announcement. While we
   don't  normally  support this kind of a policy (releasing a fix before
   there's an announcement), this time handling the vulnerability in this
   way  was  consistent with the state of things by the time the (already
   publicly known) bug was first realized to be a security vulnerability.

   The  zlib bug could affect the following Owl packages: gnupg, openssh,
   rpm,  texinfo  (not  necessarily  in  a security sense). Of these, the
   OpenSSH  could potentially allow for an active remote attack resulting
   in a root compromise. If only SSH protocol version 1 is allowed in the
   OpenSSH  server  this is reduced to a local attack, but reverse remote
   attack  possibilities  by a malicious server remain. Additionally, any
   third-party software that makes use of the provided zlib library could
   be affected.

   Parts  of  the  Linux 2.2 kernel included in Owl were also affected by
   the  vulnerability.  Fortunately,  those  parts  (Deflate  compression
   support  for PPP and the experimental Deflate compression extension to
   IrDA)  are  normally  not  used  by the Owl userland. The bug has been
   corrected  starting  with  Linux 2.2.20-ow2 which has been made public
   and  a part of both Owl-current and Owl 0.1-stable on 2002/03/03. This
   change,  however,  will  only  be documented in the publicly-available
   change logs on the coordinated public announcement date.

Red Hat, Inc.

   Red  Hat  Linux  ships  with a zlib library that is vulnerable to this
   issue.  Although  most  packages  in Red Hat Linux use the shared zlib
   library we have identified a number of packages that either statically
   link to zlib or contain an internal version of the zlib code.

   Updates  to  zlib  and these packages as well as our advisory note are
   available from the following URL. Users of the Red Hat Network can use
   the up2date tool to automatically upgrade their systems.


   Red  Hat  would  like  to thank CERT/CC for their help in coordinating
   this issue with other vendors.


   SGI  acknowledges  the  zlib  vulnerabilities  reported by CERT and is
   currently  investigating.  No further information is available at this

   For  the  protection  of  all  our  customers,  SGI does not disclose,
   discuss  or  confirm  vulnerabilities  until  a full investigation has
   occurred  and any necessary patch(es) or release streams are available
   for all vulnerable and supported IRIX operating systems. Until SGI has
   more  definitive  information  to provide, customers are encouraged to
   assume   all   security   vulnerabilities   as  exploitable  and  take
   appropriate  steps  according  to  local  site  security  policies and
   requirements.  As  further  information  becomes available, additional
   advisories  will  be  issued  via  the normal SGI security information
   distribution   methods   including   the   wiretap   mailing  list  on


   XFree86 versions 4.0 through 4.2.0 include zlib version 1.0.8. XFree86
   3.x  includes  zlib version 1.0.4. The zlib code included with XFree86
   is  only  used on some platforms. This is determined by the setting of
   HasZlib   in  the  imake  config  files  in  the  xc/config/cf  source
   directory.  If  HasZlib  is  set  to  YES  in the platform's vendor.cf
   file(s),  then  the  system-provided  zlib  is  used  instead  of  the
   XFree86-provided  version.  XFree86  uses  the system-provided zlib by
   default only on the following platforms:

     FreeBSD 2.2 and later
     NetBSD 1.2.2 and later
     Debian Linux

   The  zlib  code in XFree86 has been fixed in the CVS repository (trunk
   and  the  xf-4_2-branch branch) as of 14 February 2002. A source patch
   for XFree86 4.2.0 will be available from

   The  following  XFree86 4.2.0 binary distributions provided by XFree86
   include and use a vulnerable version of zlib:


   When   updated   binaries   are  available,  it'll  be  documented  at

   To  check  if  an  installation  of  XFree86 includes zlib, see if the
   following file exists:


   To  check if an XFree86 X server is dynamically linked with zlib, look
   for    a    line   containing   'libz'   in   the   output   of   'ldd

   Various vendors repackage and distribute XFree86, and may use settings
   and configurations different from those described here.


   All  users  of zlib versions 1.1.3 or earlier should obtain the latest
   version,  1.1.4  or later, from http://www.zlib.org, in order to avoid
   this  vulnerability  as  well  as  other  possible  vulnerabilities in
   versions prior to 1.1.3 when decompressing invalid data.

Appendix B. - References

     * http://bugzilla.gnome.org/show_bug.cgi?id=70594
     * http://www.kb.cert.org/vuls/id/368819
     * http://www.libpng.org/pub/png/pngapps.html
     * http://www.redhat.com/support/errata/RHSA-2002-026.html

   The  CERT/CC  thanks  Owen  Taylor  and  Mark Cox of Red Hat, Inc. for
   reporting this vulnerability. We also thank Mark Adler of zlib.org for
   contributing  to  our research and Matthias Clasen for contributing to
   the discovery of this vulnerability.

   This document was written by Jeffrey P. Lanza.

   This document is available from:

CERT/CC Contact Information

   Email: cert@cert.org
          Phone: +1 412-268-7090 (24-hour hotline)
          Fax: +1 412-268-6989
          Postal address:
          CERT Coordination Center
          Software Engineering Institute
          Carnegie Mellon University
          Pittsburgh PA 15213-3890

   CERT/CC   personnel   answer  the  hotline  08:00-17:00  EST(GMT-5)  /
   EDT(GMT-4)  Monday  through  Friday;  they are on call for emergencies
   during other hours, on U.S. holidays, and on weekends.

Using encryption

   We  strongly  urge you to encrypt sensitive information sent by email.
   Our public PGP key is available from


   If  you  prefer  to  use  DES,  please  call the CERT hotline for more

Getting security information

   CERT  publications  and  other security information are available from
   our web site


   To  subscribe  to  the CERT mailing list for advisories and bulletins,
   send  email  to majordomo@cert.org. Please include in the body of your

   subscribe cert-advisory

   *  "CERT"  and  "CERT  Coordination Center" are registered in the U.S.
   Patent and Trademark Office.

   Any  material furnished by Carnegie Mellon University and the Software
   Engineering  Institute  is  furnished  on  an  "as is" basis. Carnegie
   Mellon University makes no warranties of any kind, either expressed or
   implied  as  to  any matter including, but not limited to, warranty of
   fitness  for  a  particular purpose or merchantability, exclusivity or
   results  obtained from use of the material. Carnegie Mellon University
   does  not  make  any warranty of any kind with respect to freedom from
   patent, trademark, or copyright infringement.

   Conditions for use, disclaimers, and sponsorship information

   Copyright 2002 Carnegie Mellon University.

   Revision History
Mar 12, 2002:  Initial release

Version: PGP 6.5.8


- --------------------------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.

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 use any or all of this information is
the responsibility of each user or organisation, and should be done so in
accordance with site policies and procedures.

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 original authors 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 system has been compromised, contact AusCERT or
your representative in FIRST (Forum of Incident Response and Security

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 emergencies.

Version: 2.6.3i
Charset: noconv
Comment: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key