Main menu
Definition

Virus

A virus is infectious malware that can replicate itself and execute its code into legitimate programs. Learn how computer viruses work, how they spread, how they differ from worms and Trojans, and how to protect against them.

DTDevolutions Team·November 12, 2026·2 min read

What is a virus?

A computer virus is a type of malware that attaches itself to a legitimate program, file, or boot area of a disk. When the infected host runs, the virus runs too, copies itself into other files or systems, and may carry out a harmful action, called its payload, such as deleting files, corrupting data, or installing other malware. Like a biological virus, it needs a host to spread.

How does a virus work?

  1. Infection: the virus inserts its code into a host, such as an executable, a document macro, or a disk's boot sector.
  2. Dormancy: it may stay inactive until a trigger, such as a date or a specific action.
  3. Replication: when the host runs, the virus copies itself into other programs or files, and spreads when those are shared through email, downloads, removable media, or network shares.
  4. Payload: it carries out its harmful action.

Types include file infectors, macro viruses (in documents), boot sector viruses, and polymorphic viruses that change their code to avoid detection.

Virus vs. worm and Trojan

A virus needs a host program and usually some user action to spread. A worm spreads by itself across networks, without a host file. A Trojan disguises itself as legitimate software and does not replicate. "Virus" is often used loosely for all malware, but it is one specific type.

Why does a virus matter?

Classic viruses are less common than they once were, but the same techniques live on in modern malware. Viruses can spread from one system to many through shared files, so containment matters. Endpoint protection, patching, disabling macros from untrusted sources, limiting administrative rights, and good backups reduce their impact.

Frequently asked questions

What is a computer virus?

A virus is infectious malware that can replicate itself and execute its code into legitimate programs.

What is the difference between a virus and a worm?

A virus needs a host file and usually user action to spread. A worm spreads by itself across networks.

Can antivirus software remove every virus?

Not always. New or heavily disguised viruses may go undetected at first, so antivirus works best alongside patching, least privilege, and backups.

Limit what malware can do with admin rights

Grant access only for the moment it's needed, then revoke it automatically.

Explore Devolutions PAM

Related terms

Malware

Malware is malicious software: a generic term for software designed to execute harmful or disruptive attacks on a server, network, or computer.

Read now →

Worm

A worm is infectious malware that can replicate itself and operate independently.

Read now →

Trojan horse

A Trojan horse is well-disguised malware that appears legitimate.

Read now →