Explainer
How malware works: viruses, worms, trojans and infostealers
Malware is software or firmware deliberately placed in a system for a harmful purpose, and NIST calls it the most common external threat to most computers.[1][2] Viruses spread by modifying other programs, worms spread across networks on their own, and trojans hide a malicious purpose behind a useful-looking program. Infostealers such as Lumma, which Microsoft found on more than 394,000 Windows computers in two months of 2025, harvest passwords and financial details.[3][4][5][6]
This explainer describes how malicious software works and what government agencies advise. It does not recommend any product.
What counts as malware
Malware is short for “malicious software”. The US standards body NIST defines it as hardware, firmware or software deliberately put into a system for a harmful purpose.[1] The FTC’s plain-language version: harmful software installed on your device without your knowledge, of which viruses, spyware and ransomware are common types. Criminals use it to steal things like passwords and bank account numbers.[7]
CISA frames malware by purpose: any software used to gain unauthorized access to IT systems to steal data, disrupt services or damage networks.[8] The UK National Cyber Security Centre (NCSC) lists the harms: locking devices, stealing, deleting or encrypting data, hijacking devices to attack others, harvesting credentials and mining cryptocurrency.[9] NIST’s malware incident guide calls it the most common external threat to most hosts.[2]
The classic families
The traditional categories below follow NIST’s definitions; a single piece of malware can combine several.
- Viruses spread by modifying other programs to include a copy of themselves, and run when the infected program is run.[3]
- Worms are self-replicating programs that spread through a network to other computers without needing a host program or a user to do anything.[4] A network service worm, for example, exploits a flaw in a network service to jump from machine to machine.[10] Ransomware can behave this way too: the NCSC notes that some ransomware tries to spread to other machines on a network, citing WannaCry, which hit the NHS in May 2017.[11]
- Trojans don’t replicate. They look harmless but hide a malicious purpose.[5]
- Rootkits are toolkits an attacker installs after gaining full (“root”) access, to hide their activity and keep that access.[12]
- Backdoors and keyloggers are attacker tools. A backdoor listens for commands so an attacker can steal passwords or run commands, and a keystroke logger records what you type.[13]
Ransomware has its own explainer: how ransomware works.
Infostealers and malware as a service
Some criminal malware is rented out rather than used only by its authors. Microsoft describes Lumma Stealer as malware-as-a-service, sold on underground forums since at least 2022, that steals passwords, credit cards, bank account details and cryptocurrency wallets.[14] Between 16 March and 16 May 2025 Microsoft found more than 394,000 Windows computers infected with it.[6]
In May 2025 Microsoft’s Digital Crimes Unit, acting under a US court order, seized or helped take down about 2,300 domains that formed the backbone of Lumma’s infrastructure, while the US Justice Department seized its central command structure.[15] Stolen credentials like these are one reason agencies push for two-factor authentication: the NCSC recommends it so that credentials stolen by malware cannot easily be reused.[16]
How infections start
NIST says current malware relies heavily on social engineering: tricking people into revealing information or running files that look harmless.[17] The FTC lists the common lures: phishing emails with malicious links or attachments, and fake software ads on social media and search engines.[18] For how to recognise these messages, see how to spot phishing.
Some infections need no click on a file at all. In a drive-by download, a user’s browser is redirected to an infected site that tries to exploit flaws on their computer.[19] Flaws that attackers use before a fix exists are covered in zero-day vulnerabilities. Infected devices can also be pulled into botnets used for DDoS attacks.
Defending against malware
The FTC advises consumers to use security software, keep it updated and let it scan new files automatically.[20] If you think someone has stolen your information, the FTC says to report it at IdentityTheft.gov.[7] Agencies are clear that this is only one layer. NIST says largely signature-based tools such as antivirus cannot keep up with attacks customized for each victim, and recommends combining several detection techniques.[21] The NCSC says no organisation can be completely protected and recommends “defence in depth”, including multi-factor authentication.[16] For the wider picture, see the cybersecurity hub and cisa.
Read next
How data breaches happen, and what to do if you're affected
How data breaches happen (exploited software, stolen passwords, phishing, vendors), the laws that force disclosure, and the FTC's steps for affected people.
Questions readers ask
What is the difference between a virus and a worm?
In NIST's definitions, a virus spreads by modifying other programs to include a copy of itself and runs when the infected program runs, while a worm is a self-replicating program that spreads across a network without needing a host program or any user action.[3][4]
What is a trojan?
NIST defines a Trojan horse as a self-contained program that does not replicate and looks harmless but has a hidden malicious purpose.[5]
What is an infostealer?
Malware built to harvest credentials and financial data. Microsoft describes Lumma Stealer, sold as a service on underground forums since at least 2022, as stealing passwords, credit cards, bank account details and cryptocurrency wallets.[14]
Sources
· 21 claims from 6 publishers
Each numbered claim is a statement we checked against the sources listed with it. Tap a number in the text to see its sources in place.
- [1]
The NIST glossary defines malware as hardware, firmware or software that is intentionally included or inserted in a system for a harmful purpose. confirmedas of 2026-11-08
- malware (glossary) · NIST CSRC · Primary source · Definitions (CNSSI 4009-2022) (retrieved 2026-11-08)
- [2]
NIST's malware incident guide (SP 800-83 Rev. 1, July 2013) calls malware the most common external threat to most hosts. confirmedas of 2026-11-08
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Executive Summary (retrieved 2026-11-08)
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Authority page (retrieved 2026-11-08)
- [3]
The NIST glossary defines a virus as malicious software that spreads by modifying other programs to include a copy of itself, and that runs when the infected program is run. confirmedas of 2026-11-08
- virus (glossary) · NIST CSRC · Primary source · Definitions (CNSSI 4009-2022) (retrieved 2026-11-08)
- [4]
The NIST glossary describes a worm as a self-replicating program that spreads through a network to other computers without needing a host program or any user action. confirmedas of 2026-11-08
- worm (glossary) · NIST CSRC · Primary source · Definitions (NIST SP 800-12 Rev. 1) (retrieved 2026-11-08)
- [5]
NIST SP 800-83 defines a Trojan horse as a self-contained, non-replicating program that appears benign but has a hidden malicious purpose. confirmedas of 2026-11-08
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Section 2.1, Trojan Horses (retrieved 2026-11-08)
- [6]
Microsoft says it identified more than 394,000 Windows computers worldwide infected with Lumma between 16 March and 16 May 2025. confirmedas of 2026-11-08
- Disrupting Lumma Stealer: Microsoft leads global action against favored cybercrime tool · Microsoft · Primary source · Opening paragraphs (retrieved 2026-11-08)
- [7]
The FTC describes malware as harmful software installed on a device without the owner's knowledge, names viruses, spyware and ransomware as common types, says criminals use it to steal personal information such as usernames, passwords and bank account numbers, and tells people who think their information was stolen to report it at IdentityTheft.gov. confirmedas of 2026-11-08
- How To Recognize, Remove, and Avoid Malware · US Federal Trade Commission · Primary source · What Is Malware? (retrieved 2026-11-08)
- How To Recognize, Remove, and Avoid Malware · US Federal Trade Commission · Primary source · What Is Malware? (retrieved 2026-11-08)
- [8]
CISA describes malware as any software used to gain unauthorized access to IT systems in order to steal data, disrupt system services or damage IT networks. confirmedas of 2026-11-08
- Malware, Phishing, and Ransomware · CISA · Primary source · Topic overview (retrieved 2026-11-08)
- [9]
The UK NCSC says malware can cause harm by locking or disabling devices, stealing, deleting or encrypting data, taking control of devices to attack other organisations, obtaining credentials, and mining cryptocurrency. confirmedas of 2026-11-08
- Mitigating malware and ransomware attacks · UK National Cyber Security Centre · Primary source · What are malware and ransomware? (retrieved 2026-11-08)
- Mitigating malware and ransomware attacks · UK National Cyber Security Centre · Primary source · What are malware and ransomware? (retrieved 2026-11-08)
- [10]
NIST SP 800-83 says a network service worm exploits a vulnerability in a network service to spread itself and infect other hosts. confirmedas of 2026-11-08
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Section 2.1, Worms (retrieved 2026-11-08)
- [11]
The NCSC notes that some ransomware tries to spread to other machines on a network, citing the WannaCry malware that affected the NHS in May 2017. confirmedas of 2026-11-08
- Mitigating malware and ransomware attacks · UK National Cyber Security Centre · Primary source · What are malware and ransomware? (retrieved 2026-11-08)
- [12]
The NIST glossary describes a rootkit as a set of tools an attacker uses after gaining root-level access to hide their activity and keep that access covertly. confirmedas of 2026-11-08
- rootkit (glossary) · NIST CSRC · Primary source · Definitions (CNSSI 4009-2022) (retrieved 2026-11-08)
- [13]
NIST SP 800-83 lists attacker tools including backdoors, which listen for commands on a network port and let attackers acquire passwords or run commands, and keystroke loggers, which record keyboard use. confirmedas of 2026-11-08
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Section 2.1, Attacker Tools (retrieved 2026-11-08)
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Section 2.1, Attacker Tools (retrieved 2026-11-08)
- [14]
Microsoft describes Lumma Stealer as malware-as-a-service sold on underground forums since at least 2022 that steals passwords, credit cards, bank account details and cryptocurrency wallets. confirmedas of 2026-11-08
- Disrupting Lumma Stealer: Microsoft leads global action against favored cybercrime tool · Microsoft · Primary source · What is Lumma? (retrieved 2026-11-08)
- Disrupting Lumma Stealer: Microsoft leads global action against favored cybercrime tool · Microsoft · Primary source · Opening paragraphs (retrieved 2026-11-08)
- [15]
In May 2025 Microsoft's Digital Crimes Unit, acting under a US court order, seized or helped take down about 2,300 malicious domains behind Lumma, while the US Justice Department seized Lumma's central command structure, according to Microsoft. confirmedas of 2026-11-08
- Disrupting Lumma Stealer: Microsoft leads global action against favored cybercrime tool · Microsoft · Primary source · Opening paragraphs (21 May 2025) (retrieved 2026-11-08)
- Disrupting Lumma Stealer: Microsoft leads global action against favored cybercrime tool · Microsoft · Primary source · Opening paragraphs (21 May 2025) (retrieved 2026-11-08)
- [16]
The NCSC says there is no way to completely protect an organisation against malware infection and recommends a defence-in-depth approach, including using multi-factor authentication so stolen credentials cannot easily be reused. confirmedas of 2026-11-08
- Mitigating malware and ransomware attacks · UK National Cyber Security Centre · Primary source · Using a defence in depth strategy (retrieved 2026-11-08)
- Mitigating malware and ransomware attacks · UK National Cyber Security Centre · Primary source · Action 2 (retrieved 2026-11-08)
- [18]
The FTC warns that scammers spread malware through phishing emails with malicious links or attachments, fake security warnings that push people to call bogus tech support, and fake software ads on social media and search engines. confirmedas of 2026-11-08
- How To Recognize, Remove, and Avoid Malware · US Federal Trade Commission · Primary source · Recognize common threats (retrieved 2026-11-08)
- How To Recognize, Remove, and Avoid Malware · US Federal Trade Commission · Primary source · Recognize common threats (retrieved 2026-11-08)
- How To Recognize, Remove, and Avoid Malware · US Federal Trade Commission · Primary source · Recognize common threats (retrieved 2026-11-08)
- [19]
NIST SP 800-83 describes drive-by downloads, in which a user's browsing is redirected to an infected website that tries to exploit vulnerabilities on the user's computer and ultimately install rootkits or other attacker tools. confirmedas of 2026-11-08
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Section 2.2 (retrieved 2026-11-08)
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Section 2.2 (retrieved 2026-11-08)
- [20]
The FTC advises using security software, keeping it updated, and setting it to scan new files automatically. confirmedas of 2026-11-08
- How To Recognize, Remove, and Avoid Malware · US Federal Trade Commission · Primary source · Use security software (retrieved 2026-11-08)
- [21]
NIST SP 800-83 says largely signature-based controls such as antivirus software cannot keep up with attacks customized for each victim, and recommends defense in depth using several detection techniques. confirmedas of 2026-11-08
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Section 2.2 (retrieved 2026-11-08)
- Guide to Malware Incident Prevention and Handling for Desktops and Laptops (SP 800-83 Rev. 1) · NIST · Primary source · Section 2.2 (retrieved 2026-11-08)
Revision history (1)
- Page created.
Created Nov 8, 2026. Last reviewed by an editor on Nov 8, 2026. Next scheduled review: May 8, 2027.
Cite this page
"How malware works: viruses, worms, trojans and infostealers." ContentLora, updated Nov 8, 2026. https://contentlora.com/explain/how-malware-works
Spotted an error? Suggest a correction or emailcorrections@contentlora.com.