Netscape Servers heap buffer overflow can lead to remote code execution (context)
1 Nov. 2000
Summary
An exploitable heap buffer overflow vulnerability was discovered in Netscape's directory Server. The Netscape Certificate Management System also has several server components that share the same problem. Vulnerable systems can be exploited to run arbitrary code on the vulnerable machine.
Credit:
The information has been provided by Iv?n Arce.
Vulnerable systems:
Netscape Certificate Management System 4.2 (Microsoft Windows NT 4.0 version)
Netscape Directory Server 4.12 (Microsoft NT 4.0 version)
Technical Description:
The Netscape Directory Server 4.12 provides a Web to LDAP gateway, by means of the Directory Services Gateway (DSGW) web server. No authentication credentials are required from the client to access DSGW. The same service is installed and used as part of the Certificate Management System (Netscape/iPlanet CMS 4.2) and in this case, it listens on a TCP port chosen during the installation process (24326/tcp in this example).
A request with an URI as follows:
http://www.example.com:24326/dsgw/bin/search?context=<1011 'a' chars>
Will overflow a buffer allocated on the heap.
This buffer is allocated at 404501 with a call to an internal function that ends up calling MSVCRT!malloc. The buffer is allocated with a fixed size of 1024 bytes. Then at 40455B a call to sprintf is made like this:
sprintf(pFixedBuffer, "%s$$LANGDIR/%s.conf", "../context/", userbuff);
Since sprintf doesn't do any bounds checking, the buffer can be overflowed depending on the size of 'userbuff' which is the argument the user specifies to the 'context=' parameter when calling the vulnerable program. A string of 999 bytes is enough to overflow the 'pFixedBuffer' by 1 byte and cause an exception.
Due to the nature of the data overwritten, this vulnerability could be exploited, being possible to execute arbitrary machine code.
The same problem seems to be present in almost all the binaries (12) in the Netscape\Server4\dsgw\bin directory (except for tutor).