Computer Security

The Story of the First Computer Virus

Why a program that copies itself became possible: von Neumann's self-copying automata, stored programs, and the disputed question of which program counts as first.

On this page
  1. Starting with the wrong question
  2. Machines that copy themselves
  3. Why computers made it easy
  4. Games and cellular worlds
  5. From idea to defined threat
  6. Competing claims to “first”
  7. Why the theory still matters

Starting with the wrong question

“What was the first computer virus?” sounds as if it has a single answer. It does not, and the reason is partly about definitions and partly about history. Different programs have a claim depending on whether you require that the code spread between different machines, infect other programs, spread outside a laboratory, or be harmful. This article is about the ideas that made any such program possible; the specific candidates have their own articles.

Machines that copy themselves

The theoretical groundwork belongs to the mathematician John von Neumann. In the late 1940s he gave lectures on whether a machine could construct a copy of itself, using the abstract language of “automata.” His motivation was to understand how living things reproduce and how complex systems could grow from simple parts, not to imagine malicious programs. He described a design in which a machine contained a description of itself, used it to build a copy, and then passed along the description so the copy could do the same. His lecture notes were assembled and published after his death in 1957 under the title Theory of Self-Reproducing Automata.

Interestingly, that structure, a description that is both used as instructions and copied as data, has a close parallel in biology. It was laid out before the structure of DNA was widely understood, which is one reason the work is admired.

Why computers made it easy

A modern computer follows the stored-program design: instructions sit in memory in the same form as other data. That is the feature that makes self-copying code simple. A program can read its own instructions as data and write them somewhere else.

Computer scientists have also studied programs that print their own source code, now called quines, after the philosopher Willard Quine. The related mathematical result that such programs must exist for any sufficiently capable language is usually attributed to Stephen Kleene in work from the late 1930s. In practice, writing a quine is a standard programming puzzle. Self-replication, in short, is not an exotic trick; it follows naturally from how general-purpose computers work.

Games and cellular worlds

Self-copying was also explored as play. In 1970 the mathematician John Conway introduced the Game of Life, a grid in which simple rules produce shapes that move and grow, and later enthusiasts found patterns that can construct copies of themselves. In 1984, the researcher Christopher Langton devised a small self-reproducing loop in a similar cellular system. These were studies of life-like behavior, with no connection to damaging software.

One early game of a different kind, often called Darwin, was reportedly invented at Bell Labs in the early 1960s, in which programs competed in a shared memory space to overwrite one another. In 1984 the columnist A. K. Dewdney described a similar contest called Core War to a wide audience in Scientific American. The game turned self-copying code into a sport, and the techniques overlapped with those of virus writers.

From idea to defined threat

In the 1970s, writers began to imagine self-spreading programs on networks. The science-fiction novel The Shockwave Rider, published in 1975, described a “tapeworm” program that spreads through a network, and some earlier fiction used the word “virus” for such code. Whether any real programmers were directly inspired is hard to prove.

The formal step was taken by Fred Cohen. In 1983, as a graduate student, he demonstrated a self-spreading program on a Unix computer and presented the work in the following year. He is widely credited with defining a computer virus as a program that modifies other programs to include a possibly evolved copy of itself. Cohen has said that his adviser Leonard Adleman suggested the term. The experiments showed that, with the right conditions, such a program could spread through a whole system quickly. He also argued, mathematically, that no perfect method exists for detecting every virus, a result that still shapes how antivirus scanners are designed: they work with partial answers.

Competing claims to “first”

Several programs are put forward as the first, each with a different reason:

  • Creeper, an early 1970s experiment on a research network, moved between computers but did not infect other programs.
  • Programs from the mid-1970s, such as a game-based one that spread across shared computers, are sometimes mentioned, although details differ across retellings.
  • Elk Cloner in 1982 spread on Apple II floppy disks outside a laboratory.
  • Cohen’s 1983 experiment was the first carefully documented and controlled demonstration.
  • The Brain virus of 1986 is often called the first for IBM PC compatibles.

Which one you choose follows from the definition you prefer, and careful historians usually give a short list instead of a single name. Some of the stories told about the earliest cases cannot be confirmed from original sources, so it is wise to treat very exact claims with caution.

Why the theory still matters

Understanding that self-copying is a natural property of general-purpose computers explains why virus defense is difficult. You cannot ban a capability that is built into the way electronic computers work. Defenders must instead limit what a program is allowed to touch, check where code comes from, and look for suspicious behavior. The history of the first virus, then, is less the story of one clever hack than of an idea that was waiting to be noticed once computers became common enough to carry it.

The complete guide to computer security

The Development of the Computer Virus: A Threat to Cybersecurity
Read the guide

Keep exploring

Guides from other topics

All topics →