J-Security Center

Title: ISC Bind 4 nslookupComplain() Buffer Overflow Vulnerability

Severity: CRITICAL

Description:

BIND is a server program that implements the domain name service protocol. It is in extremely wide use on the Internet, currently being used by most Internet DNS servers.

Version 4 of BIND contains a stack overflow that may be exploitable by attackers to gain root access remotely.

When BIND 4 nameservers recieve a query for a hostname, the first thing that happens is that their own zone files and caches are checked for records that match requested address/hostname. If the hostname cannot be resolved through these local means, BIND obtains the nameservers that are responsible for the host's domain.

Once it has the proper NS records, BIND calls nslookup() to obtain the IP addresses of these nameservers. The nslookup() function checks each nameserver IP address for validity. If it is invalid (ie, 0.0.0.0, 255.255.255.255 or a multicast address), it calls nslookupComplain()to log the error to syslog.

A buffer overflow condition exists in the nslookupComplain() function. When generating the error message, nslookupComplain() uses sprintf() to construct a null terminated string. This string is 999 bytes in length and is a local variable. If the nameserver hostname exceeds the length of the buffer size, it will be copied over nslookupComplain()'s stack variables when the string is created. Because the buffer size is so large, it may require that the attacker use more than one malicious DNS server to build a fully qualified domain name long enough to cause the overflow.

As stated above, this vulnerability could be exploited to gain remote access to the host on which BIND 4 is running. By replacing the return address with an address pointing to supplied shellcode, an attacker can execute arbitrary code.

It should be noted, however, that the bytes an attacker may use to carry out this attack must be characters allowed in Internet hostnames. It may not be possible to build a valid return address from these bytes.

Affected Products:

  • HP HP-UX 10.10.0
  • HP HP-UX 10.20.0
  • HP HP-UX 10.24.0
  • HP HP-UX 11.0.0
  • HP HP-UX 11.0.0 4
  • ISC BIND 4.9.0
  • ISC BIND 4.9.3
  • ISC BIND 4.9.4
  • ISC BIND 4.9.5
  • ISC BIND 4.9.5P1
  • ISC BIND 4.9.6
  • ISC BIND 4.9.7
  • ISC BIND 4.9.7-T1B
  • ISC BIND 8.2.0

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.