security alert

P.A.Osborne P.A.Osborne at ukc.ac.uk
Thu Sep 16 10:35:44 BST 1999


Just got this one off of another mailing list that I am on:

--Paul
----------------

__________________________________________________________

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

                             INFORMATION BULLETIN

                FreeBSD File Flags and Man-In-The-Middle Attack
                     

September 7, 1999 17:00 GMT                                     
Number J-066
_____________________________________________________________________________

PROBLEM:       A local user can execute a man-in-the-middle attack
should
               certain programs fail when subsequent users sign on.
PLATFORM:      All systems running FreeBSD 3.2 (and earlier) or
               FreeBSD-Current before 1999/08/02.
DAMAGE:        A local user can snoop and alter all text that the
other user
               (including root) writes.  Results of this include the
ability
               to execute commands as the user, and stealing the
user's
               password (and anything else the user writes over the
               connection, including passwords for other machines).
SOLUTION:      Apply the available patches. There are no immediate or
               temporary workarounds.
_____________________________________________________________________________
VULNERABILITY  The risk is MEDIUM because the FreeBSD Advisory did not
ASSESSMENT:    indicate that this vulnerability had been discussed in
public
               forums.
_____________________________________________________________________________


[ Start FreeBSD Advisory ]

=============================================================================
FreeBSD-SA-99:01                                            Security
Advisory
                                                               
FreeBSD, Inc.

Topic:          BSD File Flags and Programming Techniques

Category:       core
Module:         kernel
Announced:      1999-09-04
Affects:        FreeBSD 3.2 (and earlier)
                FreeBSD-current before the correction date.
Corrected:      FreeBSD-3.3 RELEASE
                FreeBSD-current as of 1999/08/02
                FreeBSD-3.2-stable as of 1999/08/02
                FreeBSD-2.2.8-stable as of 1999/08/04
FreeBSD only:   NO

Patches:       
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-99:01/

I.   Background   

BSD 4.4 added various flags to files in the file system.  These flags
control various aspects of which operations are permitted on those
files.  Historically, root has been been able to do all of these
operations so many programs that knew they were running as root didn't
check to make sure that these operations succeeded.

II.  Problem Description

A user can set flags and mode on the device which they logged into.
Since a bug in login and other similar programs causes the normal
chown to fail, this first user will own the terminal of any login.

III. Impact

Local users can execute a man-in-the-middle attack against any other
user (including root) when the other users logs in.  This give them
the ability to snoop and alter all text that the user writes.  Results
of this include the ability to execute commands as the user, and
stealing the user's password (and anything else the users writes over
the connection, including passwords for other machines).

IV.  Workaround

None.

V.   Solution

    FreeBSD-current

        Index: kern/vfs_syscalls.c
       
===================================================================
        RCS file: /home/imp/FreeBSD/CVS/src/sys/kern/vfs_syscalls.c,v
        retrieving revision 1.125
        retrieving revision 1.128
        diff -u -r1.125 -r1.128
        --- vfs_syscalls.c      1999/07/29 17:02:56     1.125
        +++ vfs_syscalls.c      1999/08/04 04:52:18     1.128
        @@ -1892,13 +1892,23 @@
                int error;
                struct vattr vattr;

        +       /*
        +        * Prevent non-root users from setting flags on
devices.  When
        +        * a device is reused, users can retain ownership of
the device
        +        * if they are allowed to set flags and programs
assume that
        +        * chown can't fail when done as root.
        +        */
        +       if ((vp->v_type == VCHR || vp->v_type == VBLK) &&
        +           ((error = suser_xxx(p->p_ucred, p, PRISON_ROOT))
!= 0))
        +               return (error);
        +
                VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
                vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
                VATTR_NULL(&vattr);
                vattr.va_flags = flags;
                error = VOP_SETATTR(vp, &vattr, p->p_ucred, p);
                VOP_UNLOCK(vp, 0, p);
        -       return error;
        +       return (error);
         }

         /*

    FreeBSD-3.2-stable

        Index: kern/vfs_syscalls.c
       
===================================================================        RCS file: /home/imp/FreeBSD/CVS/src/sys/kern/vfs_syscalls.c,v
        retrieving revision 1.112.2.3
        retrieving revision 1.112.2.5
        diff -u -r1.112.2.3 -r1.112.2.5
        --- vfs_syscalls.c      1999/07/30 01:07:23     1.112.2.3
        +++ vfs_syscalls.c      1999/08/11 21:39:50     1.112.2.5
        @@ -1839,13 +1839,23 @@
                int error;
                struct vattr vattr;

        +       /*
        +        * Prevent non-root users from setting flags on
devices.  When
        +        * a device is reused, users can retain ownership of
the device
        +        * if they are allowed to set flags and programs
assume that
        +        * chown can't fail when done as root.
        +        */
        +       if ((vp->v_type == VCHR || vp->v_type == VBLK) &&
        +           ((error = suser(p->p_ucred, &p->p_acflag)) != 0))
        +               return (error);
        +
                VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
                vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
                VATTR_NULL(&vattr);
                vattr.va_flags = flags;
                error = VOP_SETATTR(vp, &vattr, p->p_ucred, p);
                VOP_UNLOCK(vp, 0, p);
        -       return error;
        +       return (error);
         }

         /*

    FreeBSD 2.2.8-stable:

        Index: kern/vfs_syscalls.c
       
===================================================================       RCS file: /home/imp/FreeBSD/CVS/src/sys/kern/vfs_syscalls.c,v
        retrieving revision 1.51.2.7
        retrieving revision 1.51.2.8
        diff -u -r1.51.2.7 -r1.51.2.8
        --- vfs_syscalls.c      1998/07/03 03:50:31     1.51.2.7
        +++ vfs_syscalls.c      1999/08/04 18:58:56     1.51.2.8
        @@ -1439,6 +1439,17 @@
                if (error)
                        return (error);
                vp = nd.ni_vp;
        +       if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)))
        +               return (error);
        +       /*
        +        * Prevent non-root users from setting flags on
devices.  When
        +        * a device is reused, users can retain ownership of
the device
        +        * if they are allowed to set flags and programs
assume that
        +        * chown can't fail when done as root.
        +        */
        +       if ((vp->v_type == VCHR || vp->v_type == VBLK) &&
        +           ((error = suser(p->p_ucred, &p->p_acflag)) != 0))
        +               return (error);
                LEASE_CHECK(vp, p, p->p_ucred, LEASE_WRITE);
                VOP_LOCK(vp);
                VATTR_NULL(&vattr);

VI.  Credits

Theo de Raadt came up with the firewalling solution presented here.

lumpy at blue.9mm.com brought this problem to light.

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

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

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

[ End FreeBSD Advisory ]

_____________________________________________________________________________


CIAC wishes to acknowledge the contributions of FreeBSD, Inc. 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 925-422-8193
    FAX:      +1 925-423-8002
    STU-III:  +1 925-423-2604
    E-mail:   ciac at 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), use one of the following methods to contact CIAC:

    1.  Call the CIAC voice number 925-422-8193 and leave a message,
or

    2.  Call 888-449-8369 to send a Sky Page to the CIAC duty person
or

    3.  Send e-mail to 4498369 at skytel.com, or

    4.  Call 800-201-9288 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://www.ciac.org/
                        (or http://ciac.llnl.gov -- they're the same
machine)
   Anonymous FTP:       ftp.ciac.org
                        (or ciac.llnl.gov -- they're the same machine)
   Modem access:        +1 (925) 423-4753 (28.8K baud)
                        +1 (925) 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. SPI-ANNOUNCE for official news about Security Profile Inspector
   (SPI) software updates, new features, distribution and
   availability;
3. 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 Majordomo, 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, spi-announce OR spi-notes for list-name:

E-mail to       ciac-listproc at llnl.gov or majordomo at rumpole.llnl.gov:
        subscribe list-name
  e.g., subscribe ciac-bulletin

You will receive an acknowledgment email immediately with a
confirmation
that you will need to mail back to the addresses above, as per the
instructions in the email.  This is a partial protection to make sure
you are really the one who asked to be signed up for the list in
question.

If you include the word 'help' in the body of an email to the above
address,
it will also send back an information file on how to
subscribe/unsubscribe,
get past issues of CIAC bulletins via email, etc.

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 via WWW at http://www.first.org/.

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)

J-056: Microsoft "Encapsulated SMTP Address" Vulnerability
J-057: Windows NT(r) Terminal Servers DOS Vulnerability
J-058: Microsoft "Malformed HTTP Request Header" Vulnerability
J-059: IBM AIX (pdnsd) Buffer Overflow Vulnerability
J-060: Microsoft Office "ODBC" Vulnerabilities
J-061: Lotus Notes Domino Server Denial of Service Attacks
J-062: Netscape Enterprise and FastTrack Web Servers Buffer Overflow
J-063: Domain Name System (DNS) Denial of Service (DoS) Attacks
J-064: ActiveX Controls, Scriptlet.typlib & Eyedog, Vulnerabilities
J-065: Wu-ftpd Vulnerability



-----BEGIN PGP SIGNATURE-----
Version: 4.0 Business Edition

iQCVAwUBN9mLiLnzJzdsy3QZAQEdFwP+MQVtk6YrhBvNTnezANewu3A8Cplm7qmt
UMFmmgXDxypS3fQCrE+PTIi36tCYtMOvNYXofUATjCht8J6JMFoiq5nMF5yniwL3
nfEWCisB7rN7sofxfINzgJ25UeriAZAVJ1D+LxOP9JHH9V9OiMyUypxkOgIch7gr
LTkzIOhciMA=
=T2RU
-----END PGP SIGNATURE-----







More information about the Ukfreebsd mailing list