Virus

Malicious code that copies itself into host programs, documents or boot records and usually runs only when a user opens or runs the infected host, unlike a worm, which spreads alone.

A virus is malicious code that replicates by inserting copies of itself into other programs, data files or boot records. NIST SP 800-83 Rev. 1 notes that viruses are often triggered through user interaction, such as opening a file or running a program. It divides them into compiled viruses, run by the operating system, including file infectors, boot sector viruses and multipartite viruses that combine the two, and interpreted viruses, run by an application. A macro virus is the best-known interpreted kind: it lives in a document or template and uses the application’s macro language to spread.

The distinction candidates commonly confuse is with a worm, which is self-contained and usually spreads without anyone acting. A polymorphic virus changes the appearance of its code each time it copies itself, for example by re-encrypting its body under a new key and varying the routine that decrypts it, so no single byte pattern matches every copy. Signature-based detection alone struggles with it, so heuristic and behaviour monitoring are added. Blocking macros from untrusted sources is a common control against macro viruses.

Exam relevance: a scenario in which an infection spreads only when staff open a shared document is likely to describe a virus. Candidates are expected to separate it from a worm by the need for a host and user action.