A quick guide to computer viruses - what they are, how they work and the potential consequences of a virus entering and infecting your computer.

What is a virus?

A computer virus is a malicious program designed to insert itself into the code of another program or data file (called a host), then makes copies of the inserted code.

Arriving and infecting

Viruses can be distributed and installed on a computer in many ways, though the most common methods usually involve either: social engineering, to trick the user into receiving and installing the virus themselves; exploiting a vulnerability to silently install the malware; or some combination of the two.

Once the virus arrives on a machine and is run, it begins its attack on the files in the system. Viruses can infect various file types – critical files used by the operating system; document files such as Word or Excel; even special programs tied to the computer's hardware, like the Master Boot Record (MBR). For this reason, viruses are often named by the type of file they infect, such as ‘file infectors' (for system files), ‘Word viruses', and so on.

Damaging the infected

Usually, a virus will replicate each time the host is run and will either insert more code into the same file, or another similar host. As this process repeats, it will usually damage the host and in the most extreme cases, make it completely nonfunctional as the virus takes over it completely.

In addition to infecting and damaging its host, a virus may perform other malicious actions on the affected computer. These actions can range from simple nuisances, such as changing the desktop background, to severely harmful, such as deleting files and programs, modifying or stealing sensitive data files, and so on. The total effect a virus may have on a computer system can be devastating.

The decline of viruses

Viruses used to be the main type of computer threat faced by users in the 1990s, but today most users are more likely to encounter trojans, worms or other types of malware. Though the total number of actual virus infections have dropped over the years, they still remain a threat, especially to users using older, unprotected operating systems or programs.

Technically, viruses can range from fairly simple programs to very sophisticated constructions. Some viruses include features that are similar to the functionality of trojans or worms; others are capable of constantly changing their own code to avoid detection by antivirus programs. These capabilities make viruses more difficult for users to identify and counter this threat.