"Secure Networks Inc.": SNI-20: Telnetd tgetent vulnerability

From: Mike Iglesias <iglesias_at_draco.acs.uci.edu>
Date: Fri, 24 Oct 1997 14:35:36 -0700

Anyone know if DU is vulnerable to this attack?


Mike Iglesias Internet: iglesias_at_draco.acs.uci.edu
University of California, Irvine phone: (714) 824-6926
Office of Academic Computing FAX: (714) 824-2069


------- Forwarded Message

MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Message-ID: <Pine.BSI.3.96.971021182323.367A-100000_at_silence.secnet.com>
Date: Tue, 21 Oct 1997 18:24:02 -0600
Reply-To: "Secure Networks Inc." <sni_at_SILENCE.SECNET.COM>
Sender: Bugtraq List <BUGTRAQ_at_NETSPACE.ORG>
From: "Secure Networks Inc." <sni_at_SILENCE.SECNET.COM>
Subject: SNI-20: Telnetd tgetent vulnerability
X-To: best-of-security_at_cyber.com.au, linux-security_at_redhat.com
To: BUGTRAQ_at_NETSPACE.ORG

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

                        ###### ## ## ######
                        ## ### ## ##
                        ###### ## # ## ##
                            ## ## ### ##
                        ###### . ## ## . ######.

                            Secure Networks Inc.

                             Security Advisory
                             October 21, 1997

                    in.telnetd tgetent buffer overflow


This advisory addresses a vulnerability in the tgetent(3) library
routine which allows an attacker to obtain root privileges by connecting
to a vulnerable system's telnet daemon.


Problem Description
~~~~~~~~~~~~~~~~~~~

A vulnerability in the tgetent(3) library routine can result in a
buffer overflow in the telnet daemon on some BSD derived systems. By
uploading an alternate terminal capability database, an attacker
can exploit this vulnerability to gain unauthorized super-user access
to a vulnerable system, or to gain super-user access on a system
which they already have access to.

This problem can be exploited by mailing a file into the system, or
uploading a file via FTP. Once this file has been transferred to the
remote system, the attacker must only be able to connect to the telnet
daemon, to obtain super-user access.


Technical Details
~~~~~~~~~~~~~~~~~

The tgetent(3) library call requires the passing in of a buffer in
which the terminal entry is stored.

   /*
    * Get an entry for terminal name in buffer bp from the termcap file.
    */
   int
   tgetent(bp, name)
           char *bp, *name;
   {

The tgetent(3) library call does no checking on the size of data which
is placed into the *bp buffer. Many programs pass in a buffer of size
1024 bytes. By creating a termcap terminal specification larger than
1024 bytes, we can overflow a buffer in the calling function. If this
buffer is stored on the stack in the calling function, we can cause
arbitrary machine code to be executed.

The BSD telnet daemon calls the tgetent(3) function as follows:

   char buf[1024];

   if (terminaltype == NULL)
       return(1);

   if (tgetent(buf, s) == 0)
       return(0);
   return(1);

By specifying a terminal capability entry which is larger than 1024
bytes, an overflow occurs in the telnet daemon, allowing arbitrary
machine instructions to be executed.


Impact
~~~~~~

Remote individuals can obtain super-user access to any vulnerable system.
This vulnerability can allow remote users to obtain super-user access on
vulnerable systems, and can allow local users to obtain super-user access.


Vulnerable Systems
~~~~~~~~~~~~~~~~~~

BSD/OS (BSDI)

   Version 2.1 of BSD/OS is vulnerable
   Version 3.0 of BSD/OS is NOT vulnerable

   BSDI has issued a security fix which is currently in the testing
   phases and will be availible at the following location:

        ftp://ftp.bsdi.com/bsdi/patches/patches-2.1/U210-043

Solaris 2.x

   Solaris 2.x is NOT vulnerable to this problem

AIX

   AIX is NOT vulnerable to this problem

HP-UX

   HP-UX is NOT vulnerable to this problem

Linux

   The current versions of Linux which were tested include Slackware
   and Redhat, which appear to be NOT vulnerable.

IRIX

   IRIX appears to be NOT vulnerable.

NetBSD

   Current versions of NetBSD are not vulnerable.

FreeBSD

   Versions of FreeBSD newer than 2.1.5 are NOT vulnerable to this
   problem. FreeBSD-current, FreeBSD 2.1.7 and FreeBSD 2.2.2 are NOT
   vulnerable.

OpenBSD

   Versions of OpenBSD newer than 2.0 are NOT vulnerable to this problem.


Additional Information
~~~~~~~~~~~~~~~~~~~~~~

This problem was discovered by Theo de Raadt <deraadt_at_openbsd.org>

You can contact Secure Networks Inc. at <sni_at_secnet.com> using
the following PGP key:

Type Bits/KeyID Date User ID
pub 1024/9E55000D 1997/01/13 Secure Networks Inc. <sni_at_secnet.com>
                              Secure Networks <security_at_secnet.com>

- - -----BEGIN PG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qIq4JTGh/Nm0Z4UDl2Y1x4GNtm0YqezxUPS0P0A3LHVLJ3Uo5og0G8O
gPNrfbVz5ieT14OSCWCJAJUDBRAy2hd2/3eiMPDVSG0BAVNhBACfupfAcNhhnQaq
aI03DOOiZSRjvql1xw4V+pPhM+IksdSK3YNUZVJJtANacgDhBT+jAPRaYbBWI3A5
ZMdcSNM8aTG0LWMLIOiOYEm6Lgd3idRBFN0Js08eyITl8mhZ33mDe4I0KQri9UiV
ZcPYTbb9CWM6Hv2cMbt6S6kLnFziqIkAlQMFEDLaF0+4CIRSnlUADQEBCLoEAJwt
UofDgvyZ4nCDx1KKAPkkXBRaPMWBp46xeTVcxaYiloZfwHfpk1h2mEJAxmAsvizl
OtIppHl4isUxcGi/E2mLCLMvis22/IQP/9obPahPvgNaMLVtZljO1Nv3QFEkNciL
FEUTNJHR1ko7ibCxkBs4cOpirFuvTMDvWnNaXAf8
=DchE
- - -----END PGP PUBLIC KEY BLOCK-----

Copyright Notice
~~~~~~~~~~~~~~~~
The contents of this advisory are Copyright (C) 1997 Secure Networks Inc,
and may be distributed freely provided that no fee is charged for
distribution, and that proper credit is given.

 You can find Secure Networks papers at ftp://ftp.secnet.com/pub/papers
 and advisories at ftp://ftp.secnet.com/advisories

 You can browse our web site at http://www.secnet.com

 You can subscribe to our security advisory mailing list by sending mail to
 majordomo_at_secnet.com with the line "subscribe sni-advisories"

- -----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQCVAwUBNE1O6bgIhFKeVQANAQG6UQP/ZmaI1E6yhEJKX8tdkwCMZt8GPATb7Ktx
dUW+aapmPiy1f4rOr1TpYg+ntBhQ7Rpifk/umJJ0mHNBwk0zUvnVXWS8OFZxDER/
6wshV0i3ZuVx+FGEqkV1dCDSgsygTieuf5hUGiVpWdpR4vtJ5oZhmzDJH2xOexNp
3bxn5PGOa8w=
=+I+e
- -----END PGP SIGNATURE-----

------- End of Forwarded Message
Received on Sat Oct 25 1997 - 00:05:40 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT