J-Security Center

Title: Multiple Vendor BSD ftpd glob() Buffer Overflow Vulnerabilities

Severity: HIGH

Description:

The BSD ftp daemon and derivatives (such as IRIX ftpd or the ftp daemon shipped with Kerberos 5) contain a number of buffer overflows that may lead to a compromise of root access to malicious users.

During the parsing of user input, the ftp daemon assumes that there can never be more than 512 bytes of user-supplied data. This is because that is usually how much data is read from a socket. Because of this assumption, certain memory copy operations involving user data lack bounds checking.

When processing user input, the ftp daemon uses 'glob()' functions to expand wildcards and metacharacters in filepaths, as shells do. An example of this is the tilde ('~') character. The glob() function replaces this character in the filepath with the path to the user's home directory. The output, an expanded path, is then used by the ftp daemon to carry out whatever operation the user desired.

Because metacharacters can expand the length of a path string, it is possible for the data to become larger than 512 bytes once processed by glob(). If this is the case, it becomes possible to exploit the seemingly unexploitable buffer overflow conditions which use the expanded string in unsafe copy operations.

If an attacker can submit input (in the form of a filename or path) to a vulnerable ftp server containing the right metacharacters along with exploit code, it may be possible to exploit one of these bugs in a typical buffer overflow manner. Such a filename would argument a regular ftp command, such as 'LIST'.

In order to carry out the manipulation of input required to exploit this vulnerability on most systems, an attacker would need the ability to create directories with names long enough to create a proper post-glob() string. For users with legitimate local access, this is certainly possible. By default, anonymous users usually do not have access to writeable directories (though sometimes administrators setup a writeable 'incoming' directory). This makes exploitation by anonymous ftp users less likely. However, if directories already exist in the anonymous ftp tree with long enough names, it becomes possible to exploit this vulnerability without creating directories. In configurations where this is the case, remote exploitation by anonymous ftp users may be possible.

Directory name lengths required to exploit this vulnerability without creating directories (from COVERT advisory):

OpenBSD and NetBSD: 12 characters
FreeBSD: 9 characters

Any attacker to successfully exploit this vulnerability would gain root access on the target host.

Affected Products:

  • Compaq Tru64 4.0.0 f
  • Compaq Tru64 4.0.0 f PK6 (BL17)
  • Compaq Tru64 4.0.0 f PK7 (BL18)
  • Compaq Tru64 4.0.0 g
  • Compaq Tru64 4.0.0 g PK3 (BL17)
  • Compaq Tru64 5.0.0
  • Compaq Tru64 5.0.0 PK4 (BL17)
  • Compaq Tru64 5.0.0 PK4 (BL18)
  • Compaq Tru64 5.0.0 a
  • Compaq Tru64 5.0.0 a PK3 (BL17)
  • Compaq Tru64 5.0.0 f
  • Compaq Tru64 5.1.0
  • Compaq Tru64 5.1.0 PK3 (BL17)
  • Compaq Tru64 5.1.0 PK4 (BL18)
  • Compaq Tru64 5.1.0 a
  • Compaq Tru64 5.1.0 a PK1 (BL1)
  • FreeBSD FreeBSD 2.2.0
  • FreeBSD FreeBSD 2.2.2
  • FreeBSD FreeBSD 2.2.3
  • FreeBSD FreeBSD 2.2.4
  • FreeBSD FreeBSD 2.2.5
  • FreeBSD FreeBSD 2.2.6
  • FreeBSD FreeBSD 2.2.8
  • FreeBSD FreeBSD 3.0.0
  • FreeBSD FreeBSD 3.1.0
  • FreeBSD FreeBSD 3.2.0
  • FreeBSD FreeBSD 3.3.0
  • FreeBSD FreeBSD 3.4.0
  • FreeBSD FreeBSD 3.5.0
  • FreeBSD FreeBSD 3.5.1
  • FreeBSD FreeBSD 4.0.0
  • FreeBSD FreeBSD 4.1.0
  • FreeBSD FreeBSD 4.1.1
  • FreeBSD FreeBSD 4.2.0
  • MIT Kerberos 5 1.1.1
  • MIT Kerberos 5 1.2.0
  • MIT Kerberos 5 1.2.1
  • MIT Kerberos 5 1.2.2
  • MandrakeSoft Linux Mandrake 8.1.0
  • MandrakeSoft Linux Mandrake 8.1.0 ia64
  • MandrakeSoft Linux Mandrake 8.2.0
  • MandrakeSoft Linux Mandrake 8.2.0 ppc
  • MandrakeSoft Multi Network Firewall 2.0.0
  • NetBSD NetBSD 1.2.1
  • NetBSD NetBSD 1.3.0
  • NetBSD NetBSD 1.3.1
  • NetBSD NetBSD 1.3.2
  • NetBSD NetBSD 1.3.3
  • NetBSD NetBSD 1.4.0
  • NetBSD NetBSD 1.4.1
  • NetBSD NetBSD 1.4.2
  • NetBSD NetBSD 1.4.3
  • NetBSD NetBSD 1.5.0
  • OpenBSD OpenBSD 2.3.0
  • OpenBSD OpenBSD 2.4.0
  • OpenBSD OpenBSD 2.5.0
  • OpenBSD OpenBSD 2.6.0
  • OpenBSD OpenBSD 2.7.0
  • OpenBSD OpenBSD 2.8.0
  • RedHat Linux 6.2.0
  • RedHat Linux 6.2.0 alpha
  • RedHat Linux 6.2.0 i386
  • RedHat Linux 6.2.0 sparc
  • RedHat Linux 7.0.0
  • RedHat Linux 7.0.0 alpha
  • RedHat Linux 7.0.0 i386
  • RedHat Linux 7.1.0
  • RedHat Linux 7.1.0 alpha
  • RedHat Linux 7.1.0 i386
  • RedHat Linux 7.1.0 ia64
  • RedHat Linux 7.2.0
  • RedHat Linux 7.2.0 i386
  • RedHat Linux 7.2.0 ia64
  • SGI IRIX 6.5.0
  • SGI IRIX 6.5.1
  • SGI IRIX 6.5.10
  • SGI IRIX 6.5.11
  • SGI IRIX 6.5.2 m
  • SGI IRIX 6.5.3
  • SGI IRIX 6.5.3 f
  • SGI IRIX 6.5.3 m
  • SGI IRIX 6.5.4
  • SGI IRIX 6.5.5
  • SGI IRIX 6.5.6
  • SGI IRIX 6.5.7
  • SGI IRIX 6.5.8

References:

Juniper Networks provides this content via a wide variety of sources and production methods. If notified of errors or omissions in the content of this page, Juniper Networks, at its discretion, will modify or remove the page or leave the content as is, depending on various factors including but not limited to the reputation and authority of the party providing the notification. Please use the contact information displayed elsewhere on this page to report any errors or omissions regarding the content on this page.