Networks and Security

The Development of the First Computer Viruses

How the idea of self-replicating programs grew from 1940s theory to early personal computer incidents in the 1980s, with credit shared and disputed.

On this page
  1. An idea before a problem
  2. Experiments and games
  3. Elk Cloner and the personal computer
  4. A name and a definition
  5. Brain and the IBM PC
  6. Why the “first” question stays open
  7. What it meant for computing

An idea before a problem

Long before anyone worried about computer viruses, mathematicians were asking an abstract question: can a machine build a copy of itself? In the 1940s, John von Neumann explored this in lectures on self-reproducing automata, drawing on ideas about computation that connect to the work of Alan Turing. His work was published after his death, in 1966. It was theory about the logic of reproduction, not about harmful software, but it established that a system made of ordinary parts and instructions could, in principle, carry a description of itself and use it to make a copy.

A program that copies itself is called a self-replicating program. A simple version is a “quine,” a curiosity in which a program prints its own source text. Programmers have enjoyed writing these for decades, and by themselves they are harmless. A virus adds two further elements: it attaches to something else, such as another program or a disk, and it spreads without the user choosing to run a copy.

Experiments and games

In the 1960s and 1970s, researchers and hobbyists played with replicating code in labs and on shared systems. A short program that moved across the early ARPANET is a frequently cited example, and it is discussed in the cautionary tale of early self-spreading programs. Another strand was a programming game called Core War, popularized in the early 1980s, in which small programs compete for control of a simulated computer’s memory by copying and overwriting each other. The game was a safe sandbox, but it made the logic of replication familiar to a wider audience.

Elk Cloner and the personal computer

The first widely reported viruses that spread among personal computers appeared in the early to mid 1980s. One frequently cited example is Elk Cloner, written around 1982 by a teenager for Apple II computers. It spread by attaching itself to the boot portion of a floppy disk. When an infected disk was used to start a machine, the program copied itself to any other disk inserted afterward. After a number of boots, it displayed a short rhyme. It was a prank and did not set out to destroy data, though bugs in programs of this kind can easily cause accidental damage.

The method of spread is the important point. In an age without wide internet access, the carrier was the floppy disk. Students, hobbyists and office workers swapped disks of games and utilities constantly, and a boot sector virus rode along with each swap. Pirated software and shared disks were common routes, since copies passed through many hands with no checking. The same logic applies to the shared floppy disks that were then the main way to move programs between machines.

A name and a definition

The word “virus” was applied to computer programs in the early 1980s. Fred Cohen, then a graduate student, did experiments in 1983 and wrote about them in the mid-1980s, defining a virus roughly as a program that can infect other programs by modifying them to include a copy of itself. He also showed that no general method can perfectly detect every possible virus, a result related to limits discovered earlier in computing theory. The name has been credited to Cohen’s advisor, Leonard Adleman, though it is worth treating attributions like this loosely, since terms often arise informally in conversation before they appear in print.

Brain and the IBM PC

In 1986, a program commonly called Brain appeared on IBM PC compatible machines. It is often described as one of the first viruses for that platform. Like Elk Cloner, it infected the boot sector of floppy disks. Reports credit two brothers who ran a computer shop in Lahore, Pakistan, and say the program contained their contact details; the story is widely repeated, but details vary by source, and its authors’ intentions are debated. The program spread beyond the original region as disks traveled, which illustrates how quickly a local oddity could become an international one.

Other programs soon followed, including ones that attached to executable files instead of the boot sector. By the late 1980s, an informal ecosystem of virus authors, researchers and security companies had formed. Antivirus programs first appeared around then. They worked by looking for known patterns in files and boot sectors, a scheme that has been refined many times and still has the same basic weakness: it works best against threats someone has already seen.

Why the “first” question stays open

It is tempting to crown a single winner. In practice, several groups worked on related ideas at around the same time.

  • Theoretical work on self-reproduction predates real incidents by decades.
  • Research programs on networks moved from machine to machine in the early 1970s.
  • Hobbyist and teenage projects appeared on home computers in the early 1980s.
  • A formal definition and experiments arrived in the mid-1980s.

Which of these counts as “the first virus” depends on whether one prefers the earliest idea, the earliest running code, the earliest spread in the wild or the earliest harmful program. A fair summary is that the first computer viruses emerged gradually and from several directions.

What it meant for computing

The arrival of replicating programs shifted attitudes toward software. Users began to ask where a disk had come from, and companies began to treat unknown programs with suspicion. Operating system designers paid more attention to separating programs from one another and from system files, a topic that connects with the history of operating systems. The same questions grew sharper once networks connected everyone, which is part of the broader story of computer security.

The complete guide to networks and security

The History of Computer Networking
Read the guide

Keep exploring

Guides from other topics

All topics →