TECHNICAL DETAILS
W32.Cervan.6256 is a fairly complex virus that infects Windows PE files. However, the virus contains several bugs that may cause the it to not work as intended.
W32.Cervan.6256 is entry-point obscuring (EPO). This means that the virus does not run directly when an infected file is executed. Instead, it modifies the import table so that it runs whenever an imported function is called. The virus creates its own import table to do two imports: LoadLibrary and GetProcAddress.
W32.Cervan.6265 is polymorphic. This means that it encrypts itself in a different way each time that it infects a file. The decryption routine is fairly large and contains many instructions that do nothing; therefore, it takes from 1,000,000 to 3,000,000 instructions to decrypt the viral body.
After the virus has decrypted itself, it does the following:
First, the virus manually imports the addresses of several functions in five separate .dll files. It stores the addresses in a table for later use.
Next the virus attempts to allocate about 6 KB of memory. However, as memory on Windows 32-bit platforms is allocated in 4 KB pages, 8 KB of memory will be allocated. After the memory has been allocated, the virus moves its entire body to the newly allocated memory block. From this point, the virus will continue execution in the newly allocated memory block.
W32.Cervan.6256 is multithreaded. Therefore, at this point the virus creates an object to control the secondary thread. However, due to bugs in the viral code, this control mechanism may not work as intended. In some cases, the secondary thread is halted in a wait state instead of executing as intended by the author of the virus.
After the virus creates the object to control the secondary thread, the virus creates and runs the secondary thread.
The main thread manually imports all of the APIs that the original program uses. Because the virus is called when the original host tries to call an API, the virus must call this API itself, or the original host would not work. Therefore, after the virus has completed all of the imports, it finds the API that the original host tried to call and calls it. After this API gives control back to the virus, the virus returns and lets the original host execute.
It is the secondary thread that the virus launched which infects files. As previously mentioned, this code in the virus contains bugs. Therefore, in some cases the secondary thread does nothing. However, if the secondary thread does run, which is generally the case, it does the following:
The virus infects files as they are opened by the original host program. For example, if Notepad.exe were infected, the virus would infect all PE files that are opened in Notepad. However, if Telnet.exe were infected, the virus would not infect any additional files because Telnet.exe does not open files.
The virus infects files by modifying the import table in a manner that causes all imports to point to the virus decryptor through a jumptable. As stated above, the virus does the imports manually to allow the original host to execute normally.
Recommendations
Symantec Security Response encourages all users and administrators to adhere to the following basic security "best practices":
- Turn off and remove unneeded services. By default, many operating systems install auxiliary services that are not critical, such as an FTP server, telnet, and a Web server. These services are avenues of attack. If they are removed, blended threats have less avenues of attack and you have fewer services to maintain through patch updates.
- If a blended 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 (for example, all Windows-based computers should have the current Service Pack installed.). Additionally, please apply any security updates that are mentioned in this writeup, in trusted Security Bulletins, or on vendor Web sites.
- 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.
- Configure your email server to block or remove email that contains file attachments that are commonly used to spread viruses, such as .vbs, .bat, .exe, .pif and .scr files.
- Isolate infected computers quickly to prevent further compromising your organization. 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.