Computer virus
In computer science a virus is a piece of program code that, like a biological virus, makes copies of itself and spreads by attaching itself to a host, often damaging the host in the process. In the case of viral software, the host is another computer program, often a computer operating system.
As with all code, viruses use the host's resources: memory and hard disk space, amongst others, and are sometimes deliberately destructive (erasing files / formatting hard disks) or allow others to access the machine without authorisation across a network.
The term is often used in common parlance to describe all kinds of malware (malicious software), including those that are more properly classified as worms or trojans. Most popular anti-viral software packages defend against all of these types of attack.
The term "virus" was first used in this sense in print by Fred Cohen in his 1984 paper Experiments with Computer Viruses, where he credits Len Adleman with coining it. However, a mid-1970s science fiction novel by David Gerrold, `When H.A.R.L.I.E. was One' includes a description of a fictional computer program called `VIRUS' that worked just like a virus (and was countered by a program called `ANTIBODY'). A program called "Elk Cloner" is credited with being the first virus to appear "in the wild" (that is, outside the single computer or lab where it was created). Written in 1982 by Rich Skrenta, it attached itself to the Apple DOS 3.3 operating system and spread by floppy disk.
The most endemic viruses since the mid-1990s have been macro viruses that spread through e-mail.
Nature of viruses
Much bandwidth has been wasted arguing about the difference between a virus and a computer worm; the important thing about both is that they spread, and therefore can cause orders of magnitude more trouble than a direct attack or a typical non-spreading Trojan horse.
While viruses can be (and often are) malicious, destroying data, many are fairly benign or merely annoying (for example, displaying a message to the user). Many such viruses have a delayed payload, playing a message on a specific holiday, day of the month, or time of day; or waiting for a certain number of infections or reboots, or randomly occuring with a small chance.
The predominant destructive effect of viruses is their uncontrolled self-reproduction, which wastes or overwhelms computer resources.
"Good" viruses have also appeared that spread improvements to the programs they infected, or delete other viruses. These are, however, quite rare, and still consume system resources.
Virus spread
A virus requires several features from its host software to successfully duplicate itself. It must be permitted to execute code and write to memory. That is why they attach themselves to useful programs, in the hope that users will run those programs (and therefore the virus).
Two main ways viruses spread are by network and by removable media (usually floppy disks). In the early days of personal computers, few were connected via networks and people exchanged information and programs on floppies. Early bulletin board systems were also a common vector. Nowadays, many computers are connected via the Internet and other networks. Today's viruses, therefore, tend to use network communication such as web servers and e-mail to spread. Viruses may also spread between applications which allow intercommunication, as through scripting languages.
Viruses and popular software
Another analogy to biological viruses is worth noting: just as genetic diversity in a population decreases the chance of a single disease wiping out a population, the diversity of software systems on a network similarly limits the destructive potential of viruses.
This became a particular concern in the 1990s, when Microsoft gained market dominance in desktop operating systems and office software. Users of Microsoft software (especially networking software such as Microsoft Outlook and Microsoft Internet Explorer) are particularly vulnerable to the spread of viruses.
Integrated applications, applications with scripting languages with access to the file system (eg: Visual Basic Script, or VBS, and applications with networking features are also particularly vulnerable.
Viruses and software development
Because software is often designed with security features to prevent unauthorized use of system resources, many viruses must exploit software bugs in a system or application to spread. Software development strategies which produce large numbers of bugs will generally also produce potential exploits.
Closed-source software development as practiced by Microsoft and other commercial software companies is also seen as a security weakness. Open source software such as Linux, for example, allows all users to find and fix security problems without relying on a single source. Some advocate that commercial software makers practice vulnerability disclosure to ameliorate this weakness.
Countermeasures
Many users install anti-virus software that can detect and eliminate known viruses. They work by examining the contents of the RAM and the files stored on the hard drive against a database of known virus signatures. Some anti-virus programs are able to scan opened files in addition to sent and received emails 'on the fly' in a similar manner. Anti-virus software does not change the underlying capability of host software to transmit viruses. Users must therefore update their anti-virus software regularly.
See also: Computer security, hacking.