(FreeBSD Issues Fix for 'Ports' Collection) Telnet Daemons May Give Remote Users Root Level Access Privileges
SecurityTracker Alert ID: 1002236|
SecurityTracker URL: http://securitytracker.com/id/1002236
(Links to External Site)
Date: Aug 23 2001
Execution of arbitrary code via network, Root access via network, User access via network|
Fix Available: Yes Vendor Confirmed: Yes |
TESO reported that many BSD-derived Telnet daemons (servers) contain a vulnerability that may allow a remote user to obtain root level access on the server.|
The vulnerability is reportedly due to a buffer overflow in the telnet option handling.
The following systems are reported to be vulnerable:
BSDI 4.x default, FreeBSD .x default, IRIX 6.5, Linux netkit-telnetd < 0.14, NetBSD 1.x default, OpenBSD 2.x, Solaris 2.x sparc, and "almost any other vendor's telnetd".
A remote user can send a specially formatted option string to the remote telnet server and overwrite sensitive memory, causing arbitrary code to be executed with the privileges of the telnet server (which is typically root level privileges).
Telnet options are reportedly processed by the 'telrcv' function. The results of the parsing, which are to be send back to the client, are stored in the 'netobuf' buffer. It is apparently assumed that the reply data is smaller than the buffer size, so no bounds checking is performed. By using a combination of options, especially the 'AYT' Are You There option, it is possible for a remote user to append data to the buffer. It is reported that the characters that can be written to the buffer are limited, which makes constructing a successful exploit difficult.
The report states that a working exploit has been developed for BSDI, NetBSD and FreeBSD. However, the exploit was not released.
A remote user can execute arbitrary code on the server with the privileges of the telnet server, which is typically root level privileges.|
The vendor has released a fix for the FreeBSD third party ports collection. See the Source Message for the vendor's advisory containing directions on how to obtain the appropriate fix.|
|Underlying OS: UNIX (FreeBSD)|
|Underlying OS Comments: many Linux and Unix OSs are vulnerable, but not all - see the Alert text for more information|
This archive entry is a follow-up to the message listed below.|
Source Message Contents
Subject: FreeBSD Ports Security Advisory FreeBSD-SA-01:54.ports-telnetd|
-----BEGIN PGP SIGNED MESSAGE-----
FreeBSD-SA-01:54 Security Advisory
Topic: telnetd contains remote buffer overflow
Credits: Sebastian <firstname.lastname@example.org>
Affects: Ports collection prior to the correction date.
Corrected: 2001-07-19 21:43:41 UTC (heimdal)
2001-07-24 15:29:39 UTC (krb5)
SSLtelnet port not yet corrected
FreeBSD only: NO
telnetd is the server for the telnet remote virtual terminal protocol.
II. Problem Description
This advisory is closely related to the previously released
FreeBSD-SA-01:49.telnetd.v1.1 advisory. That advisory pertains to the
telnetd included in the base FreeBSD system. This advisory pertains
to optional third-party telnetd implementations found in the FreeBSD
An overflowable buffer was found in the versions of telnetd included
with several ports. These ports include:
MIT Kerberos V (security/krb5) prior to version 1.2.2_2
Heimdal (security/heimdal) prior to version 0.4b_1
SSLtelnet (net/SSLtelnet) - this port is not yet fixed; see below.
Due to incorrect bounds checking of data buffered for output to the
remote client, an attacker can cause the telnetd process to overflow
the buffer and crash, or execute arbitrary code as the user running
telnetd, usually root. A valid user account and password is not
required to exploit this vulnerability, only the ability to connect to
a telnetd server.
These ports are not installed by default, nor are they "part of
FreeBSD" as such: they are part of the FreeBSD ports collection, which
contains over 5600 third-party applications in a ready-to-install
format. The ports collection shipped with FreeBSD 4.3 is vulnerable to
this problem since it was discovered after its release, but the
problems with the krb5 and heimdal ports were corrected prior to the
(forthcoming) release of FreeBSD 4.4.
The SSLtelnet vulnerability has not yet been corrected: due to
divergences in the code, it is more difficult to correct the
vulnerability in that port. This advisory will be reissued once the
vulnerability is corrected.
Remote users can cause arbitrary code to be executed as the user
running telnetd, usually root.
1) Disable the telnet service, which is usually run out of inetd:
comment out lines in /etc/inetd.conf that begin with the word `telnet',
if present, e.g.
telnet stream tcp nowait root /usr/local/libexec/telnetd telnetd
telnet stream tcp6 nowait root /usr/local/libexec/telnetd telnetd
and execute the following command as root:
# kill -HUP `cat /var/run/inetd.pid`
2) Impose access restrictions using TCP wrappers (/etc/hosts.allow),
or a network-level packet filter such as ipfw(8) or ipf(8) on the
perimeter firewall or the local machine, to limit access to the telnet
service to trusted machines.
3) Deinstall the affected ports/packages if they are installed.
The updated ports include fixes for this vulnerability:
krb5-1.2.2_2 and later
heimdal-0.4b_1 and later
1) Upgrade your entire ports collection and rebuild the affected
ports (packages are not currently available for these ports).
2) Download a new port skeleton for the affected ports from:
and use it to rebuild the port.
3) Use the portcheckout utility to automate option (2) above. The
portcheckout port is available in /usr/ports/devel/portcheckout or the
package can be obtained from:
VI. Correction details
The following list contains the revision numbers of each file that was
corrected in the FreeBSD ports collection.
Affected port (module)
MIT Kerberos V (krb5)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message