TUCoPS :: Unix :: General :: ciacg021.txt

Vulnerabilities pcnfsd



             __________________________________________________________

                       The U.S. Department of Energy
                    Computer Incident Advisory Capability
                           ___  __ __    _     ___
                          /       |     /_\   /
                          \___  __|__  /   \  \___
             __________________________________________________________

                             INFORMATION BULLETIN

                       Vulnerabilities in PCNFSD Program

April 22, 1996 17:00 GMT                                           Number G-21
______________________________________________________________________________
PROBLEM:       Two vulnerabilities exist in the pcnfsd program. 
PLATFORM:      The pcnfsd program (also called rpc.pcnfsd) runs on a UNIX 
               server. 
DAMAGE:        The first vulnerability allows local users to change the 
               permissions on any file accessible to the local system that the 
               root user can change. The second vulnerability allows remote 
               users to execute arbitrary commands as root on the machine 
               where pcnfsd runs. 
SOLUTION:      Check for vulnerabilities and install the proper patch. If 
               patch is unavailable from vendor, consider using the public 
               available version describe below. 
______________________________________________________________________________
VULNERABILITY  Knowledge of how to exploit these vulnerabilities are widely 
ASSESSMENT:    known. 
______________________________________________________________________________

CIAC has obtained information from CERT pertaining to the vulnerabilities 
in the pcnfsd program. CIAC recommends that you install the proper patch 
and/or follow the solutions described below. 

[ Start of CERT Advisory ]

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. 
     

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, including how to obtain
         patches, is provided in the  appendix of this advisory and reproduced
         in the CA-96.xx.README file. We will update the README file 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 and included in Appendix B.

     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.  Appendix B contains a patch 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
                

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

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

Current as of April 18, 1996
See CA-96.08.README for updated 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


Hewlett-Packard Company
=======================
Patches in process, watch for HP an security bulletin for this
vulnerability.


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://aix.boulder.ibm.com/pbin-usa/fixdist.pl/

    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.


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


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.

The README file for this 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.


.........................................................................     
Appendix B: Patch Information

Here is the patch for pcnfsd_print.c. It is also available as:

        ftp://ftp.cert.org/pub/tools/pcnfsd/pcnfsd_print.c.diffs
        ftp://ftp.cert.dfn.de/pub/tools/net/pcnfsd/pcnfsd_print.c.diffs

        MD5 (pcnfsd_print.c-diffs) = ec44046ff5c769aa5bf2d8d155b61f1f

---------------------------------CUT HERE---------------------------------
*** /tmp/T0a002c1       Fri Apr  5 13:14:50 1996
--- pcnfsd_print.c      Fri Apr  5 13:14:46 1996
***************
*** 221,226 ****
--- 221,227 ----
  {
  int    dir_mode = 0777;
  int rc;
+ mode_t oldmask;
  
        *sp = &pathname[0];
        pathname[0] = '\0';
***************
*** 231,241 ****
        /* get pathname of current directory and return to client */
  
        (void)sprintf(pathname,"%s/%s",sp_name, sys);
        (void)mkdir(sp_name, dir_mode); /* ignore the return code */
-       (void)chmod(sp_name, dir_mode);
        rc = mkdir(pathname, dir_mode); /* DON'T ignore this return code */
        if((rc < 0 && errno != EEXIST) ||
-          (chmod(pathname, dir_mode) != 0) ||
           (stat(pathname, &statbuf) != 0) ||
           !(statbuf.st_mode & S_IFDIR)) {
           (void)sprintf(tempstr,
--- 232,242 ----
        /* get pathname of current directory and return to client */
  
        (void)sprintf(pathname,"%s/%s",sp_name, sys);
+       oldmask = umask(0);
        (void)mkdir(sp_name, dir_mode); /* ignore the return code */
        rc = mkdir(pathname, dir_mode); /* DON'T ignore this return code */
+       umask(oldmask);
        if((rc < 0 && errno != EEXIST) ||
           (stat(pathname, &statbuf) != 0) ||
           !(statbuf.st_mode & S_IFDIR)) {
           (void)sprintf(tempstr,
***************
*** 381,387 ****
                   ** filter with the appropriate arguments.
                     **------------------------------------------------------
                   */
!                  (void)run_ps630(new_pathname, opts);
                   }
                /*
                ** Try to match to an aliased printer
--- 382,391 ----
                   ** filter with the appropriate arguments.
                     **------------------------------------------------------
                   */
!                  (void)sprintf(tempstr,
!                       "rpc.pcnfsd: ps630 filter disabled for %s\n", 
                        pathname);
!                       msg_out(tempstr);
!                       return(PS_RES_FAIL);
                   }
                /*
                ** Try to match to an aliased printer
---------------------------------CUT HERE---------------------------------

[ End of CERT Advisory ]

_______________________________________________________________________________

CIAC wishes to acknowledge the contributions of CERT for the 
information contained in this bulletin.
_______________________________________________________________________________


CIAC, the Computer Incident Advisory Capability, is the computer
security incident response team for the U.S. Department of Energy
(DOE) and the emergency backup response team for the National
Institutes of Health (NIH). CIAC is located at the Lawrence Livermore
National Laboratory in Livermore, California. CIAC is also a founding
member of FIRST, the Forum of Incident Response and Security Teams, a
global organization established to foster cooperation and coordination
among computer security teams worldwide.

CIAC services are available to DOE, DOE contractors, and the NIH. CIAC
can be contacted at:
    Voice:    +1 510-422-8193
    FAX:      +1 510-423-8002
    STU-III:  +1 510-423-2604
    E-mail:   ciac@llnl.gov

For emergencies and off-hour assistance, DOE, DOE contractor sites,
and the NIH may contact CIAC 24-hours a day. During off hours (5PM -
8AM PST), call the CIAC voice number 510-422-8193 and leave a message,
or call 800-759-7243 (800-SKY-PAGE) to send a Sky Page. CIAC has two
Sky Page PIN numbers, the primary PIN number, 8550070, is for the CIAC
duty person, and the secondary PIN number, 8550074 is for the CIAC
Project Leader.

Previous CIAC notices, anti-virus software, and other information are
available from the CIAC Computer Security Archive.

   World Wide Web:      http://ciac.llnl.gov/
   Anonymous FTP:       ciac.llnl.gov (128.115.19.53)
   Modem access:        +1 (510) 423-4753 (28.8K baud)
                        +1 (510) 423-3331 (28.8K baud)

CIAC has several self-subscribing mailing lists for electronic
publications:
1. CIAC-BULLETIN for Advisories, highest priority - time critical
   information and Bulletins, important computer security information;
2. CIAC-NOTES for Notes, a collection of computer security articles;
3. SPI-ANNOUNCE for official news about Security Profile Inspector
   (SPI) software updates, new features, distribution and
   availability;
4. SPI-NOTES, for discussion of problems and solutions regarding the
   use of SPI products.

Our mailing lists are managed by a public domain software package
called ListProcessor, which ignores E-mail header subject lines. To
subscribe (add yourself) to one of our mailing lists, send the
following request as the E-mail message body, substituting
CIAC-BULLETIN, CIAC-NOTES, SPI-ANNOUNCE or SPI-NOTES for list-name and
valid information for LastName FirstName and PhoneNumber when sending

E-mail to       ciac-listproc@llnl.gov:
        subscribe list-name LastName, FirstName PhoneNumber
  e.g., subscribe ciac-notes OHara, Scarlett W. 404-555-1212 x36

You will receive an acknowledgment containing address, initial PIN,
and information on how to change either of them, cancel your
subscription, or get help.

PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing
communities receive CIAC bulletins.  If you are not part of these
communities, please contact your agency's response team to report
incidents. Your agency's team will coordinate with CIAC. The Forum of
Incident Response and Security Teams (FIRST) is a world-wide
organization. A list of FIRST member organizations and their
constituencies can be obtained by sending email to
docserver@first.org with an empty subject line and a message body
containing the line: send first-contacts.

This document was prepared as an account of work sponsored by an
agency of the United States Government. Neither the United States
Government nor the University of California nor any of their
employees, makes any warranty, express or implied, or assumes any
legal liability or responsibility for the accuracy, completeness, or
usefulness of any information, apparatus, product, or process
disclosed, or represents that its use would not infringe privately
owned rights. Reference herein to any specific commercial products,
process, or service by trade name, trademark, manufacturer, or
otherwise, does not necessarily constitute or imply its endorsement,
recommendation or favoring by the United States Government or the
University of California. The views and opinions of authors expressed
herein do not necessarily state or reflect those of the United States
Government or the University of California, and shall not be used for
advertising or product endorsement purposes.

LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC)

(G-11)  HP Syslog Vulnerability
(G-12)  SGI ATT Packaging Utility Security Vulnerability
(G-13)  Kerberos Version 4 Key Server Vulnerability
(G-14)  Domain Name Service Vulnerabilities
(G-15)  Sunsoft Demo CD Vulnerability
(G-16)  SGI rpc.statd Program Security Vulnerabilities
(G-17)	Vulnerabilities in Sample HTTPD CGIs
(G-18)	Digital OSF/1 dxconsole Security Vulnerability
(G-19)	IBM AIX rmail Vulnerability
(G-20)	Vulnerability in NCSA and Apache httpd Servers

RECENT CIAC NOTES ISSUED (Previous Notes available from CIAC)

Notes 07 - 3/29/95     A comprehensive review of SATAN

Notes 08 - 4/4/95      A Courtney update

Notes 09 - 4/24/95     More on the "Good Times" virus urban legend

Notes 10 - 6/16/95     PKZ300B Trojan, Logdaemon/FreeBSD, vulnerability
                       in S/Key, EBOLA Virus Hoax, and Caibua Virus

Notes 11 - 7/31/95     Virus Update, Hats Off to Administrators,
                       America On-Line Virus Scare, SPI 3.2.2 Released, 
                       The Die_Hard Virus

Notes 12 - 9/12/95     Securely configuring Public Telnet Services, X
                       Windows, beta release of Merlin, Microsoft Word
                       Macro Viruses, Allegations of Inappropriate Data
                       Collection in Win95

Notes 96-01 - 3/18/96  Java and JavaScript Vulnerabilities, FIRST
                       Conference Announcement, Security and Web Search
                       Engines, Microsoft Word Macro Virus Update


TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH