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
As of March 11, 2003, Symantec Security Response has confirmed that a new minor variant of CodeRed II has been found in the wild.
CodeRed.F differs in only two bytes than the original CodeRed II. CodeRed II will restart the system if the year is greater than 2001. This is no longer the case for this variant.
Symantec antivirus products detect CodeRed.F as CodeRed Worm if it is saved to a file. The worm also drops a Trojan, which will be detected as Trojan.VirtualRoot . The existing CodeRed Removal Tool will correctly detect and remove this new variant.
Please click here for information on how to best leverage Symantec technologies to combat the CodeRed threat.
CodeRed.F scans IP addresses for vulnerable Microsoft IIS 4.0 and 5.0 Web servers and uses a buffer overflow vulnerability to infect the remote computers. The worm injects itself directly into memory, rather than copying itself as a file on the system. In addition, CodeRed.F creates a file detected as Trojan.VirtualRoot . Trojan.VirtualRoot gives the hacker full remote access to the Web server.
If you are running the Microsoft IIS Server, we recommend that you apply the latest Microsoft patch to protect yourself from this worm. The patch can be found 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 .
In addition, Trojan.VirtualRoot takes advantage of a vulnerability in Windows 2000. Download and install the following Microsoft security patch to address this problem and stop the Trojan from re-infecting the computer: http://www.microsoft.com/technet/security/bulletin/MS00-052.asp .
Once CodeRed.F attacks a computer, it is difficult to determine what else the computer has been exposed to.
In most cases, changes—other than those made by CodeRed.F or the dropped Trojan—will not have occurred. However, a hacker may have been able to use the Trojan to access the computer to make changes to it.
Unless you can be absolutely sure that malicious activity has not been performed on the computer, we recommend completely re-installing the operating system.
Antivirus Protection Dates
- Initial Rapid Release version August 05, 2001
- Initial Weekly Certified release date August 05, 2001
Click here for a more detailed description of Rapid Release and Daily Certified virus definitions.
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:
- Calls its initialization routine, which identifies the base address of Kernel32.dll in the process address space of the IIS Server service.
- Looks for the address of GetProcAddress.
- Starts to call GetProcAddress to get access to a set of API addresses, such as:
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:
- The first marker, "29A," controls the installation of the Trojan.VirtualRoot.
- The other marker is a semaphore named "CodeRedII." If the semaphore exists, the worm goes into infinite sleep.
If the Trojan, which the worm drops, has modified the registry key,
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:
so that the value of: SFCDisable
is set to: 0xFFFFFF9D
This disables the System File Checker (SFC).
- 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 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.
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.
Security Response has created a tool to perform a vulnerability assessment of your computer and remove the CodeRed Worm and CodeRed II. To obtain the CodeRed removal tool, click here . If, for any reason you cannot use or obtain the CodeRed removal tool , Manually remove this worm.
To manually remove this worm, apply the required Microsoft patches, remove the files, make several other changes, and then edit the registry. Follow all the instructions sequentially.
Obtaining the patches
Important : Do not skip this step.
Download, obtain, and apply the patch from: http://www.microsoft.com/technet/security/bulletin/MS01-033.asp .
Alternatively, you can download and install the cumulative patch for IIS, which is available at: http://www.microsoft.com/technet/security/bulletin/MS01-044.asp .
Removing the worm files
- Terminate the current process associated with the dropped Trojan (Norton AntiVirus detects this as Trojan.VirtualRoot).
- Press Ctrl+Alt+Delete, and then click Task Manager.
- Click the Processes tab.
- Click the Image Name column heading to alphabetically sort the processes. You should see two processes named Explorer.exe: one of them is legitimate, the other is the Trojan.
- To ensure that the correct process is terminated, click View, and then click "Select Columns...."
- Check the "Thread Count" box, and then click OK.
- A new column will appear in the Task Manager listing the current number of threads associated with each process. (You may need to scroll to the right to see it.)
- Of the two Explorer.exe processes, click the one that has one thread only.
- Once selected, click End Process. (A warning message appears.)
- Click Yes to terminate the process.
- Click File, and then click Exit Task Manager.
- Next, delete the Explorer.exe files created on the infected system. These files have the Hidden, System, and Read only attributes.
- Click Start, and then click Run.
- Type cmd and then press Enter.
- Type the following lines:
attrib -h -s -r explorer.exe
pressing Enter after each one.
This will change to the root directory, remove the attributes, and delete the Trojan from drive C.
- Type d:
and then press Enter.
This will change the focus to drive D, if it exists. (If drive D does not exist, go to step f.)
- Type the following lines:
attrib -h -s -r explorer.exe
pressing Enter after each one.
- Type exit, and then press Enter.
- Using Windows Explorer, delete the following four files, if they exist (They are copies of the file, %Windir%\root.exe.):
- Open the Computer Manager to remove the open shares on the Web server. To do this, right-click the My Computer icon on the desktop, and then click Manage.
(The Computer Management window appears.)
- In the left pane, navigate to \Computer Management (local)\Services and Applications\Default Web Site.
- In the right pane, right-click on the drive C icon, and then click Delete. Repeat this step for any other drives listed under the default Web site.
- Go to the next section.
Editing the registry
CAUTION : We strongly recommend that you back up the system registry before making any changes. Incorrect changes to the registry could result in permanent data loss or corrupted files. Modify the specified keys only. Refer to the document, "How to back up the Windows registry ," before proceeding.
- Click Start, and then click Run. (The Run dialog box appears.)
- Type regedit, and then click OK. (The Registry Editor opens.)
- Navigate to the key:
In the right pane, you will see several values, two of which can be deleted, as CodeRed II created them. Change the others.
- Select the value: /C
Press Delete, and then click Yes to confirm.
- Select the value: /D
- Press Delete, and then click Yes to confirm.
- Double-click the value: /MSADC
- Delete the digits 217 only from the current value data and replace them with the digits 201, and then click OK.
- Double-click the value: /Scripts
- Delete the digits 217 only from the current value data and replace them with the digits 201, then click OK.
NOTE: The CodeRed Removal tool completely deletes the /MSADC and /Scripts entries from the registry. After using the tool, upon restarting IIS, these entries will be recreated with the proper values.
- Do one of the following:
- If this is not a Windows 2000 system, skip to step 16.
- If this is a Windows 2000 systems, proceed to step 13.
- Navigate to the key:
- In the right pane, double-click the value: SFCDisable
- Delete the current value data, and then type 0 (the number zero, not the letter "O"). Click OK.
- Exit the Registry Editor.
- Restart the computer to ensure that CodeRed II has been properly removed.