Operating System:

Published:

01 August 2002

Protect yourself against future threats.

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

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

                   ESB-2002.379 -- FreeBSD-SA-02:34.rpc
               Sun RPC XDR decoder contains buffer overflow
                               1 August 2002

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

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

Product:                Sun RPC
                        Sun XDR
Vendor:                 FreeBSD
Operating System:       All releases of FreeBSD up to and
                        including 4.6.1-RELEASE-p3
                        BSD
                        UNIX
                        Linux
Impact:                 Root Compromise
Access Required:        Remote

Ref:                    AL-2002.09

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

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

=============================================================================
FreeBSD-SA-02:34.rpc                                        Security Advisory
                                                          The FreeBSD Project

Topic:          Sun RPC XDR decoder contains buffer overflow

Category:       core
Module:         libc
Announced:      2002-07-31
Credits:        ISS X-Force
Affects:        All releases of FreeBSD up to and including 4.6.1-RELEASE-p3
Corrected:      2002-07-31 14:45:29 UTC (RELENG_4)
                2002-07-31 14:47:02 UTC (RELENG_4_6)
                2002-07-31 14:49:18 UTC (RELENG_4_5)
                2002-07-31 14:50:18 UTC (RELENG_4_4)
FreeBSD only:   NO

I.   Background

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 FreeBSD C runtime library (libc) contains an XDR encoder/decoder
derived from Sun's RPC implementation.

II.  Problem Description

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

III. Impact

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

Though no exploits are known to exist currently, many RPC-based
services run as the superuser (such as NFS, the NIS server, rpc.statd,
and others) and thus this vulnerability should be considered
high-risk.

No RPC-based services are enabled by default in FreeBSD installations.

IV.  Workaround

Do not run any RPC-based services.  The RPC-based services running
on a machine may be determined by:

  # rpcinfo -p <hostname>

To disable any RPC-based services at next boot, add (or change if it
is already present) the following lines in /etc/rc.conf:

  portmap_enable="NO"
  nfs_client_enable="NO"
  nfs_server_enable="NO"
  nis_client_enable="NO"
  nis_server_enable="NO"

V.   Solution

Do one of the following:

1) Upgrade your vulnerable system to 4.6-STABLE; or to the RELENG_4_6,
RELENG_4_5, or RELENG_4_4 security branch dated after the correction
date (4.6.1-RELEASE-p4, 4.5-RELEASE-p12, or 4.4-RELEASE-p19).

2) To patch your present system:

The following patch has been verified to apply to FreeBSD 4.4, 4.5,
and 4.6 systems.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:34/rpc.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:34/rpc.patch.asc

b) Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Recompile the operating system as described in
<URL:http://www.freebsd.org/doc/handbook/makeworld.html>.

Note that any statically linked applications that are not part of
the base system (i.e. from the Ports Collection or other 3rd-party
sources) must be recompiled if they use Sun RPC.

All affected applications must be restarted in order to use the
corrected library.  Though it is not required, rebooting may be the
easiest way to accomplish this.

VI.  Correction details

The following list contains the revision numbers of each file that was
corrected in FreeBSD.

Path                                                             Revision
  Branch
- - -------------------------------------------------------------------------
src/lib/libc/xdr/xdr_array.c
  RELENG_4                                                        1.8.2.2
  RELENG_4_6                                                     1.8.10.2
  RELENG_4_5                                                      1.8.8.2
  RELENG_4_4                                                      1.8.6.2
src/sys/conf/newvers.sh
  RELENG_4_6                                                1.44.2.23.2.9
  RELENG_4_5                                               1.44.2.20.2.13
  RELENG_4_4                                               1.44.2.17.2.18
- - -------------------------------------------------------------------------

VII. References

<URL:http://online.securityfocus.com/archive/1/285308>
<URL:http://bvlive01.iss.net/issEn/delivery/xforce/alertdetail.jsp?oid=20823>
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iQCVAwUBPUigCVUuHi5z0oilAQHdiAP8CcsDW7DufF7wYg0FcgoyQ2ugiBe21lgo
YfAGfRcfxPtoZcmMApK3I5jUd/MRWCxBT3+ZcwtKe/aNH4hFlcpfcH5WYLVlrCgH
5QuVRR8dUfF/cWr8ejPq6xjXysUd/jMZWRQjAV8pCr+ngGSeMUeXQshB71ZyA5nk
YrBUd7Uoenk=
=lwhC
- -----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 use any or all of this information is
the responsibility of each user or organisation, and should be done so in
accordance with site policies and procedures.

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 original authors 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/Information/advisories.html

If you believe that your system has been compromised, contact AusCERT or
your representative in FIRST (Forum of Incident Response and Security
Teams).

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

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key

iQCVAwUBPUlRfih9+71yA2DNAQGSZAP/Zgio7oHXD10A7koEaKz/RRUue2o5mXEC
yFDV9Pb/uWLMJU6yvxyVNe+ORKVUl1GiX0IbPFX1eeZQpSKaHTmxWdUdKgfS139F
EcCtOxrt+5gjYM7u5Bfh6LNW7D2BoG6aSCaA6fbNqWmSHxtuSI/GG3BLNuT0WrBc
ZRq1ZnsTKb0=
=ByFR
-----END PGP SIGNATURE-----