A virus is a program that is attached to other pieces of code, so that when the user tries to run the original program, they also unintentionally run the virus code. The virus code is designed to replicate itself and "infect" other programs, possibly in a modified form, and may also exhibit other behavior as well.
In order to be a virus, this program must have the ability to run without the user wanting it to and/or create effects that the programmer wants but that the user did not want or request. It must also have the ability to "infect" or modify other files or disk structures, and replicate itself so it can spread to other files or systems.
A virus does not necessarily have to trash your hard drive or exhibit other malicious behavior, in order to be a virus. While many viruses do damage files and disk structures, many are just nuisances or exhibit "prank" behavior such as playing music on the PC speaker or putting funny phrases on the screen when the system is booted.
There are three major types of viruses, each very different from the other. Of course, there are many subcategories within each group as well.
- Boot Sector Infectors: Also sometimes called boot record infectors, system viruses, or boot viruses, these programs attack the vulnerable boot program that is stored on every bootable floppy disk or hard disk. This code is executed by the system when the PC is started up, making it a juicy target for virus writers: by installing themselves here they guarantee that their code will be executed whenever the system is started up, giving them full control over the system to do what they wish. They are spread most commonly through infected bootable floppy disks.
- File Infectors: These viruses directly attack and modify program files, which are usually .EXE or .COM files. When the program is run, the virus executes and does whatever it wants to do. Usually it loads itself into memory and waits for a trigger to find and infect other program files. These viruses are commonly spread through infected floppy disks, over networks, and over the Internet.
- Macro Viruses: The newest type of virus, these clever programs make use of the built-in programming languages in popular programs such as Microsoft Word and Microsoft Excel. These programs allow users to create programs that automate tasks, called macros. As the macro languages have become more powerful, virus writers have created malevolent macros that, when opened unwittingly, duplicate themselves into other documents and spread just like a conventional virus would. These programs can cause just as much damage as regular viruses, despite the fact that they are very different: regular viruses are low-level machine language programs while macro viruses are actually high-level interpreted BASIC programs! The most common type of macro virus right now infects Microsoft Word documents.