A worm infects a computer by exploiting a software or network vulnerability, by arriving in a phishing attachment or link, or by copying itself from a USB drive or shared folder. Once running, it scans for other vulnerable computers, copies itself across, and runs the copy, which repeats the loop. Unlike a virus, it needs no host file and often needs no further user action.
Key takeaways
- A worm is standalone malware that self-replicates and spreads on its own, without a host file.
- Worms spread through network vulnerabilities, phishing, shared folders, file sharing and USB drives.
- Patching, disabling SMBv1, segmenting networks and backups are the strongest defenses against worms.
Most malware needs your help: you open the attachment, you click the link, you run the file. A worm is different. Once it lands on one computer, it can find the next one by itself — and the next, and the next — while you are doing nothing at all.
What is a computer worm?
A computer worm is a type of malware whose main job is to self-replicate and infect other computers while staying active on the ones it has already infected. It is standalone, so it does not need to attach itself to another program.
That independence is the defining trait. A virus writes its code into a host file and waits for someone to run that file. A worm is the whole package and the delivery mechanism at once: it scans, copies itself across, and runs the copy.
Worms almost always cause at least some harm, even if only by consuming bandwidth and slowing the network. Many also carry a payload: they may delete files, steal data, drop ransomware, or open a backdoor for remote control.
Malwarebytes explains that worms often spread through networks, phishing emails, software vulnerabilities, file sharing, social networks and USB drives.
TechTarget adds that a worm often relies on automatic, invisible parts of an operating system, so a user may only notice it when replication slows or halts other tasks.
How does a worm infect a computer?
A worm infects a computer in three main ways: by exploiting a vulnerability, by tricking a person into running it, or by copying itself from shared storage or a removable drive. The first way needs no user action at all.
The fastest worms exploit a flaw in a network-facing service. The worm sends a crafted request to a vulnerable computer, the flaw lets it run code, and the worm installs itself. It then scans for the next target and repeats the process. That loop is why worm outbreaks are measured in minutes, not days.
The slower ways still matter. A worm can arrive as a phishing attachment, a malicious link, or a file in a shared folder or peer-to-peer network. It can also copy itself to a USB drive, so plugging that drive into another computer spreads the infection. Once any one of these gets the worm running, the self-replication loop takes over.
SQL Slammer, a worm from 2003, showed how fast this can be: it roughly doubled every 8.5 seconds and infected most vulnerable hosts in about ten minutes. A worm does not need to be clever to be dangerous; it just needs to be fast.
Worm vs virus vs Trojan: what is the difference?
Worms, viruses and Trojans are often used as synonyms, but they describe different ways of spreading. The difference decides how an incident behaves and how you stop it.
| Worm | Virus | Trojan | |
|---|---|---|---|
| Needs a host file? | No — standalone | Yes | No, but pretends to be a real program |
| Self-replicates? | Yes, on its own | Yes, but only when the host runs | No |
| Needs user action to spread? | Often no | Yes — run or share the file | Yes — install it each time |
| Main danger | Fast network-wide spread | File corruption | Hidden access |
| Example | WannaCry | Typical file infector | Fake installer |
A Trojan tricks you into running it by pretending to be legitimate software, such as a free game or a software update. Once installed, it may open a backdoor, but it does not copy itself to the next computer. A worm does that copying itself.
Real malware often mixes these traits. WannaCry was a cryptoworm: a worm that spread itself plus a ransomware payload that encrypted files. The worm was the delivery system; the ransomware was the damage.
What are the main ways worms spread?
Worms spread through network vulnerabilities, email, file sharing, messaging and removable drives. The vector decides how fast and how far a worm goes.
Network and software vulnerabilities are the fastest and most dangerous class. The worm carries an exploit for a flaw in a network-facing service and uses it to land on any reachable, unpatched host. No email and no click are needed.
- Email worms: create and send messages to all addresses in a victim's contact list, with a malicious attachment that infects the next computer when opened.
- File-sharing worms: copy themselves into shared folders and peer-to-peer networks, often disguised as media files.
- USB and external drives: copy themselves to removable drives, then run when the drive is plugged into another computer.
- Instant messaging and social networks: spread through messages and links sent from a compromised account to that person's contacts.
- Web and drive-by downloads: hide in a malicious web page, so visiting the page can infect a vulnerable browser or plugin.
Stuxnet, one of the most notorious worms, spread through USB devices carrying an infected host file, then targeted industrial control systems. It showed that even air-gapped systems can be reached if a drive crosses the gap.
What happened with WannaCry?
WannaCry is the clearest modern example of a worm. It appeared on the morning of May 12, 2017, and spread rapidly over several hours to tens of thousands of infections in more than 150 countries, according to CISA's alert TA17-132A.
WannaCry spread by exploiting a critical Windows SMB vulnerability, using the EternalBlue exploit for SMBv1. Microsoft had released a security update for that flaw, MS17-010, on March 14, 2017 — almost two months before the outbreak. It also released patches for Windows XP, Windows 8 and Windows Server 2003 on May 13, 2017.
Once on a computer, WannaCry encrypted the victim's files and demanded a Bitcoin payment, while its worm component scanned for other computers that responded to SMBv1 requests and infected them too. The UK National Health Service was famously disrupted, with appointments cancelled and systems taken offline.
The lesson is blunt: the patch existed before the damage. WannaCry was, above all, a patching failure. If every reachable machine had been patched and SMBv1 disabled, the worm would have had nowhere to go.
What does a worm do once it is inside?
Once a worm is running, it usually does two things at once: it spreads, and it runs its payload. The payload is what causes the visible damage.
Common payloads include encrypting files for ransom, deleting files, stealing data, dropping other malware such as spyware, and opening a backdoor so an attacker can control the computer remotely. Some worms also turn infected computers into a botnet, using them to send spam or launch attacks.
Even a worm with no payload harms the network. Uncontrolled replication consumes bandwidth, CPU and memory, slows other work, and can overload networks until services stop. That is often the first sign a user notices: everything suddenly gets slow for no clear reason.
If you see these signs, do not keep using the computer as normal. Disconnect it from the network first, so the worm cannot spread further while you investigate.
How do you prevent a worm infection?
Patching is the single most important defense. Worms that exploit vulnerabilities only work on unpatched systems, so install security updates promptly on every device, including servers, routers and old machines you forgot about.
Disable SMBv1 entirely. It is the protocol WannaCry exploited, it has been deprecated for years, and Windows 10, Windows 11 and Windows Server 2019 and later no longer install it by default. If you still have it enabled, turn it off.
- Patch fast, patch everything. Prioritize internet-facing and network-facing services first.
- Segment your network. Split it so one infected computer cannot reach every other computer. Firewalls between segments slow a worm down.
- Keep antivirus and anti-malware updated and let them update automatically.
- Block suspicious email attachments and train staff to spot phishing. Our guide to spear phishing covers the targeted version of that attack.
- Disable autorun for USB drives and scan removable drives before you open them.
- Limit admin rights. A worm running as a normal user can do far less damage than one running as an administrator.
Backups matter too, but only if they are protected. Keep offline or immutable backups, so a worm or ransomware cannot encrypt the backup as well as the original. Test restoring from backup regularly.
What should you do if a worm infects your computer?
Act in the right order: isolate, scan, clean, then check for spread. Do not just run a scan while the computer is still connected.
- Disconnect from the network. Unplug Ethernet and turn off Wi-Fi. Tell your IT team right away if this is a work computer.
- Run a full scan with updated security software, and remove anything it finds. Repeat the scan until it comes back clean.
- Check other devices. A worm spreads, so scan every computer on the same network, not just the one that looks sick.
- Restore from a clean backup if the infection is severe or files were encrypted. Do not pay a ransom — it does not guarantee recovery.
- Patch the hole. Find how the worm got in and fix it: install the missing update, disable the vulnerable service, or close the port.
- Change passwords for accounts used on the infected computer, from a clean device.
For a wider starting point, our small business cybersecurity checklist covers patching, backups and network segmentation together.
If your phone is acting strangely too, see our guide on how to know if your phone is hacked.
The bottom line
A worm infects a computer by finding a way in — usually an unpatched flaw, a phishing message or a shared drive — and then it does the rest by itself, copying from host to host until it runs out of vulnerable targets.
That is why patching, disabling old protocols like SMBv1, and splitting your network matter so much. They do not just protect one computer; they break the chain for every computer behind it. Start with a quick review of your patching and backup habits in the small business cybersecurity checklist.
Frequently asked questions
What is a computer worm in simple terms?
A computer worm is malware that copies itself from one computer to another on its own. Once it is running on one machine, it finds other vulnerable machines and infects them too, without needing a person to open a file each time.
How is a worm different from a virus?
A virus needs a host file and a person to run that file before it can spread. A worm is standalone: it runs on its own and spreads by itself, often by exploiting a network vulnerability with no user action at all.
Can a worm infect a computer without clicking anything?
Yes. A worm that exploits a network vulnerability can infect a reachable, unpatched computer with no click, no download and no email. WannaCry spread this way through the SMBv1 flaw in 2017.
Can a worm spread through email?
Yes. An email worm sends itself to addresses in a victim's contacts, often with a malicious attachment. When a recipient opens the attachment, that computer is infected and the worm sends itself onward.
Can a worm spread through a USB drive?
Yes. Some worms copy themselves to USB drives and external hard drives. When the drive is plugged into another computer, the worm runs and infects that machine, which is how Stuxnet spread.
How do I know if my computer has a worm?
Common signs are a sudden slowdown, high network use, programs crashing, files disappearing, and your contacts receiving strange emails from you. A full scan with updated security software can confirm it.
How do I remove a worm from my computer?
Disconnect the computer from the network first, then run a full scan with updated antivirus or anti-malware software. If the infection is severe, restore from a clean backup or reinstall the operating system, and change your passwords afterward.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against TechTarget, Malwarebytes and CISA's WannaCry alert TA17-132A.
How we write and fact-check →