Operating System:


30 October 2000

Protect yourself against future threats.


              AUSCERT External Security Bulletin Redistribution
                      ESB-2000.319 -- FreeBSD-SA-00:58
               chpass family contains local root vulnerability
                               31 October 2000


	AusCERT Security Bulletin Summary

Product:                chfn chpass chsh ypchfn ypchpass ypchsh passwd
Vendor:                 FreeBSD
Operating System:       FreeBSD
Impact:                 Root Compromise
Access Required:        Local

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


FreeBSD-SA-00:58                                           Security Advisory
                                                                FreeBSD, Inc.

Topic:          chpass family contains local root vulnerability

Category:       core
Module:         chfn/chpass/chsh/ypchfn/ypchpass/ypchsh/passwd
Announced:      2000-10-30
Credits:	Problem fixed during internal auditing.
		Vulnerability pointed out by: caddis <caddis@DISSENSION.NET>
Affects:        FreeBSD 3.x (all releases), FreeBSD 4.0-RELEASE,
		FreeBSD 4.0-STABLE prior to the correction date
Corrected:      2000/07/20 (FreeBSD 4.0-STABLE)
		2000/10/04 (FreeBSD 3.5.1-STABLE)
FreeBSD only:   NO

I.   Background

ch{fn,pass,sh} are utilities for changing user "finger" information,
passwords, and login shell, respectively. The yp* variants perform the
analogous changes on a NIS account.

II.  Problem Description

A "format string vulnerability" was discovered in code used by the
vipw utility during an internal FreeBSD code audit in July 2000. The
vipw utility does not run with increased privileges and so it was
believed at the time that it did not represent a security
vulnerability. However it was not realised that this code is also
shared with other utilities -- namely chfn, chpass, chsh, ypchfn,
ypchpass, ypchsh and passwd -- which do in fact run setuid root.

Therefore, the problem may be exploited by unprivileged local users to
gain root access to the local machine.

All versions of FreeBSD prior to the correction date including 4.0 and
3.5.1 are vulnerable to this problem, but it was fixed in the 4.x
branch prior to the release of FreeBSD 4.1.

III. Impact

Local users can obtain root privileges on the local machine.

IV.  Workaround

Remove the setuid bit on the following utilities. This has the
side-effect that non-root users cannot change their finger
information, passwords, or login shells.

# chflags noschg /usr/bin/chfn /usr/bin/chpass /usr/bin/chsh
# chmod u-s /usr/bin/chfn /usr/bin/chpass /usr/bin/chsh
# chflags noschg /usr/bin/ypchfn /usr/bin/ypchpass /usr/bin/ypchsh
# chmod u-s /usr/bin/ypchfn /usr/bin/ypchpass /usr/bin/ypchsh
# chflags noschg /usr/bin/passwd
# chmod u-s /usr/bin/passwd

V.   Solution

One of the following:

1) Upgrade your vulnerable FreeBSD system to 4.1-RELEASE,
4.1.1-RELEASE, 4.1.1-STABLE or 3.5.1-STABLE after the respective
correction dates.

2) Apply the patch below and recompile the respective files:

Either save this advisory to a file, or download the patch and
detached PGP signature from the following locations, and verify the
signature using your PGP utility.


Execute the following commands as root:

# cd /usr/src/usr.sbin/vipw
# patch -p < /path/to/patch_or_advisory
# make depend && make all install
# cd /usr/src/usr.bin/chpass/
# make depend && make all install
# cd /usr/src/usr.bin/passwd/
# make depend && make all install

Patch for vulnerable systems:

    --- pw_util.c   1999/08/28 01:20:31     1.17
    +++ pw_util.c   2000/07/12 00:49:40     1.18
    @@ -250,7 +250,7 @@
            extern int _use_yp;
     #endif /* YP */
            if (err)
    -               warn(name);
    +               warn("%s", name);
     #ifdef YP
            if (_use_yp)
                    warnx("NIS information unchanged");

Version: GnuPG v1.0.4 (FreeBSD)
Comment: For info see http://www.gnupg.org


- --------------------------END INCLUDED TEXT--------------------

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:


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

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.

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