Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!


TUCoPS :: Unix :: General :: ciacl124.txt

Remote Buffer Overflow in telnetd




             __________________________________________________________

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

                             INFORMATION BULLETIN

                       Remote Buffer Overflow in telnetd
                               [FreeBSD-SA-01:49]

July 24, 2001 19:00 GMT                                           Number L-124
[Revised August 1, 2001 - Used revised FreeBSD notice]
______________________________________________________________________________
PROBLEM:       A remote buffer overflow exists in the telnetd daemon in use on
               many platforms.
PLATFORM:      * Multiple vendor platforms may be affected.
               * All releases of FreeBSD 3.x, 4.x, FreeBSD 4.3-STABLE
                 prior to the correction date are known to be vulnerable per
                 the FreeBSD Security Advisory below.
DAMAGE:        A remote attacker can cause the telnetd process to overflow the
               buffer and crash, or execute arbitrary code as the user running
               telnetd, usually root.
SOLUTION:      Check with your vendor for specific information on the
               operating systems in use at your site. For FreeBSD systems,
               follow the workaround or solutions as outlined below.

               As new information is released, CIAC will update this bulletin.
______________________________________________________________________________
VULNERABILITY  The risk is HIGH. A valid user account and password are not
ASSESSMENT:    required to exploit this vulnerability, only the ability to
               connect to a telnetd server. The exploit code has been
               published on the Internet and is being actively exploited in
               the wild.
______________________________________________________________________________
LINKS: 
 CIAC BULLETIN:      http://www.ciac.org/ciac/bulletins/l-124.shtml
 PATCHES:                                                                     
                     ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-01:49/
                           telnetd-crypto.patch
                     ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-01:49/
                           telnetd-crypto.patch.asc
                     ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-01:49/
                           telnetd.patch
                     ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-01:49/
                           telnetd.patch.asc
                     ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/
                           security-patch-telnetd-crypto-01.49.tgz
                     ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/
                           security-patch-telnetd-crypto-01.49.tgz.asc
                     ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/
                           security-patch-telnetd-kerberosIV-01.49.tgz
                     ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/
                           security-patch-telnetd-kerberosIV-01.49.tgz.asc
                     ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/
                           security-patch-telnetd-01.49.tgz
                     ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/
                           security-patch-telnetd-01.49.tgz.asc
______________________________________________________________________________

[***** Start FreeBSD-SA-01:49, v1.1 *****]

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

Topic:          telnetd contains remote buffer overflow

Category:       core
Module:         telnetd
Announced:      2001-07-23
Revised:        2001-07-27
Credits:        Sebastian <scut@nb.in-berlin.de>
Affects:        All releases of FreeBSD 3.x, 4.x prior to 4.4,
                FreeBSD 4.3-STABLE prior to the correction date
Corrected:      2001-07-23
FreeBSD only:   NO

0.   Revision History

2001-07-23  v1.0  Initial release
2001-07-27  v1.1  Updated patch instructions, kerberosIV package
                  available, added reference to SSH in workarounds.

I.   Background

telnetd is the server for the telnet remote virtual terminal protocol.

II.  Problem Description

An overflowable buffer was found in the version of telnetd included
with FreeBSD.  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.

The telnetd service is enabled by default on all FreeBSD installations
if the 'high' security setting is not selected at install-time. This
vulnerability is known to be exploitable, and is being actively
exploited in the wild.

All released versions of FreeBSD prior to the correction date
including 3.5.1-RELEASE and 4.3-RELEASE are vulnerable to this
problem.  It was corrected prior to the forthcoming release of
4.4-RELEASE.

III. Impact

Remote users can cause arbitrary code to be executed as the user
running telnetd, usually root.

IV.  Workaround

1) 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

and execute the following command as root:

# kill -HUP `cat /var/run/inetd.pid`

An alternative remote login protocol such as the SSH secure shell
protocol (which is installed by default in FreeBSD), can be used
instead.  The SSH protocol is the recommended protocol for remote
logins to FreeBSD systems because of the superior authentication,
confidentiality and integrity protection it supplies relative to other
protocols such as telnet.

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.

V.   Solution

One of the following:

1) Upgrade your vulnerable FreeBSD system to 4.3-STABLE or the
RELENG_4_3 security branch after the respective correction dates.

2) FreeBSD 3.5.1, 4.x systems prior to the correction date:

There are two versions of the patch available, for systems with and
without the /usr/src/crypto/telnet sources.  To determine whether your
system has the crypto-telnet sources installed, perform the following
command:

# ls /usr/src/crypto/telnet/telnetd

A response of

ls: /usr/src/crypto/telnet/telnetd: No such file or directory

indicates you do not have the crypto sources present and should
download the non-crypto-telnet patch: see section 2b) below.

These patches have been verified to apply to FreeBSD 4.2-RELEASE,
4.3-RELEASE and 3.5.1-STABLE dated prior to 2001-07-20 (users of
3.5.1-RELEASE must have applied the patches from FreeBSD Security
Advisory 00:69 prior to applying this patch).  These patches may or
may not apply to older, unsupported releases of FreeBSD.

2a) For systems with the crypto-telnet sources installed

Under FreeBSD 4.x, the crypto-telnet client can be built in two
versions: with or without support for the KerberosIV authentication
system.  Under FreeBSD 3.x there is only one way to build the
crypto-telnet client: with KerberosIV support.

To determine whether your system has the kerberosIV distribution
installed, perform the following command:

# ls /usr/lib/libkrb.a

Possible responses:

/usr/lib/libkrb.a   # This response indicates you have kerberosIV present

ls: /usr/lib/libkrb.a: No such file or directory
                    # This reponse indicates you do not have
                    # kerberosIV present

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

ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-01:49/telnetd-crypto.patch
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-01:49/telnetd-crypto.patch.asc

2aa) For systems with the crypto-telnet sources installed but without
KerberosIV installed

[FreeBSD 4.x systems]

# cd /usr/src/
# patch -p < /path/to/patch
# cd /usr/src/secure/lib/libtelnet
# make depend && make all
# cd /usr/src/secure/libexec/telnetd
# make depend && make all install

[FreeBSD 3.x systems]

# cd /usr/src/
# patch -p < /path/to/patch
# cd /usr/src/lib/libtelnet
# make depend && make all
# cd /usr/src/libexec/telnetd
# make depend && make all install

2ab) For systems with the crypto-telnet sources installed and with
KerberosIV installed

# cd /usr/src/
# patch -p < /path/to/patch
# cd /usr/src/kerberosIV/lib/libtelnet
# make depend && make all
# cd /usr/src/kerberosIV/libexec/telnetd
# make depend && make all install

2b) For systems without the crypto-telnet sources installed

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

ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-01:49/telnetd.patch
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-01:49/telnetd.patch.asc

# cd /usr/src/
# patch -p < /path/to/patch
# cd /usr/src/lib/libtelnet
# make depend && make all
# cd /usr/src/libexec/telnetd
# make depend && make all install

3) FreeBSD 4.3-RELEASE systems:

An experimental upgrade package is available for users who wish to
provide testing and feedback on the binary upgrade process.  This
package may be installed on FreeBSD 4.3-RELEASE systems only, and is
intended for use on systems for which source patching is not practical
or convenient.

If you use the upgrade package, feedback (positive or negative) to
security-officer@FreeBSD.org is requested so we can improve the
process for future advisories.

During the installation procedure, backup copies are made of the files
which are replaced by the package.  These backup copies will be
reinstalled if the package is removed, reverting the system to a
pre-patched state.

Three versions of the upgrade package are available, depending on
whether or not the system has the crypto or kerberosIV distributions
installed.

To determine whether your system has the crypto distribution
installed, perform the following command:

# ls /usr/bin/openssl

Possible responses:

/usr/bin/openssl       # This response indicates you have crypto present

ls: /usr/bin/openssl: No such file or directory
                       # This reponse indicates you do not have
                       # crypto present

To determine whether your system has the kerberosIV distribution
installed, perform the following command:

# ls /usr/lib/libkrb.a

Possible responses:

/usr/lib/libkrb.a   # This response indicates you have kerberosIV present

ls: /usr/lib/libkrb.a: No such file or directory
                    # This reponse indicates you do not have
                    # kerberosIV present

3a) If crypto is present

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/security-patch-telnetd-crypto-01.49.tgz
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/security-patch-telnetd-crypto-01.49.tgz.asc

Verify the detached PGP signature using your PGP utility.

# pkg_add security-patch-telnetd-crypto-01.49.tgz

3b) If kerberosIV is present

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/security-patch-telnetd-kerberosIV-01.49.tgz
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/security-patch-telnetd-kerberosIV-01.49.tgz.asc

Verify the detached PGP signature using your PGP utility.

# pkg_add security-patch-telnetd-kerberosIV-01.49.tgz

3c) If neither crypto nor kerberosIV are present

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/security-patch-telnetd-01.49.tgz
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:49/security-patch-telnetd-01.49.tgz.asc

Verify the detached PGP signature using your PGP utility.

# pkg_add security-patch-telnetd-01.49.tgz

[***** End FreeBSD-SA-01:49, v1.1 *****]

_______________________________________________________________________________

CIAC wishes to acknowledge the contributions of FreeBSD for the 
information contained in this bulletin.
_______________________________________________________________________________


CIAC, the Computer Incident Advisory Center, 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 (7x24)
    FAX:      +1 925-423-8002
    STU-III:  +1 925-423-2604
    E-mail:   ciac@ciac.org

Previous CIAC notices, anti-virus software, and other information are
available from the CIAC Computer Security Archive.

   World Wide Web:      http://www.ciac.org/
   Anonymous FTP:       ftp.ciac.org

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)

L-114: Hewlett-Packard login Vulnerability
L-115: Hewlett-Packard dlkm Vulnerability
L-116: Lightweight Directory Access Protocol (LDAP) Vulnerabilities
L-117: The Code Red Worm
L-118: Hewlett-Packard ftpd and ftp Vulnerability
L-119: Hewlett-Packard mkacct Program Vulnerability
L-120: Cisco "Code Red" Worm Impact
L-121: SSH Secure Shell Remote Root Exploit Vulnerability
L-122: FreeBSD tcpdump Remote Buffer Overflow Vulnerability
L-123: AIX libi18n Library Vulnerability





TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2014 AOH