-----BEGIN PGP SIGNED MESSAGE-----

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

            ESB-2003.0545 -- NetBSD Security Advisory 2003-011
                      off-by-one error in realpath(3)
                              06 August 2003

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

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

Product:                libc function: realpath(3)
Publisher:              NetBSD
Operating System:       NetBSD-current
                        NetBSD 1.6.1
                        NetBSD 1.6
Impact:                 Denial of Service
                        Execute Arbitrary Code/Commands
                        Increased Privileges
Access Required:        Remote
CVE Names:              CAN-2003-0466

Ref:                    AL-2003.13
                        ESB-2003.0540
                        ESB-2003.0535

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

- -----BEGIN PGP SIGNED MESSAGE-----


		 NetBSD Security Advisory 2003-011
		 =================================

Topic:		off-by-one error in realpath(3)

Version:	NetBSD-current:	source prior to August 4, 2003
		NetBSD 1.6.1:	affected
		NetBSD 1.6:	affected
		NetBSD-1.5.3:	affected
		NetBSD-1.5.2:	affected
		NetBSD-1.5.1:	affected
		NetBSD-1.5:	affected

Severity:	Possible remote buffer overrun/root compromise

Fixed:		NetBSD-current:		August 4, 2003
		NetBSD-1.6 branch:	August 5, 2003 (1.6.2 will include the fix)
		NetBSD-1.5 branch:	Awaiting pullups


Abstract
========

In the library function realpath(3), there was a string manipulation
mistake which could lead to 1-byte buffer overrun.  realpath(3) is
being used by important network daemons such as ftpd(8),
therefore the vulnerability could be remotely exploitable.

Note: The same error remained in a derived function in the distribution
of the wu-ftpd server (Not part of NetBSD's base system). This
information has been available to the general public for a matter of
days now. Exploits have been released against wu-ftpd. They are probably
being written against other affected services as well. If you offer any
of the affected services, you are advised to patch your system
immediately.


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

http://www.kb.cert.org/vuls/id/743092

Binaries in the NetBSD base system which use realpath(3) include:

/bin/systrace
/usr/libexec/ftpd (*)
/sbin/mount
/sbin/umount
/usr/sbin/mountd (*)
/usr/bin/ssh
/usr/sbin/sshd (*)
/usr/libexec/sftp-server (*)
/usr/sbin/bootpd (*)

Binaries marked (*) listen on network interfaces, and could be remotely
exploitable.


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

To fix this vulnerability you will need to upgrade your libc.

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

Note that all statically-linked binaries, such as the following, must be
rebuilt:
- - - binaries under /sbin and /bin for 1.5 and 1.6-based systems
- - - binaries under /rescue for NetBSD-current systems
- - - statically-linked binaries built by pkgsrc

Also, running instances of daemons must be restarted, if you do not plan
to reboot the machine after the update of libc.


* NetBSD-current:

	Systems running NetBSD-current dated from before 2003-08-03
	should be upgraded to NetBSD-current dated 2003-08-04 or later.

	The following directories need to be updated from the
	netbsd-current CVS branch (aka HEAD):
		lib/libc

	To update from CVS, re-build, and re-install libc and rescue:
		# cd src
		# cvs update -d -P lib/libc

		# cd lib/libc
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		# cd ../../rescue
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		(then, reboot, or restart affected daemons)

* NetBSD 1.6, 1.6.1:

	The binary distributions of NetBSD 1.6 and 1.6.1 are vulnerable.

	Systems running NetBSD 1.6 sources dated from before
	2003-08-04 should be upgraded from NetBSD 1.6 sources dated
	2003-08-05 or later.

	NetBSD 1.6.2 will include the fix.

	The following directories need to be updated from the
	netbsd-1-6 CVS branch:
		lib/libc

	To update from CVS, re-build, and re-install libc and static
	binaries:

		# cd src
		# cvs update -d -P -r netbsd-1-6 lib/libc

		# cd lib/libc
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		# cd ../../sbin
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		# cd ../bin
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		(then, reboot, or restart affected daemons)

        Alternatively, apply the following patch (with potential offset
        differences):
                ftp://ftp.netbsd.org/pub/NetBSD/security/patches/SA2003-011-realpath.patch

        To patch, re-build and re-install libc, and static binaries:

                # cd src
                # patch < /path/to/SA2003-011-realpath.patch

		# cd lib/libc
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		# cd ../../sbin
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		# cd ../bin
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		(then, reboot, or restart affected daemons)

* NetBSD 1.5, 1.5.1, 1.5.2, 1.5.3:

	The binary distributions of NetBSD 1.5, 1.5.1, 1.5.2, and 1.5.3
	are vulnerable.

	Changes have not yet been pulled up to the 1.5 source branch.

	Apply the following patch (with potential offset differences):
		ftp://ftp.netbsd.org/pub/NetBSD/security/patches/SA2003-011-realpath.patch

        To patch, re-build and re-install libc, and static binaries:

                # cd src
                # patch < /path/to/SA2003-011-realpath.patch

		# cd lib/libc
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		# cd ../../sbin
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		# cd ../bin
		# make USETOOLS=no cleandir dependall
		# make USETOOLS=no install

		(then, reboot, or restart affected daemons)


Thanks To
=========

CERT


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

	2003-08-04	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-011.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-011.txt,v 1.7 2003/08/04 16:02:47 david Exp $

- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see http://www.gnupg.org

iQCVAwUBPy6EcD5Ru2/4N2IFAQGJfgP9HXf/mfaGmp9y22PlfA+mxlTiTfb/9N8H
ovrKNKiETzFTSr1Ni/l4pqNrkYDRqyP1J4VnS/6wv1ewDYmIzXW1c98gM7+m792l
rgZSkaDWxLyPRUhQ8N3BLJKMHvMRdNWPuYwyL76QMVVVFmUo8vSlcH8PRNJrjD8K
FIhI6NQ3/+Q=
=do/K
- -----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.

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

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

iQCVAwUBPzBFOih9+71yA2DNAQE8PwP/Uq9SxtIfVhfzc2XO65U5AtDSFzbM0kgq
FS+yHgQ5wtnlDnuPKLvJI3YE9Ypb/aLNGrzy5sdQm5AlNYDQtFggD06enkxNKYdC
W9GQt7721nS3L2XGJeH7Kt8HiT7s8EKhbb0+djH116GRG9mB1tBFyJKkvXc2Wwpj
tZaKTwEWus8=
=zZ13
-----END PGP SIGNATURE-----