Last revised: Sep 14, 2001
Source: The MIT Kerberos Team, CERT/CC
A complete revision history is at the end of this file.
The CERT Coordination Center has recently been notified of several
buffer overflow vulnerabilities in the Kerberos authentication
software. The most severe vulnerability allows remote intruders to
gain root privileges on systems running services using Kerberos
authentication. If vulnerable services are enabled on the Key
Distribution Center (KDC) system, the entire Kerberos domain may be
compromised.
There are at least four distinct vulnerabilities in various
versions and implementations of the Kerberos software. All of these
vulnerabilities may be exploited to obtain root privileges.
This vulnerability is present in version 4 of Kerberos. It is also
present in version 5 (in the version 4 compatibility code). This
vulnerability can be exploited in services using version 4 or 5 when they
perform version 4 authentication. This vulnerability may also be
exploited locally via the v4rcp setuid root program of Kerberos 5.
This vulnerability may be exploitable in version 4. This
vulnerability is exploitable in version 5 in conjunction with the
krb425_conv_principal() vulnerability, described below.
This vulnerability is present in version 5's backward compatibility
code. This vulnerability is known to be exploitable in version 5 in
conjunction with an exploit of the krb_rd_req() vulnerability.
This vulnerability is only present in version 5. This
vulnerability is not related to the previous two vulnerabilities.
This vulnerability is only present in version 5, and is corrected
in krb5-1.1.1 and krb5-1.0.7-beta1. The ksu vulnerability is
unrelated to the other vulnerabilities.
The MIT Kerberos Team described these vulnerabilities in detail in
an advisory they recently issued. The text of this advisory is
included below.
Systems Affected
Overview
I. Description
Buffer overflow in krb_rd_req() library function
Buffer overflow in krb425_conv_principal() library function
Buffer overflow in krshd
Buffer overflow in ksu
The MIT Kerberos Team Advisory
| |
SUMMARYSerious buffer overrun vulnerabilities exist in many implementations of Kerberos 4, including implementations included for backwards compatibility in Kerberos 5 implementations. Other less serious buffer overrun vulnerabilities have also been discovered. ALL KNOWN KERBEROS 4 IMPLEMENTATIONS derived from MIT sources are believed to be vulnerable. IMPACT
DETAILSThe MIT Kerberos Team has been made aware of a security vulnerability in the Kerberos 4 compatibility code contained within the MIT Kerberos 5 source distributions. This vulnerability consists of a buffer overrun in the krb_rd_req() function, which is used by essentially all Kerberos-authenticated services that use Kerberos 4 for authentication. It is possible for an attacker to gain root access over the network by exploiting this vulnerability. An exploit is known to exist for the Kerberized Berkeley remote shell daemon (krshd) for at least the i386-Linux platform, and possibly others. The extent of distribution of this exploit is unknown at this time. Other buffer overruns have been discovered as well, though with less far-reaching impact. The existing exploit does not directly use the buffer overrun in krb_rd_req(); rather, it uses the buffer that was overrun by krb_rd_req() to exploit a second overrun in krb425_conv_principal(). The krb_rd_req() code itself might not be exploitable once the overrun in krb425_conv_principal() is repaired, though it is likely that some other method of exploit may be found that does not require that an overrun exist in krb425_conv_principal(). VULNERABLE DISTRIBUTIONS AND PROGRAMSSource distributions which may contain vulnerable code include:
Daemons or services that may call krb_rd_req() and are thus vulnerable to remote exploit include:
In addition, it is possible that the v4rcp program, which is usually installed setuid to root, may be exploited by a local user to gain root access by means of exploiting the krb_rd_req vulnerability. The ksu program in some MIT Kerberos 5 releases has a vulnerability that may result in unauthorized local root access. This bug was fixed in krb5-1.1.1, as well as in krb5-1.0.7-beta1. Release krb5-1.1, as well as krb5-1.0.6 and earlier, are believed to be vulnerable. There is an unrelated buffer overrun in the krshd that is distributed with at least the MIT Kerberos 5 source distributions. It is not known whether an exploit exists for this buffer overrun. It is also not known whether this buffer overrun is actually exploitable. WORKAROUNDSCertain daemons that are called from inetd may be safe from exploitation if their command line invocation is modified to exclude the use of Kerberos 4 for authentication. Please consult the manpages or other documentation for your Kerberos distribution in order to determine the correct command line for disabling Kerberos 4 authentication. Daemons for which this approach may work include:
(*) The krshd program may still be vulnerable to remote attack if Kerberos 4 authentication is disabled, due to the unrelated buffer overrun mentioned above. It is best to disable the krshd program completely until a patched version can be installed. The v4rcp program should have its setuid permission removed, since it may be possible to perform a local exploit against it. The krb5 ksu program should have its setuid permission removed, if it was not compiled from krb5-1.1.1, krb5-1.0.7-beta1, or later code. Merely replacing the ksu binary with one compiled from krb5-1.1.1 or krb5-1.0.7-beta1 should be safe, provided that it is not compiled with shared libraries (the vulnerability is related to some library bugs). If ksu was compiled with shared libraries, it may be best to install a new release that has the library bug fixed. In the MIT Kerberos 5 releases, it may not be possible to disable Kerberos 4 authentication in the ftpd program. Note that only releases krb5-1.1 and later will have the ability to receive Kerberos 4 authentication. FIXESThe best course of action is to patch the code in the krb4 library, in addition to patching the code in the krshd program. The following patches include some less essential patches that also affect buffer overruns in potentially vulnerable code, but for which exploits are somewhat more difficult to construct. Please note that there are two sets of patches in this file that apply against identically named files in two different releases. You should separate out the patch set that is relevant to you prior to applying them; otherwise, you may inadvertently patch some files twice. MIT will soon release krb5-1.2, which will have these changes incorporated. PATCHES AGAINST krb5-1.0.xThe following are patches against 1.0.7-beta1 (roughly). The most critical ones are:
The rest are not as important but you may wish to apply them anyway out of paranoia. These patches may apply with a little bit of fuzz against releases prior to krb5-1.0.7-beta1, but there likely have not been significant changes in the affected code. These patches may also apply against KerbNet. The lib/krb4/rd_req.c patch may also apply against CNS and MIT Kerberos 4. |
[Patches to correct this issue in Kerberos version 5-1.0.x were included at this point in the MIT advisory. The CERT Coordination Center has made these patches available at the following link: -- CERT/CC] | |
| |
PATCHES AGAINST krb5-1.1.1The following are patches against 1.1.1. The most critical ones are:
IMPORTANT NOTE: If you are upgrading to krb5-1.1.1 (or krb5-1.1, but we recommend krb5-1.1.1 if you are going to upgrade at all) and compile the source tree with the --without-krb4 option, then you will also want to install the patch to login.c that is also provided below. The rest are not as important but you may wish to apply them anyway out of paranoia. |
[Patches to correct this issue in Kerberos version 5-1.1.1 were included at this point in the MIT advisory. The CERT Coordination Center has made these patches available at the following link: -- CERT/CC] | |
| |
ACKNOWLEDGMENTSThanks to Jim Paris Thanks to Nalin Dahyabhai of Redhat for pointing out some other
buffer overruns and coming up with patches.
|
The full text of the MIT Kerberos Team advisory is also available from:
II. Impact
The most significant impact of these vulnerabilities may allow a remote intruder to gain root access to systems running vulnerable services, including the KDC for the domain.
Buffer overflow in krb_rd_req() library function
This vulnerability may be exploited by remote users to gain root privileges on systems running services linked against the vulnerable library. As MIT indicated, these services include (but may not be limited to):
-
krshd
klogind (if accepting Kerberos 4 authentication)
telnetd (if accepting Kerberos 4 authentication)
ftpd (if accepting Kerberos 4 authentication)
rkinitd
kpopd
Local users can execute arbitrary code as root on systems where v4rcp is installed setuid root.
Buffer overflow in krb425_conv_principal() library function
This vulnerability can be exploited by remote users in conjunction with the krb_rd_req vulnerability to gain root privileges on systems running services linked against the vulnerable library.
Buffer overflow in krshd
Remote users may be able to execute arbitrary code as root on systems running a vulnerable version of krshd.
Buffer overflow in ksu
Local users can can gain root privileges by exploiting the buffer
overflow in ksu.
Appendix A contains information provided by vendors for this
advisory. We will update the appendix as we receive more information.
If you do not see your vendor's name, the CERT/CC did not hear from
that vendor. Please contact your vendor directly. If you are running the Kerberos 5 distribution from MIT, and can
rebuild your binaries from source, you can apply the source code
patches from MIT to correct these problems.
If you are running Kerberos version 4, you may be able to patch
your source code based on the version 5 patch provided by MIT. Only
the patches for the krb_rd_req() vulnerability need to be applied to
version 4 to address the issues described in this advisory.
With either version, you will need to recompile the libraries and
the vulnerable programs (krshd and ksu). You will also need to
recompile any programs that have been statically linked with the
vulnerable libraries. In version 4, you should also recompile the KDC
server software.
These patches are available at:
As suggested by MIT, version 4 authentication in some daemons can
be disabled at run time by supplying command line options to these
programs when started by inetd. This approach may work for the
following daemons:
This addresses the krb_rd_req() and krb425_conv_principal()
vulnerabilities. Note that krshd may still be vulnerable to the krshd
specific vulnerability described in this document.
The vulnerabilities described in this advisory will be addressed in
Kerberos 5 version 1.2. This version will be available from the MIT Kerberos
web site:
FreeBSD is not vulnerable by default, even for users who choose to
install the Kerberos distributions (FreeBSD uses KTH Kerberos, not
MIT). There is a port of MIT Kerberos 5 in the FreeBSD Ports
Collection which was vulnerable to this problem and has been corrected
as of 2000/05/17. A FreeBSD Security Advisory will be forthcoming.
The following APAR's are available for this vulnerability:
IBM AFS does not use the functions mentioned in this advisory and
therefore is not vulnerable.
No Microsoft products are affected by this vulnerability.
The MIT Kerberos Team advisory on this topic is available from:
NetBSD has two codebases for crypto software, a legacy of the US's
export laws until recently (and also some patent issues).
The crypto-intl tree intended for use by those outside the US was
not affected.
For the crypto-us tree,
In summary, users of NetBSD releases 1.4.2 and earlier or -current
up until yesterday, who have installed the crypto-us "secr" set and
who have enabled kerberos4, are vulnerable.
III. Solution
Apply a patch from your vendor
Apply the MIT patches
Disable version 4 authentication in version 5 if possible
klogind
telnetd
Upgrade to MIT Kerberos 5 version 1.2
Appendix A. Vendor Information
FreeBSD, Inc.
IBM Corporation
Microsoft Corporation
MIT Kerberos
NetBSD
OpenBSD