CodeRed.F

Risk Level 2: Low

Download Removal Tool | Printer Friendly Page

Discovered: March 11, 2003
Updated: February 13, 2007 11:44:14 AM
Also Known As: CodeRed.v3, CodeRed.C, CodeRed III, W32.Bady.C, W32/CodeRed.f.worm [McAfee], Win32.CodeRed.F [CA]
Type: Trojan Horse, Worm
Systems Affected: Microsoft IIS
CVE References: CVE-2001-0500 CVE-2001-0506


CodeRed.F propagates by installing itself into a random Web server using a known buffer overflow exploit, contained in the file, Idq.dll. Only systems that have not been patched with the latest Microsoft IIS service packs can be affected.

Microsoft has published information on this vulnerability, and a Microsoft patch is available at http://www.microsoft.com/technet/security/bulletin/MS01-033.asp. A cumulative patch for IIS, including the four patches released to date, is available at http://www.microsoft.com/technet/security/bulletin/MS01-044.asp. System administrators are encouraged to apply the Microsoft patch to prevent infection from this worm, as well as other unauthorized access.

When a Web server is infected, the worm:
  1. Calls its initialization routine, which identifies the base address of Kernel32.dll in the process address space of the IIS Server service.
  2. Looks for the address of GetProcAddress.
  3. Starts to call GetProcAddress to get access to a set of API addresses, such as:

LoadLibraryA
CreateThread
..
..
GetSystemTime

Then, the worm loads WS2_32.dll to access the functions, such as socket, closesocket, and WSAGetLastError. From User32.dll, the worm gets ExitWindowsEx, which it uses to restart the system.

The main thread checks for two different markers:
  1. The first marker, "29A," controls the installation of the Trojan.VirtualRoot.
  2. The other marker is a semaphore named "CodeRedII." If the semaphore exists, the worm goes into infinite sleep.
Next, the main thread checks the default language. If the default language is Chinese (either Taiwan or PRC), it creates 600 new threads; otherwise, it creates 300. These threads generate random IP addresses, which are used to search for new Web servers to infect. While these threads are working, the main thread copies Cmd.exe from the Windows NT \System folder to the following folders, if they exist:
  • C:\Inetpub\Scripts\Root.exe
  • D:\Inetpub\Scripts\Root.exe
  • C:\Progra~1\Common~1\System\MSADC\Root.exe
  • D:\Progra~1\Common~1\System\MSADC\Root.exe

If the Trojan, which the worm drops, has modified the registry key,

HKEY_LOCAL_MACHINE\System\CurrentControlSet\
Services\W3SVC\Parameters\Virtual Roots

by adding a few new keys and setting the user group to 217, it allows a hacker to control the Web server by sending an HTTP GET request to run scripts/root.exe on the infected Web server.

The main thread sleeps for 48 hours on Chinese systems and for 24 hours on other systems. The 300 or 600 threads will still work and attempt to infect other systems. When the main thread wakes up from its sleep, it causes the computer to restart. In addition, all the threads check whether the month is October or later, or whether the year is greater than 34951. If so, the computer is restarted.

The worm copies the command shell (Cmd.exe) to the default execution-enabled directory of the IIS Web server, allowing remote control. It also drops a file, which has its attributes set to Hidden, System, and Read only, onto the root drive as either or both C:\Explorer.exe or D:\Explorer.exe. Norton AntiVirus identifies these Trojan files as Trojan.VirtualRoot. The worm carries this file inside itself in a packed format and unpacks it when it is dropped.

The infection lasts for 24 or 48 hours, and then the computer is restarted. However, the same computer can be re-infected until it is patched with the latest update from Microsoft. If the month is October or later, or the year is greater than 34951, the computer will also be restarted. When the computer is restarted, Trojan.VirtualRoot is executed when the system attempts to execute Explorer.exe, due to the way Windows NT resolves or searches the program paths when executing a program. The Trojan (C:\Explorer.exe) sleeps for a few minutes and resets these keys to assure that the registry keys are modified.

NOTE: After a restart, the memory-resident worm will be inactive, which means that on an infected system that has been restarted, the worm will not attempt to spread itself to other machines unless it happens to get re-infected.

The Trojan also alters the registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\
Windows NT\CurrentVersion\Winlogon


so that the value of: SFCDisable

is set to: 0xFFFFFF9D

This disables the System File Checker (SFC).

NOTES:
  • If you are running Microsoft FrontPage or a similar program used to design Web pages, IIS may be installed on your computer.
  • For additional information, including the string added to the IIS log files, go to the CERT Coordination Center page at: http://www.cert.org/incident_notes/IN-2001-08.html.

Symantec ManHunt
Symantec Manhunt 2.2 detects CodeRed.F with its Anomaly Engine as "HTTP Malformed URL," and if the latest signature update has been applied, this will be detected as "HTTP_IIS_ISAPI_Extension" under Hybrid Mode.

Symantec Gateway Security, NetProwler, Norton Internet Security, Norton Internet Security Professional Edition, Symantec Client Firewall
The aforementioned products detect CodeRed.F under the HTTP_IIS_ISAPI_EXTENSION signature.

Symantec Intruder Alert 3.6
Symantec Intruder Alert 3.6 detects CodeRed.F under the iis-code_red_worm.pol policy.

Symantec Host Intrusion Detection System
Symantec Host Intrusion Detection System detects CodeRed.F under the W2K_MS_IIS_CodeRedWorm_Detected.pol policy.

Recommendations

Symantec Security Response encourages all users and administrators to adhere to the following basic security "best practices":

  • Use a firewall to block all incoming connections from the Internet to services that should not be publicly available. By default, you should deny all incoming connections and only allow services you explicitly want to offer to the outside world.
  • Enforce a password policy. Complex passwords make it difficult to crack password files on compromised computers. This helps to prevent or limit damage when a computer is compromised.
  • Ensure that programs and users of the computer use the lowest level of privileges necessary to complete a task. When prompted for a root or UAC password, ensure that the program asking for administration-level access is a legitimate application.
  • Disable AutoPlay to prevent the automatic launching of executable files on network and removable drives, and disconnect the drives when not required. If write access is not required, enable read-only mode if the option is available.
  • Turn off file sharing if not needed. If file sharing is required, use ACLs and password protection to limit access. Disable anonymous access to shared folders. Grant access only to user accounts with strong passwords to folders that must be shared.
  • Turn off and remove unnecessary services. By default, many operating systems install auxiliary services that are not critical. These services are avenues of attack. If they are removed, threats have less avenues of attack.
  • If a threat exploits one or more network services, disable, or block access to, those services until a patch is applied.
  • Always keep your patch levels up-to-date, especially on computers that host public services and are accessible through the firewall, such as HTTP, FTP, mail, and DNS services.
  • Configure your email server to block or remove email that contains file attachments that are commonly used to spread threats, such as .vbs, .bat, .exe, .pif and .scr files.
  • Isolate compromised computers quickly to prevent threats from spreading further. Perform a forensic analysis and restore the computers using trusted media.
  • Train employees not to open attachments unless they are expecting them. Also, do not execute software that is downloaded from the Internet unless it has been scanned for viruses. Simply visiting a compromised Web site can cause infection if certain browser vulnerabilities are not patched.
  • If Bluetooth is not required for mobile devices, it should be turned off. If you require its use, ensure that the device's visibility is set to "Hidden" so that it cannot be scanned by other Bluetooth devices. If device pairing must be used, ensure that all devices are set to "Unauthorized", requiring authorization for each connection request. Do not accept applications that are unsigned or sent from unknown sources.
  • For further information on the terms used in this document, please refer to the Security Response glossary.
Search by name
Example: W32.Beagle.AG@mm
Windows 7
Windows Vista Security