The main types of malware are viruses, worms, trojans, ransomware, spyware (including keyloggers), adware and other unwanted software, rootkits and backdoors, and coin miners. They differ in two ways: how they spread (a virus infects other files, a worm copies itself across networks, a trojan relies on you installing it) and what they do once they're in (encrypt your files, steal data, hide, or use your computer's resources).
NIST's malware guide (SP 800-83 Rev. 1) defines malware as "a program that is covertly inserted into another program with the intent to destroy data, run destructive or intrusive programs, or otherwise compromise the confidentiality, integrity, or availability" of the victim's data or system. The same guide warns that most real samples mix several types, so treat these categories as a vocabulary rather than a strict taxonomy.
Malware types at a glance
| Type | How it spreads | What it does | Copies itself? |
|---|---|---|---|
| Virus | Infects programs or documents; runs when you open them | Whatever its payload is: damage, data theft, more malware | Yes, into files |
| Worm | Exploits network services or mass-mails itself, without user action | Spreads to other machines, often carries a payload | Yes, as a standalone program |
| Trojan | Disguised as useful software; you install it | Opens a backdoor, installs other malware, steals data | No |
| Ransomware | Phishing, stolen passwords, exposed remote access, unpatched systems | Encrypts files and demands payment; often steals data too | Not by definition |
| Spyware / keylogger | Bundled with other software or installed by a trojan | Records activity or keystrokes and sends them to the attacker | No |
| Adware / unwanted software | Bundled installers, third-party download sites | Changes browser settings, injects ads | No |
| Rootkit | Installed after another compromise | Hides the attacker's presence by altering the system | No |
| Backdoor / bot | Installed by a trojan or exploit | Lets an attacker control the machine remotely; bots attack other hosts | No |
| Coin miner | Email attachments, exploit kits, scripts on websites | Uses your CPU or GPU to mine cryptocurrency | No |
Viruses
NIST: "A virus self-replicates by inserting copies of itself into host programs or data files." Viruses are usually triggered by user action, such as opening a file or running a program. NIST splits them into compiled viruses, run by the operating system (file infectors that attach to executables, boot sector viruses, and multipartite viruses that do both), and interpreted viruses, run by an application. Macro viruses are the best-known interpreted kind: they use the macro language in documents, which is why Office apps ask for explicit consent before running macros from a document.
Worms
A worm is "a self-replicating, self-contained program that usually executes itself without user intervention". That last part is what makes worms fast: nobody has to click anything. NIST distinguishes network service worms, which exploit a vulnerability in a network service to jump from host to host, from mass-mailing worms, which email themselves out. Microsoft's description of WannaCry is a network example: it exploited a previously fixed vulnerability in the SMB file-sharing protocol. "Previously fixed" is the point. Installing updates closes the holes network worms depend on.
Trojans
A trojan horse is "a self-contained, nonreplicating program that, while appearing to be benign, actually has a hidden malicious purpose". It doesn't spread by itself; you install it, believing it's a game, a cracked app, a codec or an invoice viewer. Trojans often act as the first stage that delivers other attacker tools. NIST's description of a typical toolkit attack runs: spam leads users to a website, the website installs trojans through software vulnerabilities, and the trojans then install keyloggers and rootkits.
Ransomware
CISA defines ransomware as "a form of malware designed to encrypt files on a device", after which attackers "demand ransom in exchange for decryption". Many groups also copy data out before encrypting and threaten to publish it, which CISA calls "double extortion". The entry points CISA lists are compromised credentials, phishing, remote desktop exposed to the internet, and unpatched internet-facing systems. Ransomware gets its own article: what ransomware is and how to protect against it.
Spyware and keyloggers
NIST's glossary defines spyware as software "secretly or surreptitiously installed into an information system to gather information on individuals or organizations without their knowledge". A keystroke logger is a specific kind that "monitors and records keyboard use" and either waits for the attacker to collect the log or sends it out by email or file transfer. Keyloggers are why a stolen password alone shouldn't be enough to get into your accounts: two-factor authentication adds a code that changes every 30 seconds.
Adware and potentially unwanted software
Microsoft defines unwanted software as "programs that alter the Windows experience without your consent or control". The usual route is a software bundler: you download one free program and its installer adds others. The signs Microsoft lists are programs you didn't install that are hard to remove, browser settings you can't change back, excessive warnings about your device's health, and ads that can't be closed. This category often sits in a legal grey area, so antivirus products flag it as a "potentially unwanted application" (PUA) rather than malware.
Rootkits and backdoors
NIST counts these as "attacker tools" that malware installs, rather than malware in the strict sense, because they have no way to infect a system on their own. A rootkit is "a collection of files that is installed on a host to alter its standard functionality in a malicious and stealthy way". It hides itself and other malware, which makes it hard even to tell that something is wrong. A backdoor "listens for commands on a certain TCP or UDP port" and lets the attacker run commands or steal passwords. A bot (or zombie) is a backdoor that makes the machine attack other hosts as part of a botnet.
Coin miners (cryptojacking)
Mining cryptocurrency takes a lot of computing power, so some malware simply steals yours. Microsoft lists three common entry points: email attachments, exploit kits on websites, and scripts that mine while you have a web page open. The main symptoms are a computer that runs hot and slow with a fan that won't quiet down. Some mining tools aren't malicious in themselves, so they are detected as PUA.
Fileless malware and supply chain attacks
Two newer terms describe where malware lives or how it arrives rather than what it does:
- Fileless malware keeps little or nothing on disk. Microsoft notes "there's no one definition" and groups it by how much trace it leaves: code that lives only in memory or firmware, scripts hidden in places like the Windows registry or WMI, and malware that needs files but keeps them useless for detection. Scanning files alone doesn't find it, which is why modern antivirus also watches behaviour and memory.
- Supply chain attacks hide malware inside legitimate software by compromising the vendor's build or update process. Because the result is signed by a trusted vendor, Microsoft notes "the malicious code then runs with the same trust and permissions as the app."
How to protect against all of them
Because the categories overlap so much, NIST observes that organisations now use "largely one set of procedures for handling all malware incidents". The same few habits cover nearly every type:
- Install updates for the operating system, browser and apps. Worms, exploit kits and many ransomware entry points depend on vulnerabilities that already have fixes.
- Get software only from the vendor or an official store. Trojans and bundled adware mostly arrive through third-party download sites and cracked software. When a vendor publishes a SHA-256 hash, compare it with the file you downloaded; the checksum tool computes it in your browser.
- Treat unexpected attachments and macro prompts with suspicion, even from people you know. Enabling macros in a downloaded document is exactly what macro malware needs.
- Use two-factor authentication so stolen passwords from spyware or phishing aren't enough on their own.
- Keep offline backups, which CISA lists as a core ransomware defence. A backup the infected computer can't reach can't be encrypted.
If you think your computer is infected
Disconnect it from the network first so nothing spreads or leaves. On Windows, run a full scan from Windows Security, then an offline scan: Windows Security > Virus & threat protection > Scan options > Microsoft Defender Antivirus (offline scan), then start the scan. The PC restarts and scans before Windows loads, which makes it harder for malware that hides itself to interfere. Results appear under Protection history. After cleaning up, change passwords from a different, clean device, starting with email and banking. If the problem is a rootkit or the machine keeps getting reinfected, NIST's advice for persistent threats applies: reinstall the operating system and restore data from known good backups.
Frequently asked questions
- What is the difference between a virus and malware?
- Malware is the umbrella term for any software written to do harm. A virus is one specific type: code that copies itself by inserting into other programs or files and usually needs a person to run the infected file. Every virus is malware, but most malware today is not technically a virus.
- Is a trojan a virus?
- No. NIST defines a trojan horse as self-contained and non-replicating: it doesn't copy itself into other files. It relies on looking harmless, so the user installs it. Viruses replicate by infecting other files. In everyday speech people call both 'viruses', but the distinction matters for how they spread.
- Does antivirus catch every type of malware?
- No. NIST points out that attackers now customise malware for each target, and largely signature-based tools such as traditional antivirus cannot keep up with that variety. Its recommendation is defence in depth: several detection methods plus updates, careful software sources, backups and two-factor authentication, so one missed detection doesn't become a full compromise.
- Is phishing a type of malware?
- Not by itself. NIST notes that phishing is not one of the classic malware categories: it is a trick to make people hand over information, usually through a fake email or website. Phishing is, however, one of the most common ways malware gets delivered, for example through an attachment or a link to a malicious download.
Sources
- NIST SP 800-83 Rev. 1 — Guide to Malware Incident Prevention and Handling for Desktops and Laptops
- NIST CSRC Glossary — spyware
- Microsoft Learn — Understanding malware and other threats
- Microsoft Learn — Fileless threats
- Microsoft Learn — Supply chain attacks
- CISA — #StopRansomware Guide
- Microsoft Support — Help protect my PC with Microsoft Defender Offline