Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 231

Computer Virus

Reviewed byCybersecurity entrepreneur & security researcher

What is Computer Virus?

Computer VirusMalicious code that inserts copies of itself into other programs or files and executes when the host is run.


A computer virus is malware that propagates by attaching its code to legitimate executables, documents, or boot sectors. Unlike a worm, it requires a user action — opening a document, running a program, or booting from infected media — to spread further. Once active, a virus may corrupt data, install additional payloads, exfiltrate information, or simply consume resources.

How infection works

A file-infecting virus modifies a host program so that control flows to the viral code before the original entry point. Common techniques include appending the payload to the end of an executable and rewriting the entry point, prepending it to the start, and cavity infection that hides code in unused padding within the file. Resident viruses stay in memory and infect files as they are opened, while polymorphic and metamorphic engines mutate or re-encrypt the payload on each generation so that static signatures fail — pushing anti-malware vendors toward heuristic and behavioural detection.

Real incidents

The Brain virus (January 1986), written by two brothers in Pakistan, is regarded as the first PC virus; it overwrote the floppy boot sector on IBM-compatible machines. Melissa (1999) was the first widely spread Word macro virus, mailing itself to the first 50 Outlook contacts and causing an estimated US$80 million in damage. ILOVEYOU (2000) and CIH/Chernobyl followed, the latter capable of overwriting the BIOS flash on affected boards.

Defences

Modern controls include up-to-date anti-malware with behavioural analysis, disabling unsigned Office macros by default (Microsoft now blocks macros in files carrying the Mark-of-the-Web), application allow-listing, least-privilege accounts, and timely patching.

flowchart TD
  A[User opens infected file<br/>or runs program] --> B[Viral code executes<br/>before host entry point]
  B --> C{Scan for<br/>uninfected hosts}
  C -->|host found| D[Attach / inject copy<br/>append, prepend, cavity]
  D --> E[Mutate payload<br/>polymorphic engine]
  E --> C
  C -->|trigger condition met| F[Deliver payload<br/>corrupt data / drop malware]
  B --> G[Return control to host<br/>program runs normally]

Examples

  1. 01

    ILOVEYOU (2000), a VBScript virus spread through email attachments.

  2. 02

    CIH/Chernobyl, which corrupted firmware and disk data on infected PCs.

Frequently asked questions

What is Computer Virus?

Malicious code that inserts copies of itself into other programs or files and executes when the host is run. It belongs to the Malware category of cybersecurity.

What does Computer Virus mean?

Malicious code that inserts copies of itself into other programs or files and executes when the host is run.

How do you defend against Computer Virus?

Defences for Computer Virus typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for Computer Virus?

Common alternative names include: Computer virus, File-infecting virus.

Related terms

See also