-----BEGIN PGP SIGNED MESSAGE-----

===========================================================================
             AUSCERT External Security Bulletin Redistribution

              ESB-2001.355 -- FreeBSD-SA-01:54.ports-telnetd
                  telnetd contains remote buffer overflow
                              21 August 2001

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:                MIT Kerberos V (security/krb5) prior to v1.2.2_2
                        Heimdal (security/heimdal) prior to v0.4b_1
                        SSLtelnet (net/SSLtelnet)
Vendor:                 FreeBSD Ports Collection
Operating System:       FreeBSD
                        Unix
Impact:                 Root Compromise
Access Required:        Remote

Ref:                    ESB-2001.325

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

- -----BEGIN PGP SIGNED MESSAGE-----

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

Topic:          telnetd contains remote buffer overflow

Category:       ports
Modules:        krb5/heimdal/SSLtelnet
Announced:      2001-08-20
Credits:        Sebastian <scut@nb.in-berlin.de>
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

I.   Background

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
ports collection.

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.

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 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.

V.   Solution

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:

http://www.freebsd.org/ports/

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:

ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-4-stable/devel/portcheckout-2.0.tgz
ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-5-current/devel/portcheckout-2.0.tgz

VI.  Correction details

The following list contains the revision numbers of each file that was
corrected in the FreeBSD ports collection.

Affected port (module)
  Path                                                           Revision
- - -------------------------------------------------------------------------
MIT Kerberos V (krb5)
  ports/security/krb5/Makefile                                       1.27
  ports/security/krb5/files/patch-appl::telnet::telnetd::authenc.c    1.1
  ports/security/krb5/files/patch-appl::telnet::telnetd::ext.h        1.2
  ports/security/krb5/files/patch-appl::telnet::telnetd::slc.c        1.1
  ports/security/krb5/files/patch-appl::telnet::telnetd::state.c      1.2
  ports/security/krb5/files/patch-appl::telnet::telnetd::telnetd.c    1.2
  ports/security/krb5/files/patch-appl::telnet::telnetd::termstat.c   1.1
  ports/security/krb5/files/patch-appl::telnet::telnetd::utility.c    1.2
Heimdal (heimdal)
  ports/security/heimdal/Makefile                                    1.39
  ports/security/heimdal/files/patch-ad                               1.6
- - -------------------------------------------------------------------------

VII. References

<URL:http://www.securityfocus.com/advisories/3463>
<URL:http://www.team-teso.net/advisories/teso-advisory-011.tar.gz>
<URL:ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-01:49.telnetd.v1.1.asc>
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iQCVAwUBO4GGS1UuHi5z0oilAQENdgQAn48FDb8KqMftJGSS2ueRb9aZPuosS/3T
2I6AC3AOtBIKe+3fhnURdivPIXBWMZ4GyzkctfvQ0NaKUnnVqTzoxdSVN4wStJ1e
yXdJ9b4d5lyKvT0+JJI9IMylcA5o5kp5b36OpkB48Oo3y/4ZdiskJn3ZoU4zpBeU
+uCUTpg3TGM=
=SChg
- -----END PGP SIGNATURE-----

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

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

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:

	http://www.auscert.org.au/Information/advisories.html

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

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.

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

iQCVAwUBO4IzFCh9+71yA2DNAQFnkgP/YdNZgYbPV2hqde0Qmvmtqv+69Cb7B/YE
uz1/jB7v6rZmtqEuOCtIqmCaiYZ62P4LAbFALjwwJEuZEGD2+jaHaZQYoKVsetMh
yZyi8o6IPyjC3Xckmo3aFJZYxmMZ7tlOhXApl1LgrSD+vQAKOEmj6/5GDXW30tRi
QeOVvJtY610=
=vDVx
-----END PGP SIGNATURE-----