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

=============================================================================
CERT(sm) Advisory CA-96.08                       
Original issue date: April 18, 1996
Last revised: August 30, 1996
              Information previously in the README was inserted
              into the advisory. Appendix B was moved to Sec. III.C.

              A complete revision history is at the end of this file.

Topic: Vulnerabilities in PCNFSD
- -----------------------------------------------------------------------------

The CERT Coordination Center has received reports of two
vulnerabilities in the pcnfsd program (pcnfsd is also known as
rpc.pcnfsd); we have also received reports that these problems are
being exploited. These vulnerabilities are present in some
vendor-provided versions of pcnfsd and in some publicly available
versions.

These two vulnerabilities were reported by Avalon Security Research in
reports entitled "pcnfsd."

If you are using a vendor-supplied version of pcnfsd, please see the
vendor information in Section III.A and Appendix A. Until you can install
a patch from your vendor for these vulnerabilities, consider using the
publicly available version described in Section III.B.

If you already use or plan to switch to a public version, we urge you
to use the version cited in Section III.B or install the patch
described in Section III.C. This patch has already been incorporated
into the pcnfsd version described in III.B. There are many different
public domain versions of pcnfsd, and we have not analyzed the
vulnerability of those versions. We have analyzed and fixed the
problems noted in this advisory only in the version described in III.B.

We will update this advisory as we receive additional information.
Please check advisory files regularly for updates that relate to your site.

- -----------------------------------------------------------------------------

I.   Description

     The pcnfsd program (also called rpc.pcnfsd) is an authentication and
     printing program that runs on a UNIX server. There are many publicly
     available versions, and several vendors supply their own version.

     pcnfsd supports a printing model that uses NFS to transfer files from
     a client to the pcnfsd server. (Note: pcnfsd does *not* provide NFS
     services.)  When a client wants to print a file, it requests the path
     to a spool directory from the server. The client then writes the necessary
     files for printing using NFS, and informs the pcnfsd server that the
     files are ready for printing. 
          
     pcnfsd creates a subdirectory for each of its clients using the client's
     hostname, then returns this path name to the client. The returned path
     name must be exported via to its clients by the NFS server. The
     NFS server and the pcnfsd server may be two separate machines.

     The first vulnerability is that pcnfsd, which runs as root, creates the
     aforementioned directories with mkdir(2) and then changes their mode
     with chmod(2) to mode 777. If the target directory is replaced with a
     symbolic link pointing to a restricted file or directory, the mkdir(2)
     will fail but the chmod(2) will succeed. This means that the target of
     the symbolic link will be mode 777. 

     Note that pcnfsd must run as root when servicing print requests so that
     it can assume the identity of the PC user when interacting with UNIX
     print commands. On some systems, pcnfsd may also have to run as root so
     it can read restricted files when carrying out authentication tasks.

     The second vulnerability is that pcnfsd calls the system(3) subroutine
     as root, and the string passed to system(3) can be influenced by the
     arguments given in the remote procedure call. Remote users can execute
     arbitrary commands on the machine where pcnfsd runs.


II.  Impact

     For the first vulnerability, local users can change the permissions on
     any file accessible to the local system that the root user can change.
     For the second vulnerability, remote users can execute arbitrary commands
     as root on the machine where pcnfsd runs. 

     The impact is that directories can become world writable (mode 777). What
     this can lead to is bounded by the creativity of the intruder. For
     example, once the mode of /etc were changed to mode 777, one could then
     replace the password file, and then go on from there.

     Exploitation of these vulnerabilities is only part of a larger attack
     scenario. Once exploited, there are many pathologies that could follow.


III. Solution

     If you are using pcnfsd from a vendor, consult the vendor list in
     Section A. If your vendor is not listed, we recommend that you
     contact your vendor directly. 
     
     Until a vendor patch is available, we recommend that you obtain the
     publicly available version of pcnfsd as described in Section B. This
     version already has the patch described in Section C. 
     
     If you are presently using a public version of pcnfsd, we recommend
     that you either change to the version listed in Section B or apply the
     patch described in Section C. (The version in Section B already contains
     this patch.)

     A.  Obtain and install the appropriate patch according to the
         instructions included with the patch.

         Below is a list of the vendors who have reported to us as of the date
         of this advisory. More complete information, is provided in the
         appendix. We will update the appendix as we receive more information.

         If your vendor's name is not on this list, please contact the vendor
         directly.

         Vendor or Source          Status
         ----------------          ------------
         BSDI BSD/OS               Vulnerable. Patch available.
         Hewlett Packard           Vulnerable. Patch under development.
         IBM AIX 3.2               Vulnerable. Patches available.
         IBM AIX 4.1               Vulnerable. Patches available.
         NEXTSTEP                  Vulnerable. Will be fixed in version 4.0.
         SCO OpenServer 5          Vulnerable. Patch under development.
         SCO UnixWare 2.1          Vulnerable. Patch under development.
         SGI IRIX 5.3              Vulnerable. Patch under development.
         SGI IRIX 6.2              Not vulnerable.


     B.  Until you are able to install the appropriate patch, we recommend
         that you obtain a version of pcnfsd from one of the following
         locations. This version already has the patch mentioned in 
         Section III.C.

     ftp://ftp.cert.org/pub/tools/pcnfsd/pcnfsd.93.02.16-cert-dist.tar.Z
     ftp://ftp.cert.dfn.de/pub/tools/net/pcnfsd/pcnfsd.93.02.16-cert-dist.tar.Z

     MD5 (pcnfsd.93.02.16-cert-dist.tar.Z) = b7af99a07dfcf24b3da3446d073f8649

         Build, install, and restart rpc.pcnfsd. 

         Ensure that the mode of the top-level pcnfsd spool directory is 755.
         In this version of pcnfsd, the top level spool directory is
         /usr/spool/pcnfs. To change this to mode 755, do the following as
         root:  

                chmod 755 /usr/spool/pcnfs

         
     C.  A patch is available for the two vulnerabilities described
         in this advisory. Apply the patch using the GNU patch utility or
         by hand as necessary. Rebuild, reinstall, and restart rpc.pcnfsd.
         Set the mode of the top-level pcnfsd spool directory to 755.

         For example, in the version of pcnfsd cited in Section B, the top
         level spool directory is /usr/spool/pcnfs. To change this to mode
         755, do the following as root: 

                chmod 755 /usr/spool/pcnfs
                
         Below is the location of a version of the patch that is an
         improvement over the patch originally cited in the advisory. The
         modifications are in the suspicious() function in pcnfsd_misc.c.,
         courtesy of Sun Microsystems, Inc.  

         To prevent any confusion concerning the checksums, please see the file
         README.pcnfsd.93.02.16-cert.  Checksums are also included below:

      ftp://info.cert.org/pub/tools/pcnfsd/README.pcnfsd.93.02.16-cert
      MD5 (README.pcnfsd.93.02.16-cert) = 07c64cd714bfaab3eb3849439a615b79

      ftp://info.cert.org/pub/tools/pcnfsd/pcnfsd.93.02.16-cert-dist.tar.Z
      MD5 (pcnfsd.93.02.16-cert-dist.tar.Z) = dc9b50172dfba8e6f9ad0c83f0e087e8

      Note: When the above file is unpacked, the md5 checksum referenced
          in the README.pcnfsd.93.02.16-cert matches the following:

          MD5 (pcnfsd.93.02.16-cert.tar) = 3a33f392d66b166cbc630275d8aba6f7

          ftp://info.cert.org/pub/tools/pcnfsd/pcnfsd_misc.c-diffs
          MD5 (pcnfsd_misc.c-diffs) = e9a83e6d540ab4683767ecf6d66dda9d

          ftp://info.cert.org/pub/tools/pcnfsd/pcnfsd_print.c-diffs
          MD5 (pcnfsd_print.c-diffs) = 7d9dac3c14b258e855517894e2934b14

.........................................................................     
Appendix A: Vendor Information

Below is information we have received from vendors concerning the
vulnerability described in this advisory. If you do not see your vendor's
name, please contact the vendor directly for information.

Berkeley Software Design, Inc. (BSDI)
=====================================
The problem described in these vulnerabilities is present in all versions
of BSD/OS.  There is a patch (our patch number U210-007) for our 2.1 version
of BSD/OS and associated products available from our patch and ftp servers
<patches@BSDI.> or ftp://ftp.BSDI.COM/bsdi/patches/patches-2.1/U210-007


Data Design Systems, Inc.
=========================
The Tandem NonStop Kernel (NSK) system, does NOT contain either of the
vulnerabilities cited in the advisory.


Digital Equipment Corporation
=============================

For updated information, please refer to the Digital Equipment
Corporation Vendor Bulletin #96.0383, available in

         ftp://info.cert.org/pub/vendors/dec/dec_96.0383

Note:  Non-contract/non-warranty customers should contact
       local Digital support channels for information
       regarding these kits.

As always, Digital urges you to periodically review your system
management and security procedures. Digital will continue to review
and enhance the security features of its products and work with
customers to maintain and improve the security and integrity of their
systems.


FreeBSD Inc.
===========

There are two seperate ways of upgrading. The patch listed below
is a source code patch, and is available from:

    ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current/ports/net/pcnfsd/patches/patch-ad

    MD5 (patch-ad) = 6dfdf6229632e53cb060961ac09bbd1a


This is part of the ports collection and anyone using current
revisions of the ports system will automatically have this patch
applied.

You can also get a FreeBSD "package" (pre-compiled binary) from:

   ftp://ftp.FreeBSD.ORG/pub/FreeBSD/packages-current/net/pcnfsd-93.02.16.tgz

   MD5 (pcnfsd-93.02.16.tgz) = 59c54dae46d1b4fd41887877b0a7097a


Hewlett-Packard Company
=======================

   1. The rpc.pcnfsd binary that ships with HP systems contains a
      vulnerability that could allow a user to change permissions on a
      restricted file or directory.

      Hewlett Packard is delivering a set of operating system dependent
      patches which contain a new version of rpc.pcnfsd.  Accompanying
      each patch is a README file which discusses the general purpose
      of the patch and describes how to apply it to your system.

      Recommended solution:

      Apply one of the following patches based on your system hardware
      and operating system revision:

      s300/s400 9.X  - PHNE_7371 (rpc.pcnfsd)
      s700/s800 9.X  - PHNE_7072 (NFS Megapatch)
      s700/s800 10.X - PHNE_7073 (NFS Megapatch)

      The patches described above provide a new version of the
      rpc.pcnfsd executable which fixes the vulnerability.


   2. The rpc.pcnfsd binary that ships with most Unix systems contains
      a vulnerability that could allow users to execute arbitrary
      commands on the machine where pcnfsd runs.

      The rpc.pcnfsd daemon that ships with Hewlett Packard systems
      does not make the system call that allows this vulnerability.
      Since HP systems are not vulnerable - there is no fix!

To subscribe to automatically receive future NEW HP Security Bulletins
please refer to information in

         ftp://info.cert.org/pub/vendors/hp/HP.contact_info


IBM Corporation
===============
  See the appropriate release below to determine your action.


  AIX 3.2
  -------
    Apply the following fixes to your system:

       APAR - IX57623 (PTF - U442633)
       APAR - IX56965 (PTF - U442638)

    To determine if you have these PTFs on your system, run the following
    commands:

       lslpp -lB U442633
       lslpp -lB U442638


  AIX 4.1
  -------
    Apply the following fixes to your system:

        APAR - IX57616
        APAR - IX56730

    To determine if you have these APARs on your system, run the following
    commands:

       instfix -ik IX57616
       instfix -ik IX56730


  To Order
  --------
    APARs may be ordered using FixDist or from the IBM Support Center.
    For more information on FixDist, reference URL:

       http://service.software.ibm.com/aixsupport/

    or send e-mail to aixserv@austin.ibm.com with a subject of "FixDist".


  IBM and AIX are registered trademarks of International Business Machines
  Corporation.


NEC Corporation
===============

Some systems are vulnerable and patches are available through
anonymous FTP from ftp://ftp.meshnet.or.jp in the /pub/48pub/security
directory.

UP-UX/V (Rel4.2MP) R5.x   NECu5s003.COM.pkg
                            /pub/48pub/security/up/r5/pkg
                            Results of sum = 3060 266
                                       md5 = 79E626B99A55FB0DBCE6EE642874570A
                    R6.x   NECu6s003.COM.pkg
                            /pub/48pub/security/up/r6/pkg
                            Results of sum = 47304 272
                                       md5 = 9FC9E993A5AB51291BF4817D3D70FBFD
                    R7.x   NECu7s003.COM.pkg
                            /pub/48pub/security/up/r7/pkg
                            Results of sum = 46470 291
                                       md5 = 59CA6887078AF88EA165AFD3BF5A1374

 EWS-UX/V(Rel4.2)   R7.x   NECe7s004.COM.pkg
                            /pub/48pub/security/ews/r7/pkg
                            Results of sum = 3827 194
                                       md5 = 4D40D9258DAB7EA41C30789609818330

                    R8.x   NECe8s004.COM.pkg
                            /pub/48pub/security/ews/r8/pkg
                            Results of sum = 24399 199
                                       md5 = 40B4CB1140791C14D1B604B6E8CB5FCB

                    R9.x(except EWS4800/110N)
                            NECe9s008.COM.pkg
                            /pub/48pub/security/ews/r9/pkg
                            Results of sum = 23250 203
                                       md5 = 5AD8BED137AAE7D0067EF3120574786C

                    R9.x(EWS4800/110N)
                           NECe9s007.COM.pkg
                            /pub/48pub/security/ews/r9n/pkg
                            Results of sum = 3972 201
                                       md5 = 28B2FA99F5200F81C5465571EF27E08B

                    R10.x  NECeas004.COM.pkg
                            /pub/48pub/security/ews/ran/pkg
                            Results of sum = 51969 205
                                       md5 = B6E12017E66DC8DC38FBE78CA1F0B0F0

 EWS-UX/V (Rel4.2MP) R10.x  NECmas007.COM.pkg
                            /pub/48pub/security/ews/ra/pkg
                            Results of sum = 48060 291
                                       md5 = 42F8AE832071F033E21D8718A3670D76

 UX/4800             R11.x  NECmbs010.COM.pkg
                            /pub/48pub/security/ews/rb/pkg
                           Results of sum = 24885 335
                                       md5 = 7A14CBE4EA9B2470E340B5EEFD523F95

For further information contact:  UX48-security-support@nec.co.jp.
We encourage you contact the vendor directly if you have any questions.


NeXT Software, Inc.
===================
NEXTSTEP is vulnerable.  This will be fixed in the 4.0 release of
OpenStep for Mach (aka NEXTSTEP 4.0, due out 2Q96).


Novell
======

CERT staff do not know whether Novell's enhanced version of PCNFSD
(LWPNFSD) is vulnerable to this problem.  We encourage you contact the
vendor directly if you have any questions.


The Santa Cruz Operation, Inc.
==============================
Patches for pcnfsd are currently being developed for the 
following releases:

SCO OpenServer 5
SCO UnixWare 2.1.

These releases, as well as all prior releases, are vulnerable to 
both issues mentioned in the advisory. Should you not need to use 
pcnfs, SCO recommends that you not run pcnfsd. This can be done 
by commenting out pcnfsd in the appropriate script that starts
pcnfsd, located in /etc/rc2.d.

This CERT advisory will be updated when further patch 
information is available.


Silicon Graphics Corporation
============================

pcnfsd was only released for IRIX 5.3 and IRIX 6.2.
SGI is producing patch1179 for IRIX 5.3.
IRIX 6.2 is not vulnerable.


Sun Microsystems, Inc.
======================
Sun has made patches available:

                Solaris 2.4, 2.5 (Sparc)        103095-02
                Solaris 2.4, 2.5 (X86)          103457-01
                SunOS 4.1.X                     103096-02


TGV Software, Inc./Cisco Systems, Inc.
======================================

These vulnerabilities are UNIX-specific and are not present in any version
of MultiNet for OpenVMS.


- ---------------------------------------------------------------------------
The CERT Coordination Center thanks Josh D., Ben G., and Alfred H. of
Avalon Security Research for providing information for this advisory.
We thank Wolfgang Ley of DFN-CERT for his help in understanding these
problems.
- ---------------------------------------------------------------------------

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

We strongly urge you to encrypt any sensitive information you send by email.
The CERT Coordination Center can support a shared DES key and PGP. Contact the
CERT staff for more information. 

Location of CERT PGP key
         ftp://info.cert.org/pub/CERT_PGP.key

CERT Contact Information
- ------------------------
Email    cert@cert.org

Phone    +1 412-268-7090 (24-hour hotline)
        CERT personnel answer 8:30-5:00 p.m. EST
        (GMT-5)/EDT(GMT-4), and are on call for
                emergencies during other hours.

Fax      +1 412-268-6989

Postal address
        CERT Coordination Center
        Software Engineering Institute
        Carnegie Mellon University
        Pittsburgh PA 15213-3890
        USA

CERT publications, information about FIRST representatives, and other
security-related information are available for anonymous FTP from
        http://www.cert.org/
        ftp://info.cert.org/pub/

CERT advisories and bulletins are also posted on the USENET newsgroup
        comp.security.announce

To be added to our mailing list for CERT advisories and bulletins, send your
email address to
        cert-advisory-request@cert.org


Copyright 1996 Carnegie Mellon University
This material may be reproduced and distributed without permission provided it
is used for noncommercial purposes and the copyright statement is included.

CERT is a service mark of Carnegie Mellon University.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Revision history

Aug. 30, 1996  Information previously in the README was inserted into the
               advisory. Appendix B was moved to Sec. III.C.
               Appendix A - updated IBM URL in "To Order" section.
Aug. 01, 1996  Appendix A - updated Hewlett-Packard patch information.
July 26, 1996  Appendix A - modified NEC patch information.
July 5, 1996   Appendix A - added pointer to updated vendor information for
               Digital Equipment Corporation.
June 26, 1996  Appendix A - updated vendor information for NEC.
               Appendix A - added vendor information for Data Design
               Systems, Inc.
May 8, 1996    Appendix A - added patch information for FreeBSD.
May 6, 1996    Section II -added additional clarification about the
               impact of the vulnerability described.
               Appendix B - replaced the patch information originally
               contained in Appendix B with updated information.
               Appendix A - added updates for Digital Equipment
               Corporation, Novell, Sun Microsystems, Inc,
               and TGV Software, Inc./Cisco Systems, Inc.
Apr. 23, 1996  Appendix A - added information from NEC Corporation.
Apr. 19, 1996  Appendix B - new information on the fix referred to
               in Appendix B of the advisory.


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMicOb3VP+x0t4w7BAQFnogQA1m7c5G2R6k3vmQIVPlwLpcS3FSevFAQS
98/5hl6aB9gDpQX0dXp9RWWFrk2PYCme122RTOMWCSuLJKCA569CMNH83f2PAo4j
sZK4+P8KmAjihi9/zfZPva34YxPA4D9rHzk9Bl0Y5qfbB86vltBPAhMQ81sgnE/5
oJNaDAaZGyM=
=cG/E
-----END PGP SIGNATURE-----
