Remote "0Day" IIS FTPd Exploit
On September 1, 2009 security researcher "kingcope" released an exploit for a previously undisclosed vulnerability in the Microsoft IIS 5.0/6.0 FTP Server. Microsoft had not been made aware of the problem, therefore there is no patch available at this time. The exploit is known to work against Windows 2000 servers running IIS 5.0 and 6.0, and rumored to cause a denial of service against 6.0 on Windows 2003.
Prerequisites for the Vulnerability
A system is vulnerable if anonymous FTP is enabled (however, this may also work with valid credentials) and there is a world-writable directory on the system. There are two plugins that Nessus uses as dependencies to discover this information and a third to test for the actual vulnerability:
- Anonymous FTP Enabled (Plugin ID 10079) - This plugin checks to see if anonymous logins are allowed by the FTP server. This is a vulnerability in itself as it could expose data on the FTP server. In addition, several exploits, such as this one, require that the user be logged into the system and anonymous access grants login rights to anyone.
- FTP Writable Directories (Plugin ID 19782) - This plugin tests if the FTP server allows anonymous users to create files and directories. Since the buffer overflow in the most recent IIS FTP vulnerability occurs when a directory contains certain characters, creating such a directory is a requirement. This is a vulnerability all on its own, as giving all Internet users the ability to write files and directories on your server can lead to all sorts of nefarious activity.
- Microsoft IIS FTPd NLST Remote Buffer Overflow Vulnerability (Plugin ID 40825) - If anonymous login is enabled, and there are writable directories, the banner is checked to see if the FTP service is running IIS FTP version 5.0. When all of these conditions are met, the system is vulnerable to the remote buffer overflow, resulting in remote command execution with SYSTEM privileges.
Vulnerability Quick Check
When “zero day” exploits are released, organizations often need to quickly identify which systems are vulnerable in their environment to mitigate risk appropriately. Time is critical as the organization races to find vulnerabilities in their network before potential attackers do. The "nessuscmd" utility comes in handy as it can quickly scan networks for the presence of a single vulnerability, as shown below:
|/opt/nessus/bin/nessuscmd -osilent_dependencies=no -P0 -i 40825 -V -U -p80,21 192.168.1.227|
The flags used in this command perform the following functions:
|-osilent_dependencies=no||Override the server configuration in nessusd.conf to display silent dependencies. The "silent dependencies" option prevents the output from being cluttered with other plugin output and is enabled by default. Setting the silent dependencies option to “no” displays the output of the supporting plugins described above. This provides information such as which directories were found to be writable.|
|-P0||Disable ping checks since we are only scanning for two TCP ports.|
|-U||Disable safe checks|
|-p80,21||Limit the scan to TCP ports 80 and 21|
|-V||Force nessuscmd to print the full plugin output|
|-i 40825||Define the plugin ID (In this case plugin id 40825, "Microsoft IIS FTPd NLST Remote Buffer Overflow Vulnerability")|
An example of the output produced by the command above when discovering a vulnerable host is shown below:
|+ Results found on 192.168.1.227 :
- Port ftp (21/tcp) is open|
[!] Plugin ID 40825
| Synopsis :
| The remote anonymous FTP server seems vulnerable to an arbitrary
| code execution vulnerability.
| Description :
| The remote FTP server allows anonymous users to create directories
| in one or more locations. The remote version of this server is vulnerable to a
| buffer overflow in the NLST command which, when coupled with the
| ability to create arbitrary directories, may allow an attacker to execute
| arbitrary commands on the remote Windows host with SYSTEM privileges.
| See also :
| Solution :
| None at this time. Upgrade to Windows 2003 or newer
| Risk factor :
| Critical / CVSS Base Score : 10.0
| Plugin output :
| The directory /incoming could be used to exploit the server
| BID : 36189
Using the extensive plugin database available to Nessus, new vulnerabilities such as the IIS FTP server buffer overflow can be enumerated quickly. Nessus contains several plugins that detect different configurations and conditions, which alone could present risk. You can use Nessus to test for these vulnerabilities by using the NessusClient, "nessuscmd" or Tenable's Security Center.