*BSD News Article 73754


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!vixen.cso.uiuc.edu!newsrelay.iastate.edu!ng1.icn.state.ia.us!news.dmacc.cc.ia.us!not-for-mail
From: cfr@infoborg.dmacc.cc.ia.us (Charles F. Randall)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Fixed in 2.1.5R? Re: CERT Vendor-Initiated Bulletin VB-96.11 - FreeBSD, Inc.
Followup-To: comp.unix.bsd.freebsd.misc
Date: 15 Jul 1996 09:06:57 -0500
Organization: Des Moines Area Community College
Lines: 311
Message-ID: <4sdja1$4rf@infoborg.dmacc.cc.ia.us>
References: <4s3o4k$m5u@news.sei.cmu.edu>
Reply-To: "Charles F. Randall" <crandall@dmacc.cc.ia.us>
NNTP-Posting-Host: infoborg.dmacc.cc.ia.us
Keywords: security CERT

This was posted to comp.security.announce. 

Are these patches already applied to 2.1.5R?

-Randy

CERT Bulletin  <cert-advisory-request@cert.org> wrote:
-----BEGIN PGP SIGNED MESSAGE-----

=============================================================================
CERT(sm) Vendor-Initiated Bulletin VB-96.11
July 11, 1996

Topic: security compromise from ppp
Source: FreeBSD, Inc.

To aid in the wide distribution of essential security information, the CERT
Coordination Center is forwarding the following information from FreeBSD, Inc.
FreeBSD urges you to act on this information as soon as possible. FreeBSD
contact information is included in the forwarded text below; please contact
them if you have any questions or need further information.


=======================FORWARDED TEXT STARTS HERE============================
=============================================================================
FreeBSD-SA-96:15                                            Security Advisory
                                                                FreeBSD, Inc.

Topic:          security compromise from ppp

Category:       core
Module:         ppp
Announced:      1996-07-04
Affects:        FreeBSD 2.0.5, 2.1, 2.1-stable, and 2.2-current
Corrected:      2.1-stable and 2.2-current as of 1996-06-10
FreeBSD only:   unknown

Patches:        ftp://freebsd.org/pub/CERT/patches/SA-96:15/

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

I.   Background

     FreeBSD ships a userland ppp program that can be used by users
     to set up ppp connections.
     This program is also known as ijppp.
     The ppp program has a vulnerability that allows any user to run
     commands under root privileges.

II.  Problem Description

     The ppp program does not properly manage user privileges, allowing
     users to run any program with root privileges.

III. Impact

     This vulnerability can only be exploited by users with a valid
     account on the local system to easily obtain superuser access.

IV. Workaround

     One may simply disable the setuid bit on all copies of the ppp
     program.  This will close the vulnerability but will only allow
     the superuser to set up ppp connections.

     As root, execute the commands:

         # chmod 555 /usr/sbin/ppp

     then verify that the setuid permissions of the files have been
     removed.  The permissions array should read "-r-xr-xr-x" as
     shown here:

         # ls -l /usr/sbin/ppp
         -r-xr-xr-x  1 root  bin  86016 Nov 16  1995 /usr/sbin/ppp

V. Solution

     Patches are available which eliminate this vulnerability.
     The following patch should be applied to the system sources and
     ppp should be rebuilt and reinstalled. The first patch is against
     the FreeBSD 2.1 and FreeBSD-stable source tree. The second patch
     is for FreeBSD-current (version before 1996-06-10).

     Apply the patch, then (being superuser):
        # cd /usr/src/usr.sbin/ppp
        # make depend
        # make all
        # make install

     Index: command.c
     ===================================================================
     RCS file: /home/ncvs/src/usr.sbin/ppp/command.c,v
     retrieving revision 1.5.4.3
     retrieving revision 1.5.4.4
     diff -u -r1.5.4.3 -r1.5.4.4
     --- command.c      1996/02/05 17:02:52     1.5.4.3
     +++ command.c      1996/06/10 09:41:49     1.5.4.4
     @@ -17,7 +17,7 @@
       * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
       * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
       *
     - * $Id: command.c,v 1.5.4.3 1996/02/05 17:02:52 dfr Exp $
     + * $Id: command.c,v 1.5.4.4 1996/06/10 09:41:49 ache Exp $
       *
       */
      #include <sys/types.h>
     @@ -187,9 +187,14 @@
            * We are running setuid, we should change to
            * real user for avoiding security problems.
            */
     -     setgid( getgid() );
     -     setuid( getuid() );
     -
     +     if (setgid(getgid()) < 0) {
     +  perror("setgid");
     +  exit(1);
     +     }
     +     if (setuid(getuid()) < 0) {
     +  perror("setuid");
     +  exit(1);
     +     }
           TtyOldMode();
           if(argc > 0)
             execvp(argv[0], argv);
     Index: chat.c
     ===================================================================
     RCS file: /home/ncvs/src/usr.sbin/ppp/chat.c,v
     retrieving revision 1.4.4.1
     retrieving revision 1.4.4.2
     diff -u -r1.4.4.1 -r1.4.4.2
     --- chat.c 1995/10/06 11:24:31     1.4.4.1
     +++ chat.c 1996/06/10 09:41:45     1.4.4.2
     @@ -18,7 +18,7 @@
       *                Columbus, OH  43221
       *                (614)451-1883
       *
     - * $Id: chat.c,v 1.4.4.1 1995/10/06 11:24:31 davidg Exp $
     + * $Id: chat.c,v 1.4.4.2 1996/06/10 09:41:45 ache Exp $
       *
       *  TODO:
       *        o Support more UUCP compatible control sequences.
     @@ -331,6 +331,15 @@
          nb = open("/dev/tty", O_RDWR);
          dup2(nb, 0);
      LogPrintf(LOG_CHAT, "exec: %s\n", command);
     +    /* switch back to original privileges */
     +    if (setgid(getgid()) < 0) {
     +      LogPrintf(LOG_CHAT, "setgid: %s\n", strerror(errno));
     +      exit(1);
     +    }
     +    if (setuid(getuid()) < 0) {
     +      LogPrintf(LOG_CHAT, "setuid: %s\n", strerror(errno));
     +      exit(1);
     +    }
          pid = execvp(command, vector);
          LogPrintf(LOG_CHAT, "execvp failed for (%d/%d): %s\n", pid, errno, command);
          exit(127);


     Patch for FreeBSd-current before 1996-06-10:


     Index: command.c
     ===================================================================
     RCS file: /home/ncvs/src/usr.sbin/ppp/command.c,v
     retrieving revision 1.17
     retrieving revision 1.18
     diff -u -r1.17 -r1.18
     --- command.c      1996/05/11 20:48:22     1.17
     +++ command.c      1996/06/09 20:40:58     1.18
     @@ -17,7 +17,7 @@
       * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
       * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
       *
     - * $Id: command.c,v 1.17 1996/05/11 20:48:22 phk Exp $
     + * $Id: command.c,v 1.18 1996/06/09 20:40:58 ache Exp $
       *
       */
      #include <sys/types.h>
     @@ -190,9 +190,14 @@
            * We are running setuid, we should change to
            * real user for avoiding security problems.
            */
     -     setgid( getgid() );
     -     setuid( getuid() );
     -
     +     if (setgid(getgid()) < 0) {
     +  perror("setgid");
     +  exit(1);
     +     }
     +     if (setuid(getuid()) < 0) {
     +  perror("setuid");
     +  exit(1);
     +     }
           TtyOldMode();
           if(argc > 0)
             execvp(argv[0], argv);
     Index: chat.c
     ===================================================================
     RCS file: /home/ncvs/src/usr.sbin/ppp/chat.c,v
     retrieving revision 1.10
     retrieving revision 1.11
     diff -u -r1.10 -r1.11
     --- chat.c 1996/05/11 20:48:20     1.10
     +++ chat.c 1996/06/09 20:40:56     1.11
     @@ -18,7 +18,7 @@
       *                Columbus, OH  43221
       *                (614)451-1883
       *
     - * $Id: chat.c,v 1.10 1996/05/11 20:48:20 phk Exp $
     + * $Id: chat.c,v 1.11 1996/06/09 20:40:56 ache Exp $
       *
       *  TODO:
       *        o Support more UUCP compatible control sequences.
     @@ -393,6 +393,15 @@
          nb = open("/dev/tty", O_RDWR);
          dup2(nb, 0);
      LogPrintf(LOG_CHAT_BIT, "exec: %s\n", command);
     +    /* switch back to original privileges */
     +    if (setgid(getgid()) < 0) {
     +      LogPrintf(LOG_CHAT_BIT, "setgid: %s\n", strerror(errno));
     +      exit(1);
     +    }
     +    if (setuid(getuid()) < 0) {
     +      LogPrintf(LOG_CHAT_BIT, "setuid: %s\n", strerror(errno));
     +      exit(1);
     +    }
          pid = execvp(command, vector);
          LogPrintf(LOG_CHAT_BIT, "execvp failed for (%d/%d): %s\n", pid, errno, command);
          exit(127);

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

Web Site:                       http://www.freebsd.org/
Confidential contacts:          security-officer@freebsd.org
PGP Key:                        ftp://freebsd.org/pub/CERT/public_key.asc
Security notifications:         security-notifications@freebsd.org
Security public discussion:     security@freebsd.org

Notice: Any patches in this document may not apply cleanly due to
        modifications caused by digital signature or mailer software.
        Please reference the URL listed at the top of this document
        for original copies of all patches if necessary.
=============================================================================

========================FORWARDED TEXT ENDS HERE=============================

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


CERT is a service mark of Carnegie Mellon University.

This file: ftp://info.cert.org/pub/cert_bulletins/VB-96.11.freebsd

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

iQCVAwUBMeURZXVP+x0t4w7BAQHIygP/Sz+ie128GTqeIObCcPbZs0CV3NHQ/Klw
KQNam2c+6mcodw16xTjAXO8geV5wSANV074d7UXnlzSQN69QKhHzXcBIY2cQptWd
AlXgChaipTriyU3WupKUvD7rwkjG/uTfcymiWDrqs4UhT2AFwKUUZEzldrHqxd2c
fjp/rTgO9b8=
=nWXf
-----END PGP SIGNATURE-----


-- 
Charles F. Randall                 E-mail: crandall@dmacc.cc.ia.us
UNIX Systems Programmer            Voice:  (515) 965-7057
Perl Hacker - Powered by FreeBSD!  FAX:    (515) 965-7305