-----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 includes the fix) NetBSD-1.5 branch: August 1, 2002 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. The Automounter amd(8) and its query tool amq(8), and the rusers(1) 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 often run as the superuser, and the vulnerability in amd(8) could be exploitable. Again, no RPC-based services are enabled by default. Solutions and Workarounds ========================= The recent NetBSD 1.6 release is not vulnerable to this issue. A full upgrade to NetBSD 1.6 is the recommended resolution for all users able to do so. Many security-related improvements have been made, and indeed this release has been delayed several times in order to include fixes for a number of recent issues. If you do not run any of the affected RPC services (amd/amq/rusers) your system is not affected. However, we suggest you 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 BETAs and Release Candidates should be upgraded to the NetBSD 1.6 release. If a source-based point upgrade is required, sources from the NetBSD 1.6 branch dated 2002-08-02 or later should be used. 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. The NetBSD Release Engineering teams, for great patience and assistance in dealing with repeated security issues discovered recently. Revision History ================ 2002-08-01 Initial release 2002-08-02 1.5/1.6 branch info 2002-09-16 Re-release with updated information 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,v 1.13 2002/09/16 05:17:55 dan Exp $ -----BEGIN PGP SIGNATURE----- Version: 2.6.3ia Charset: noconv iQCVAwUBPYVqKj5Ru2/4N2IFAQGEYAP+K1lgLUVy/CrmvtRikjSv5UKYY4pAWAca fKwDpVlp/5q3kSc/b5NY7bgi7gUPVvbaW1v/PgfRIA47PBtAt7juvsnEDIO6IJ8M 9rDwfrikYdShm0R5ejxyIfu1CwjD9gWOvJ2xYGQ7XW67tLPG3udwa1B1UhWeQTnK 9OhEncw7mcw= =YcPw -----END PGP SIGNATURE-----