NetBSD Security Advisory 2003-004: Format string vulnerability in zlib gzprintf()

From: NetBSD Security Officer (security-officerat_private)
Date: Wed Mar 26 2003 - 10:55:44 PST

  • Next message: NetBSD Security Officer: "NetBSD Security Advisory 2003-007: (Another) Encryption weakness in OpenSSL code"

    -----BEGIN PGP SIGNED MESSAGE-----
    
    
    		 NetBSD Security Advisory 2003-004
    		 =================================
    
    Topic:		Format string vulnerability in zlib gzprintf()
    
    Version:	NetBSD-current:	source prior to March 5, 2003
    		NetBSD 1.6:	affected
    		NetBSD-1.5.3:	affected
    		NetBSD-1.5.2:	affected
    		NetBSD-1.5.1:	affected
    		NetBSD-1.5:	affected
    		pkgsrc:		devel/zlib packages prior to zlib-1.1.4nb1
    
    Severity:	Privilege escalation in applications call using gzprintf().
    		(There are none in the base system.)
    
    Fixed:		NetBSD-current:		March 6, 2003
    		NetBSD-1.6 branch:	March 6, 2003 (1.6.1 will include the fix)
    		NetBSD-1.5 branch:	March 6, 2003
    		pkgsrc devel/zlib:	zlib-1.1.4nb1 corrects this issue
    
    
    Abstract
    ========
    
    The gzprintf function in zlib did not do bounds checking on user
    supplied data.  Depending on how the function is used in an application,
    malign source data can be designed to overflow a buffer and execute
    arbitrary code as the user of the application.
    
    gzprintf is not used in any program in the NetBSD system, but could be
    used by third party software, including pkgsrc.
    
    
    Technical Details
    =================
    
    While many programs use zlib, most use only the decompression
    functionality. gzprintf is a compressing printf, and is rarely used, by
    comparison.
    
    Additionally, since network uses of zlib generally compress data going
    onto the network from the local host, it is unlikely that applications
    exist which would be remotely exploitable because of this bug.
    
    Local privilege escalation could be a concern, and while there are no
    instances of binaries in the base NetBSD system which use gzprintf,
    convincing someone to run a vulnerable application under their uid could
    be abused to gain their privileges.
    
    NetBSD Security-Officer is performing an audit of pkgsrc code to create
    a list of vulnerable pkgs, which will be marked in the audit-packages
    database, and added to this advisory.
    
    It is noteworthy that many third-party distribution files include their
    own copy of zlib, for use on operating systems which do not supply it.
    NetBSD pkgsrc uses the application's configure script (if any) and
    should detect and use the patched NetBSD zlib in those cases.
     
    http://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCAN-2003-01
    
    
    Solutions and Workarounds
    =========================
    
    
    The following instructions describe how to upgrade your zlib
    libraries by updating your source tree and rebuilding and
    installing a new version of zlib.
    
    * NetBSD-current:
    
    	Systems running NetBSD-current dated from before 2003-03-05
    	should be upgraded to NetBSD-current dated 2003-03-06 or later.
    
    	The following file needs to be updated from the
    	netbsd-current CVS branch (aka HEAD):
    		lib/libz/gzio.c
    
    	To update from CVS, re-build, and re-install libz:
    		# cd src
    		# cvs update -d -P lib/libz/gzio.c
    		# cd lib/libz
    
    		# make USETOOLS=no cleandir dependall
    		# make USETOOLS=no install
    
    
    * NetBSD 1.6:
    
    	The binary distribution of NetBSD 1.6 is vulnerable.   
    
    	Systems running NetBSD 1.6 sources dated from before
    	2003-03-05 should be upgraded from NetBSD 1.6 sources dated
    	2003-03-06 or later.
    
    	NetBSD 1.6.1 will include the fix.
    
    	The following file needs to be updated from the
    	netbsd-1-6 CVS branch:
    		lib/libz/gzio.c
    
    	To update from CVS, re-build, and re-install libz:
    
    		# cd src
    		# cvs update -d -P -r netbsd-1-6 lib/libz/gzio.c
    		# cd lib/libz
    
    		# make USETOOLS=no cleandir dependall
    		# make USETOOLS=no install
    
    
    	Alternatively, apply the following patch (with potential offset
    	differences):
    		ftp://ftp.netbsd.org/pub/NetBSD/security/patches/SA2003-004-zlib-1.6.patch
    
    	To patch, re-build and re-install zlib:
    
    		# cd src/lib/libz
    		# patch < /path/to/SA2003-004-zlib-1.6.patch
    
    		# make USETOOLS=no cleandir dependall
    		# make USETOOLS=no install
    
    
    * NetBSD 1.5, 1.5.1, 1.5.2, 1.5.3:
    
    	The binary distribution of NetBSD 1.5.3 is vulnerable.   
    
    	Systems running NetBSD 1.5, 1.5.1, 1.5.2, or 1.5.3 sources dated
    	from before 2003-03-05 should be upgraded from NetBSD 1.5.*
    	sources dated 2003-03-06 or later.
    
    	The following directories need to be updated from the
    	netbsd-1-5 CVS branch:
    		lib/libz/gzio.c
    
    	To update from CVS, re-build, and re-install zlib:
    
    		# cd src
    		# cvs update -d -P -r netbsd-1-5 lib/libz/gzio.c
    		# cd lib/libz
    
    		# make cleandir dependall
    		# make install
    
    
    	Alternatively, apply the following patch (with potential offset
    	differences):
    		ftp://ftp.netbsd.org/pub/NetBSD/security/patches/SA2003-004-zlib-1.5.patch
    
    	To patch, re-build and re-install zlib:
    
    		# cd src/lib/libz
    		# patch < /path/to/SA2003-004-zlib-1.5.patch
    
    		# make cleandir dependall
    		# make install
    
    
    Thanks To
    =========
    
    Bill Squier for patches, Lubomir Sedlacik for notification.
    
    
    Revision History
    ================
    
    	2003-03-26	Initial release
    
    
    More Information
    ================
    
    Advisories may be updated as new information becomes available.
    The most recent version of this advisory (PGP signed) can be found at 
      ftp://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2003-004.txt.asc
    
    Information about NetBSD and NetBSD security can be found at
    http://www.NetBSD.ORG/ and http://www.NetBSD.ORG/Security/.
    
    
    Copyright 2003, The NetBSD Foundation, Inc.  All Rights Reserved.
    Redistribution permitted only in full, unmodified form.
    
    $NetBSD: NetBSD-SA2003-004.txt,v 1.5 2003/03/26 18:07:22 david Exp $
    
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.0.6 (NetBSD)
    Comment: For info see http://www.gnupg.org
    
    iQCVAwUBPoHslT5Ru2/4N2IFAQHADgQAjFowBSBlBhoRSnKLnmakG17ZVLmpzIfj
    2zDnn7DhTsxzgL/6xsng/qzzMK3QTKqH3hP99ppJB1RmV58x8ACJsj0pQFc7wxTP
    D3N5QIxBPdOTfwKQrZTFa2jZnedN5rkjl0+iqBjiT78/j+NFY6OzpXH917VQNCv1
    QPx9qZR1eDA=
    =3ECP
    -----END PGP SIGNATURE-----
    



    This archive was generated by hypermail 2b30 : Wed Mar 26 2003 - 11:48:21 PST