Skip to content
Knowledge Base

What is a computer worm? How worms spread through a company network and how to stop them

A worm does not wait for a click: it finds the next machine by itself and moves onto it by itself. That is why one unpatched service or one account with broad privileges can turn a single infection into a network-wide outage within hours. We explain how computer worms work and what stops them.

What is a computer worm?

A computer worm is a malicious program that copies itself and moves onto other computers on its own — with no host program and usually without any action by a user. That is how NIST defines it in its guidance on handling malware incidents (SP 800-83): a worm is a standalone, self-replicating program that typically runs by itself. The NIST glossary adds that a worm may consume the resources of the systems it passes through destructively, for example disk space or processor time.

This independence is what sets a worm apart from other kinds of malicious software. It does not have to wait for someone to open an attachment or launch a program on the next computer — it looks for its next target by itself. On a company network, this means one infected machine can quickly become the starting point for infecting many others.

A short definition is available in the computer worm entry of our glossary. In this article we explain how a worm differs from a virus and a trojan, how computer worms spread through a company network, what well-known attacks teach us and which controls stop a worm before it stops the business.

How does a worm differ from a virus and a trojan?

In everyday speech, anything that harms a computer gets called a “virus”. In IT security, however, the distinction matters in practice, because each category spreads differently — and is stopped differently. According to NIST:

FeatureWormVirusTrojan horse
Does it replicate?yes, by itselfyes, by attaching to programs or filesno
Does it need a host?no — standalone programyes — a program or a data fileno — standalone program
User’s roleusually noneusually triggered by a user actionthe user installs it because it looks harmless
Typical reachmany hosts in a short timefiles and media the user touchesusually one host, onto which it delivers further tools

In practice the boundaries blur. NIST notes that most of today’s malware consists of blended attacks: a single program combines, for instance, the spreading methods of a virus and a worm. That is why the classic categories are no longer the basis of procedures — organizations now have one set of procedures for all malware incidents. The word “worm” is still useful, though, because it says something important: this is a threat that spreads without human involvement.

We cover the types of viruses and their symptoms in the computer virus entry — here we focus only on worms.

How does a computer worm work — from infection to the next host?

A worm’s life cycle can be described in four steps, without going into technical details that would help an attacker:

  1. Entry. The worm reaches the first machine — through a vulnerable service exposed to the network, a removable drive, email, or as the payload of another malicious program.
  2. Surveying the surroundings. On the infected computer it looks for further targets: other machines on the same network, network shares, connected drives.
  3. Moving on. It uses what it found: a vulnerable network service on another computer, credentials gathered from the infected machine, or the automatic launch mechanism of removable media.
  4. Acting. On every new machine it repeats the cycle and, along the way, executes its payload — encrypting data, stealing information, installing more tools or simply consuming resources.

The key point is that steps two to four run automatically, in parallel, on many machines. Hence the speed that sets a worm infection apart from most other incidents.

What types of computer worms are there?

NIST distinguishes two basic categories, and the MITRE ATT&CK catalog of techniques adds a third route that matters for companies with isolated networks:

  • Network service worms — exploit a vulnerability in a network service to spread and infect further hosts. This is the fastest variety and the most dangerous for businesses: it needs no interaction, only a reachable, unpatched service.
  • Mass-mailing worms — behave much like an email-borne virus, but they are standalone programs and do not infect existing files.
  • Worms carried on removable media — copy themselves to USB drives and other media, relying on automatic launch (AutoRun). ATT&CK describes this technique (T1091) also as a way into networks physically isolated from the internet.

Modern worms often combine several routes at once — as the examples below show.

How do worms spread through a company network?

In the MITRE ATT&CK catalog, a worm spreading by itself is a case of lateral movement — moving from one compromised machine to others inside the network. Worms rely on three main routes:

  • Vulnerabilities in remote services (technique T1210). The worm exploits a flaw in a service reachable over the network to run its code on another computer. ATT&CK gives WannaCry and NotPetya as examples (a vulnerability in the SMBv1 file-sharing protocol) as well as Conficker (the vulnerability described in bulletin MS08-067).
  • Stolen credentials and legitimate admin tools. The worm gathers sign-in data from the infected machine and uses it with tools administrators rely on every day, such as WMI or PsExec. The traffic then looks like routine IT work.
  • Network shares and removable media. The worm copies itself into shared folders and onto USB drives, from where it reaches further computers.

The takeaway for a business is simple: a worm moves along the routes the network has left open. A flat network without segmentation, accounts with administrator rights on many machines and unpatched services exposed to the whole internal network are a highway for it.

Which well-known worm attacks are worth knowing?

Three cases described in alerts from the US agency CISA show how differently a worm can enter a network — and how similar the lessons are.

Conficker (alert of 29 March 2009). The worm infected Windows computers from USB drives, from network shares or directly across the corporate network — if the servers lacked the MS08-067 patch. The agency’s advice: deploy that patch on every system, disable AutoRun, and get software and updates only from the vendor.

WannaCry (May 2017). The ransomware campaign was detected on 12 May 2017 and within a few hours had spread around the world — reports spoke of tens of thousands of infections in more than 150 countries. Its spreading component exploited a vulnerability in SMBv1 for which Microsoft had already released the MS17-010 patch on 14 March 2017. The bulletin carried a critical rating: crafted messages sent to an SMBv1 server allowed code to be run remotely on the computer, with no user involvement — exactly the kind of vulnerability a network service worm needs. The agency recommended applying the patch and, where that was impossible, disabling SMBv1 and blocking SMB at the network boundary (TCP port 445) — with the caveat that the block might hinder access to shared files.

NotPetya (June 2017). The variant of 27 June 2017 entered networks through compromised Ukrainian accounting software, M.E.Doc. Inside the network it combined several methods: it stole Windows credentials and used them with legitimate admin tools, and it also exploited the same SMBv1 vulnerabilities as WannaCry. It encrypted files and, with administrator rights, the disk’s master boot record as well.

The common thread: in all three cases a patch or a simple configuration change existed before the attack. The worm did not need an unknown flaw — it was enough that machines the patch never reached were left on the network.

Why is a worm so dangerous for a business?

NIST highlights the speed: worms spread very quickly and can cause serious damage within minutes or hours. A worm infection therefore usually calls for a top-priority response, whereas a trojan horse, for example, most often affects a single computer.

For a business, this translates into three risks:

  • Scale. The problem is not one laptop but every machine the worm can reach. On a flat network, that can be the whole company.
  • Payload. The worm is a means of transport. What it carries — data encryption, information theft, destruction of systems — determines the size of the losses.
  • Response time. A team that notices the infection after a few hours no longer has one incident to contain but dozens of infected hosts.

What signs may point to a worm on the network?

A worm is hard to spot on a single machine and easier when you look at the whole network. The signs worth watching follow directly from how worms work:

  • a sudden rise in traffic between workstations, especially to file-sharing services, even though workstations usually have no reason to connect to each other;
  • many computers simultaneously trying to connect to the same ports on other machines on the network;
  • admin tools being used from accounts or workstations that do not normally use them;
  • new executable files on network shares and removable drives;
  • blocked access to security vendors’ websites — the CISA alert on Conficker noted that newer variants made it difficult to reach them.

None of these signs is proof on its own. Together, however, they form a picture that tools for detecting behavior on endpoints and on the network can connect faster than a person reading logs.

How can a business protect itself against computer worms?

Controls are best matched to the routes a worm travels. The table below combines recommendations from NIST, CISA and MITRE ATT&CK:

Worm’s routeControl that closes it
vulnerable network servicepatch management, switching off unnecessary services and outdated protocols (e.g. SMBv1)
traffic between workstationshost firewalls blocking workstation-to-workstation connections, network segmentation
stolen administrator credentialsleast privilege, fewer privileged accounts, restricting remote WMI and remote execution
removable mediadisabling AutoRun, restricting media by policy, rules blocking untrusted executables from USB
encrypted or destroyed dataregular, tested backups kept out of reach of the production network

Patching comes first. NIST points out that malware very often attacks through vulnerabilities in systems, services and applications, so removing them — with patches or configuration changes — is the foundation of prevention. It only works when the patch management process covers every machine, including the forgotten ones: old servers, devices in branch offices, computers restored from backup.

The second pillar is limiting routes. Network segmentation and blocking traffic between workstations mean that even a worm exploiting a new flaw stops at the segment boundary instead of crossing the whole company.

What should you do when a worm is already on the network?

According to NIST, with fast-spreading worms the goal is to contain the incident on most hosts as quickly as possible — this reduces the number of infected machines, the extent of the damage and the recovery time. The guidance describes four groups of containment methods: user participation, automated detection, disabling services and restricting network connectivity.

In practice, the first steps look like this:

  1. Treat the situation as a high-priority incident and start the response procedure instead of cleaning machines one by one. Prepare channels for reaching staff other than email in advance — NIST notes that during an incident email may be unavailable or read too late.
  2. Cut off the worm’s route — block the port or service it travels through on the firewalls, or switch the service off. NIST advises keeping a list of services and the dependencies between them, because switching off one service can unexpectedly stop other systems that rely on it.
  3. Isolate infected hosts, but do not assume that disconnection ends the damage: NIST warns that malware may keep running on a cut-off computer, and some samples destroy data precisely when they lose connectivity.
  4. Find the entry route and close it — a patch, password resets for compromised accounts, disabling AutoRun — before machines return to the network.
  5. Restore from backup only once you are sure the backup is clean and the infection route is closed.

Is it worth paying the ransom after a worm attack with ransomware?

In its NotPetya alert, CISA advises against paying ransoms: payment enriches criminals and offers no guarantee that the files will be recovered. With NotPetya, the mailbox meant for confirming payments was closed by its email provider, which left victims with practically no path from payment to recovered data.

A better investment is what the agency recommends before an incident: regular backups that are tested as part of a disaster recovery plan and stored where a worm cannot reach them. A backup the worm can access from the production network will be encrypted along with everything else.

It is also worth remembering that NotPetya, although it looked like ransomware, offered no real way back: the agency’s analysis found nothing tying the victim’s identifier to the key used for encryption, so even a paid ransom might not have made decryption possible. That is why a recovery plan should assume data comes back only from backups.

Is antivirus enough to protect against worms?

No. NIST points to two limitations: antivirus often fails to recognize new malware, and malware that has taken over a system can switch security tools off — antivirus included. Containing an incident with signatures alone is not as effective as it once was.

A worm that exploits a new vulnerability, or stolen credentials and legitimate admin tools, may contain nothing that signatures recognize. It can, however, be spotted by its behavior: unusual connections between workstations, admin tools launched from unusual places, files created en masse. EDR systems focus on detection and response based on observing the behavior of workstations and servers.

With worms, though, what counts is not only the tool but also the response time — at night and at weekends too. If your company has no team assessing alerts around the clock and deciding when to isolate hosts, consider a managed EDR/XDR service, in which analysts do that work: they assess alerts, run threat hunting and isolate compromised machines before the worm moves on.

Frequently asked questions

What is a computer worm in a nutshell?

A computer worm is a malicious program that copies itself and moves onto other computers on its own — usually over the network, without a host program and without any user action. It most often uses a vulnerable network service, stolen credentials or removable media.

Was WannaCry a worm?

WannaCry was a ransomware campaign with a component that behaved like a worm: it used a vulnerability in the SMBv1 protocol, described in Microsoft bulletin MS17-010, to infect further computers on the network by itself. A patch had been available since 14 March 2017.

Does antivirus protect against worms?

Partly. NIST points out that antivirus often fails to recognize new malware, and malware that has taken over a system can switch security tools off. Against worms, patching, network segmentation, restricted privileges and fast detection of unusual behavior matter just as much.

What should you do if you suspect a worm on the company network?

Treat it as a high-priority incident: contain the spread as quickly as possible (isolate infected hosts, block the service or port being exploited), find the infection path and close it before machines go back on the network. Disconnecting a host does not mean the damage has stopped.

Share:

Talk to an expert

Have questions about this topic? Get in touch with our specialist.

Sales Representative
Łukasz Gil

Łukasz Gil

Sales Representative

Response within 24 hours
Expert consultation
Individual approach

Providing your phone number will speed up contact.

Want to Reduce IT Risk and Costs?

Book a consultation - we respond within 24h

Response in 24h Custom quote No obligations