W32.Donut

Risk Level 1: Very Low

Printer Friendly Page

Discovered: January 9, 2002
Updated: February 13, 2007 11:56:28 AM
Type: Virus


On January 9, 2002, the author of this virus sent copies to several antivirus companies. The virus was named "dotNET" by its creator; Norton AntiVirus detects it as W32.Donut.

The virus targets .exe files that were created for the Microsoft .NET framework.

.NET files do not have any platform-dependent code, but they do have a small 5-byte stub. This stub executes the Mscoree.dll _CorExeMain() function, and thus the .NET MISL (intermediate language) gets control if the .NET framework is installed.

Currently a .NET application executes native code before it will execute the platform-independent code. According to Microsoft, this native code will be removed, and the operating system itself will recognize and execute .NET images.

The virus infects .NET executables by attacking the 5-byte jump to the _CorExeMain() function. It replaces this jump with another one to point into the last section of the executable, and it overwrites its .reloc section with itself and nullifies the relocation directory.

When an infected file is executed, the virus code gets control as a 386 application. The virus checks the platform and only infects Windows 2000 and later. It attempts to infect all .exe files that exist in the same folder as the virus and in up to 20 folders above it. It must be noted that there are many assumptions made about the .NET file structure which will not be the case with most executables. Nonetheless, many C# complied files would have similar structure. The virus author worked with the Beta 2 .NET framework and it checks files for the new header signature "BSJB". The virus would therefore ignore the .NET Beta 1 file format. The virus injects itself into the file by using standard virus techniques to get access to the API addresses that it needs to call. Most APIs are referenced in the code as CRCs. The virus also modifies the checksum field of PE headers to make the image look valid.

W32.Donut also injects a small piece of MSIL code and metadata into the infected file. These was designed to execute the payload of the virus and display the following message box with a 1-in-10 chance:



However, due to a bug in the virus code, the payload does not execute as designed, and the message is not displayed. Instead, the virus code will be executed mutiple times instead of the payload being exectued. This is because the entry point call was not fixed up to the original 5 bytes from the copied infected program and will not call the _CorExeMain() function.

Infected files look like regular program files. The virus first drops a file with a fixed .NET header pointer in the Data folder, as well as the jump to the _CorExeMain() function so the application can run as a .NET file whenever the framework is installed. In this case, the MSIL code of the virus gets control and displays the message in the previous paragraph. When the host application returns, the virus creates another copy of the file, and in this case the original MSIL code is executed and the file runs normally. During this process the virus creates a temporary file with the name of the host executable and a space. For example, Runme.exe will have the temporary file "Runme .exe".

W32.Donut is a concept virus, and it has little chance of becoming widespread. It does demonstrate that virus writers are looking at the new Microsoft .NET architecture and that they will attempt to learn it before the framework is available on most systems.

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.

Writeup By: Peter Szor
Search by name
Example: W32.Beagle.AG@mm
Limited Time Offers! Save up to 50%
Windows Vista Security