Subject: NetBSD Security Advisory 2002-011: Sun RPC XDR decoder contains buffer overflow
To: None <tech-security@netbsd.org, current-users@netbsd.org>
From: NetBSD Security Officer <security-officer@netbsd.org>
List: current-users
Date: 08/02/2002 09:57:46
-----BEGIN PGP SIGNED MESSAGE-----


		 NetBSD Security Advisory 2002-011
		 =================================

Topic:		Sun RPC XDR decoder contains buffer overflow

Version:	NetBSD-current:	source prior to August 1, 2002
		NetBSD-1.6 beta: affected
		NetBSD-1.5.3:	affected
		NetBSD-1.5.2:	affected
		NetBSD-1.5.1:	affected
		NetBSD-1.5:	affected
		NetBSD-1.4.*:	affected

severity:	Possible remote root compromise if RPC services
		are enabled

Fixed:		NetBSD-current:		August 1, 2002
		NetBSD-1.6 branch:	August 2, 2002 (1.6 will include the fix)
		NetBSD-1.5 branch:	August 1, 2002 (1.5.4 will include the fix)
		NetBSD-1.4 branch:	not yet


Abstract
========

Integer overflows exist in the RPC code in libc. These cause a buffer to
be mistakenly allocated too small, and then overflown.

amd and amq, the Automounter and its query tool, and the rusers client
binary use the flawed code in a way which could be exploitable.

Other uses of the RPC functions have been examined and are believed to
not be exploitable.

No RPC-based services are enabled by default.


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

Sun RPC is a remote procedure call framework which allows clients
to invoke procedures in a server process over a network somewhat
transparently.  XDR is a mechanism for encoding data structures for
use with RPC.  NFS, NIS, and many other network services are built
upon Sun RPC.

The NetBSD C runtime library (libc) contains an XDR encoder/decoder
derived from Sun's RPC implementation.

Any application using Sun RPC may be vulnerable to a heap buffer
overflow.  Depending upon the application, this vulnerability may be
exploitable and lead to arbitrary code execution.

An error in the calculation of memory needed for unpacking arrays in
the XDR decoder can result in a heap buffer overflow.

Though no exploits are known to exist currently, RPC-based services run
as the superuser, and the vulnerability in amd could be exploitable.

Again, no RPC-based services are enabled by default.


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

If you do not run any of the affected RPC services (amd/amq/rusers)
your system is not affected.  However, we suggest you to upgrade your
system to avoid running vulnerable RPC code by mistake.

The following instructions describe how to upgrade your libc (which
includes RPC code) by updating your source tree and rebuilding and
installing a new version of libc.

Note that if you have any statically-linked binaries that uses RPC,
you need to recompile them.

* NetBSD-current:

	Systems running NetBSD-current dated from before 2002-08-01
	should be upgraded to NetBSD-current dated 2002-08-01 or later.

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

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

		# cd lib/libc
		# make cleandir dependall
		# make install


* NetBSD 1.6 beta:

	Systems running NetBSD-1.6 branch dated from before 2002-08-02
	should be upgraded to NetBSD-1.6 branch dated 2002-08-02 or later.

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

	To update from CVS, re-build, and re-install libc:
		# cd src
		# cvs update -d -P -r netbsd-1-6 lib/libc/rpc

		# cd lib/libc
		# make cleandir dependall
		# make install


* NetBSD 1.5, 1.5.1, 1.5.2, 1.5.3:

	Systems running NetBSD-1.5 branch dated from before 2002-08-02
	should be upgraded to NetBSD-1.5 branch dated 2002-08-02 or later.

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

	To update from CVS, re-build, and re-install libc:
		# cd src
		# cvs update -d -P -r netbsd-1-5 lib/libc/rpc

		# cd lib/libc
		# make cleandir dependall
		# make install


* NetBSD 1.4, 1.4.1, 1.4.2, 1.4.3:

	The advisory will be updated to include instructions to remedy
	this problem for systems running the NetBSD-1.4 branch.


Thanks To
=========

CERT for notification.

Charles Hannum for scope analysis and commentary.

FreeBSD security-officers. Parts of the advisory text are based on
the FreeBSD advisory.


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

	2002-08-01	Initial release
	2002-08-02	1.5/1.6 branch info


More Information
================

An up-to-date PGP signed copy of this release will be maintained at
  ftp://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2002-011.txt.asc

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


Copyright 2002, The NetBSD Foundation, Inc.  All Rights Reserved.

$NetBSD: NetBSD-SA2002-011.txt.asc,v 1.2 2002/08/02 13:43:06 david Exp $

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

iQCVAwUBPUpQNz5Ru2/4N2IFAQEWTgP/Y985RBH4drGjfpS5tdMpWWtk372vjSG6
pu9mV/voqaOhMoRaxtYmh0BKxnWs+JFjEiXO0gWiUfEq7aTZt6DhBFX6ON01eZPw
/3ZwLR/PyeRjUHTLL0b+kfmkWWTU2LNuD9+aEeiUQmbGbkuc1JWqI/q62rtsHcEQ
IbegeQ2NM2Y=
=M6bA
-----END PGP SIGNATURE-----