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

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

                         ESB-2008.0224 -- [NetBSD]
                         file(1) Integer overflow
                             29 February 2008

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

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

Product:              file
Publisher:            NetBSD
Operating System:     NetBSD
Impact:               Execute Arbitrary Code/Commands
Access:               Remote/Unauthenticated
CVE Names:            CVE-2007-2799 CVE-2007-1536

Ref:                  ESB-2007.0194

Original Bulletin:    
 ftp://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2008-001.txt.asc

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

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


		 NetBSD Security Advisory 2008-001
		 =================================

Topic:		file(1) Integer overflow

Version:	NetBSD-current:		affected
		NetBSD 4.0:		not affected
		NetBSD 3.1.1:		not affected
		NetBSD 3.1		affected
		NetBSD 3.0:		affected
		NetBSD 3.0.3:		not affected
		NetBSD 3.0.2:		affected
		NetBSD 3.0.1:		affected
		NetBSD 3.0:		affected
		NetBSD 2.1		affected
		NetBSD 2.0.*		affected

Severity:	Local code execution

Fixed:		NetBSD-current:		June 7, 2007
		NetBSD-3-1 branch:	June 24, 2007
		NetBSD-3-0 branch:	June 24, 2007
		NetBSD-3 branch:	June 24, 2007
			(3.2 will include the fix)
		pkgsrc:			file-4.2.1 corrects the issue


Abstract
========

An integer underflow was initially fixed in file 4.20 and soon after, a 
new integer overflow was identified in the original fix. To address the 
latest issue file 4.21 was release.  Either of these issues could result 
in local code execution if using file(1) on a maliciously crafted file.

This vulnerability has been assigned CVE reference CVE-2007-1536 for the 
initial issue and CVE-2007-2799 for the issue in the initial fix.


Technical Details
=================

An integer underflow was found in file_printf() which can lead to an
exploitable heap overflow.  The initial fix for this issue was found
to introduce an integer overflow which could again lead to code execution.
An updated patch was released as a part of file(1) 4.21.


Solutions and Workarounds
=========================

It is recommended that NetBSD users of vulnerable versions update
their binaries.

The following instructions describe how to upgrade your file(1)
binaries by updating your source tree and rebuilding and
installing a new version of file(1).

* NetBSD-current:

	Systems running NetBSD-current dated from before 2007-06-07
	should be upgraded to NetBSD-current dated 2007-06-08 or later.

	The following files/directories need to be updated from the
	netbsd-current CVS branch (aka HEAD):
		dist/file
		distrib/sets/lists/base/shl.elf
		distrib/sets/lists/base/shl.mi
		lib/Makefile
		lib/libmagic/Makefile
		lib/libmagic/config.h
		lib/libmagic/shlib_version
		tools/file/Makefile
		usr.bin/file/Makefile

	To update from CVS, re-build, and re-install file:

		# cd src
		# cvs update -d -P dist/file
		# cvs update -r distrib/sets/lists/base/shl.elf \
			distrib/sets/lists/base/shl.mi \
			lib/Makefile \
			lib/libmagic/Makefile \
			lib/libmagic/config.h \
			lib/libmagic/shlib_version \
			tools/file/Makefile \
			usr.bin/file/Makefile
		# cd usr.bin/file
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

* NetBSD 3.*:

	Systems running NetBSD 3.* sources dated from before
	2007-06-24 should be upgraded from NetBSD 3.* sources dated
	2007-06-25 or later.

	The following files/directories need to be updated from the
	netbsd-3, netbsd-3-0 or netbsd-3-1 branches:
		dist/file
		distrib/sets/lists/base/shl.elf
		distrib/sets/lists/base/shl.mi
		lib/Makefile
		lib/libmagic/Makefile
		lib/libmagic/config.h
		lib/libmagic/shlib_version
		tools/file/Makefile
		usr.bin/file/Makefile

	To update from CVS, re-build, and re-install file:

		# cd src
		# cvs update -d -P dist/file
		# cvs update -r distrib/sets/lists/base/shl.elf \
			distrib/sets/lists/base/shl.mi \
			lib/Makefile \
			lib/libmagic/Makefile \
			lib/libmagic/config.h \
			lib/libmagic/shlib_version \
			tools/file/Makefile \
			usr.bin/file/Makefile
		# cd usr.bin/file
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install


Thanks To
=========

Christos Zoulas and Antti Kantee for patches, importing fixes and testing.


Revision History
================

	2008-02-28	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-SA2008-001.txt.asc

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.org/ and http://www.NetBSD.org/Security/.


Copyright 2008, The NetBSD Foundation, Inc.  All Rights Reserved.
Redistribution permitted only in full, unmodified form.

$NetBSD: NetBSD-SA2008-001.txt,v 1.3 2008/02/28 19:27:42 adrianp Exp $

- -----BEGIN PGP SIGNATURE-----

iQCVAwUBR8cLbz5Ru2/4N2IFAQI7VwP+KDlsvnFkH6fo07u+r1sYKQnGTVi7/tdA
i6mH7H5pAch+g5SlbtauE+6qQWLMA95N9g+I1l5QvBbXmz6czgQyfgQuAQ/JAyLE
c+hiHn+JdOTVPiZ/e5rpeOCIVDGznncm2zpMM5dUtoAlmXOITJTXSkCd00G0ofpM
jzAT1lK/AdA=
=+sib
- -----END PGP SIGNATURE-----

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

iQCVAwUBR8dn8Sh9+71yA2DNAQJUMgP/dkQlIGrd9OF0QfRq4y6AadkCJlAGezO0
gXxsKYbtz+N1QVGH3lLyfe/aLuzsSgqI7FhsyY4CuTsM6EMppq1k2GOSEUUGUcKG
vbWNbZoV8x3uwxdEDI3vKXoSnNT+ZpmczHsUA7MbCz6brWaOVhMm9MTiM3ueisXq
pg/EK1RFIF4=
=4TMh
-----END PGP SIGNATURE-----