AUSCERT External Security Bulletin Redistribution

                ESB-2001.067 -- FreeBSD-SA-01:25.kerberosIV
              Local and remote vulnerabilities in Kerberos IV
                             19 February 2001


        AusCERT Security Bulletin Summary

Product:                libkrb
Vendor:                 FreeBSD
Operating System:       FreeBSD
Impact:                 Execute Arbitrary Code/Commands
                        Root Compromise
Access Required:        Remote

Ref:                    ESB-2000.356

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


FreeBSD-SA-01:25                                           Security Advisory
                                                                FreeBSD, Inc.

Topic:          Local and remote vulnerabilities in Kerberos IV

Category:       core
Module:         libkrb, telnetd
Announced:      2001-02-14
Credits:        Jouko Pynnönen <jouko@solutions.fi>
Affects:        FreeBSD 4.2-STABLE and 3.5-STABLE prior to the
                correction dates.
Corrected:      2000-12-13 (FreeBSD 4.2-STABLE)
                2000-12-15 (FreeBSD 3.5-STABLE)
FreeBSD only:   NO

I.   Background

telnetd is the server for the telnet remote login protocol, which is
available with optional support for the Kerberos authentication
protocol.  libkrb is the library used for Kerberised applications
(including telnetd and login).  FreeBSD includes the KTH Kerberos
implementation, which is externally maintained, contributed software,
as an optional part of the base system.

II.  Problem Description

The advisory describes three vulnerabilities: first, an overflow in
the libkrb KerberosIV authentication library, second, improper
filtering of environmental variables by the KerberosIV-adapted telnet
daemon, and finally, a temporary file vulnerability in the KerberosIV
ticket management code.

A buffer overflow exists in the libkrb Kerberos authentication
library, which may be exploitable by malicious remote authentication
servers.  This vulnerability exists in the kdc_reply_cipher() call.
An attacker may be able to overflow this buffer during an
authentication exchange, allowing the attacker to execute arbitrary
code with the privileges of the caller of kdc_reply_cipher().

The telnet protocol allows for UNIX environmental variables to be
passed from the client to the user login session on the server.  The
base system telnet daemon, telnetd, goes the great lengths to limit
the variables passed so as to prevent them from improperly influencing
the login and authentication mechanisms.  The telnet daemon used with
KerberosIV relied on an incomplete list of improper environment
variables to remove from the environment before executing the login
program.  This is a similar vulnerability to that described in
Security Advisory 00:69.

Two environment variables have been identified that place users of
Kerberos at risk.  The first allows the remote user to change the
Kerberos server used for authentication requests, increasing the
opportunity for an attacker to exploit the buffer overflow.  The
second allows the configuration directory for Kerberos to be modified,
allowing an attacker with the right to modify the local file system to
cause Kerberos to autheticate using an improper configuration
(including Kerberos realm and server configuration, as well as
srvtab).  These vulnerabilities may be used to leverage root access.

A race condition exists in the handling of ticket files in /tmp; this
vulnerability may be exploited by a local user to gain ownership of
arbitrary files in the file system.  This vulnerability can be
leveraged to gain root access.

These vulnerabilities only exist on systems which have installed the
optional Kerberos IV distribution (whether or not it is configured),
which is not installed by default.

III. Impact

If your system has the KerberosIV distribution installed, remote and
local users may be able to obtain root privileges on the local system.

IV.  Workaround

To prevent remote root compromise via the telnet service, disable the
telnet service, which is usually run out of inetd: comment out the
following lines in /etc/inetd.conf, if present.

telnet  stream  tcp     nowait  root    /usr/libexec/telnetd    telnetd

telnet  stream  tcp6    nowait  root    /usr/libexec/telnetd    telnetd

The local root compromise cannot be easily worked around.

V.   Solution

One of the following:

1) Upgrade your vulnerable FreeBSD system to 4.2-STABLE or
3.5-STABLE after the respective correction dates.

2) Apply the relevant patch from below and recompile the affected

Download the relevant patch and detached PGP signature from the
following locations, and verify the signature using your PGP utility.

[FreeBSD 4.2]

[FreeBSD 3.5.1]

NOTE: This patch assumes you have already applied the patch in security advisory

Execute the following commands as root:

# cd /usr/src
# patch -p < /path/to/patch
# cd /usr/src/kerberosIV
# make depend && make all install
# cd /usr/src/libexec/telnetd
# make depend && make all install
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