For technique of Virus and Trojan Detection and Engines. I think these resources will help. I know it is frustrating to answer some of the question that have and will come up. But when they start getting very technical this information might help if you have time to read it all
********************
Antivirus Research and Detection Techniques
http://www.extremetech.com/article2/0,3973...3,325439,00.asp
Polymorphic and Metamorphic Detection
Scanning with signatures or analyzing code sequences is only possible when a virus is in an unencrypted form. Since the purpose of a virus is to run and spread as far as it can before being discovered, virus writers will use techniques to avoid detection. One early technique was to encrypt the virus so that a signature scanner couldn't get a match. These polymorphic viruses would change form each time the virus infected a new victim, encrypting its code to look like gibberish to the scanner. When the virus was run, a decryptor engine built into the virus code would run first, and decrypt the virus executable code. The engine would then pass execution to the virus code to do the dirty work.
To work, a decryptor engine must be a valid executable that the OS recognizes. In some cases, antivirus software is able to get signatures of the decryptors for detection. However, knowing that, the virus writers started obfuscating the code by adding bogus code, and using different instructions to accomplish the same thing. The virus would randomly put extra instructions such as jumps between each valid instruction, or just add junk code that looks good, but doesn't do anything. If the code was not too badly changed, it was still possible to get heuristic signatures that could still identify code sequences, or "magic numbers" that wouldn't change between versions.
Heuristic techniques are generally engaged when signature-based scanning does not reveal a problem. If the heuristic indicates the file is suspicious, it's loaded into an isolated virtual machine that emulates a basic execution environment. The virtual machine, while not as complex as standalone products like VMware or VirtualPC, provides enough emulation that the virus thinks it is executing on the victims PC, and decrypts itself. Once decrypted, the code is scanned with the signature scanner to attempt to identify the virus. If it does, the execution ends, and the virus is eradicated.
Metamorphic viruses, however, will change the structure of the virus body as well as the decryption engine, making it impossible to get a signature match. To get an idea of the lengths that a virus can go to, consider the W32.Simili virus as described in the Virus Bulletin, May, 2002. The W32.Simili virus uses a polymorphic decryptor which changes size and location in its infections. It creates a metamorphic virus body by disassembling the virus to an intermediate form, compresses it by removing redundant and unused code, then mutating it by reordering functions and breaking up code. It then expands the intermediate form by adding random redundant code and unused instructions. It finally reassembles the intermediate code to a native code which is used to infect other hosts. To add insult to injury, the payload, a message box, is only displayed on certain days, depending on the virus variant.
This type of virus is run within the emulator, and its behavior is monitored. Much like the techniques used by researchers in the labs, the heuristic scanner looks for behaviors like disassembling code, adding code, or encrypting files, and analyzes the probability of an infection. Running a suspicious file in a virtual machine can effectively find malicious code that reveals its form or intent early in the process, but it can't keep the suspicious file in an analysis state forever. Additionally, since many viruses do not always infect an application's entry point, the antivirus software needs to figure out where to find the descriptor code in the first place, which can take more time. When you run an application on your PC, a small amount of delay could be tolerated, but if you had to wait until the date changes to an odd number, you would quickly uninstall the antivirus software, of course! In the cases where the emulation does not find an infection, either by signatures, or behaviors, the antivirus software will then rely on certain on-the-fly methods.
For on-the-fly scanning, antivirus products hook the Windows APIs, and DOS interrupts that are focused on loading and executing applications. When the application is run, the antivirus software is aware of the situation and scans the file for virus signatures or static behaviors. If it's clean, the application is allowed to run, but under the watchful eye of the antivirus heuristics. The heuristics hook APIs and interrupts for potentially damaging system calls, like writing and deleting files, or accessing SMTP or email functions. As the program makes the calls, the behaviors are analyzed for suspicious actions. If the executing program makes a series of suspicious actions, the antivirus watchdog will pop up a warning that it may be a virus.
Conclusion
As you can see, no one detection method works for all cases. Virus detection is accomplished more often by a combination of many tests and techniques. The researcher's goal with every new virus is to find positive identifying characteristics that can be incorporated into the scanner for a quick and safe detection. Through analysis of existing threats, patterns of form, architecture, and behavior emerge that are used to create heuristic methods that may catch the next new threat before it has been identified. As we rely more and more on computers, networks and the Internet, the stakes are rising. No one antivirus package is foolproof. Virus writers are getting more sophisticated, and viruses are more complex. It is a constant volley between virus writers and antivirus researchers to keep a step ahead of the other.
For users, either corporate, or personal, the best defense is a good offense. Using common sense, like not opening unidentified email, turning off boot from floppy in the BIOS, and turning on macro security in your Office applications, can go a long way to preventing infection. Corporate IT can minimize infection through policies and monitoring at the firewall, such as blocking double extension (.jpg.vbs) attachments and scanning inbound and outgoing mail. Choosing an antivirus product is a serious decision, and we'd recommend checking the Virus Bulletin site for reports on the latest tests and software. Most antivirus software is certified by the ICSA labs, which tests against the monthly Wild List. The Wild list represents the current viruses that have been reported "in the wild" or actually found on users machines. Check out the ICSA Labs site for information and product certification. And lastly, when using an antivirus tool on the desktop, as well as at the gateway, remember the tool is only as good as its last update.
*****************************
Heuristic Scanning
http://www.extremetech.com/article2/0,3973...3,367096,00.asp
Types of Heuristics
http://www.extremetech.com/article2/0,3973...3,367092,00.asp
Conclusion
http://www.extremetech.com/article2/0,3973...3,367094,00.asp