Viruses and worms: how self-spreading code moves and how networks contain it

A virus needs a host file or user action; a worm spreads by itself across networks. How WannaCry and NotPetya moved through SMB, which telemetry shows lateral spread, and the patching and segmentation that stop it.

Lesson 1 of 18 · 11 min read · practice only with authorization

Diagram

A worm outbreak in telemetry

Follow the path. One example at a time.

Step 1 of 4

Entry

One host is infected through an unpatched exposed service or a user-run file.

Illustration: Entry
# Entry
# One host is infected through an unpatched exposed
# service or a user-run file.

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Lateral scanning

    What fails
    Worms generate bursts of connections to one port across many addresses.
    Who is affected
    Every reachable host with the same weakness.
    What you would notice
    One source contacting hundreds of hosts on 445, 3389, or 22.
    What you change
    Alert on fan-out per source and port.
  2. Flat networks

    What fails
    Without segmentation, one infection reaches everything.
    Who is affected
    The whole organization.
    What you would notice
    Workstations that can reach each other on SMB.
    What you change
    Block workstation-to-workstation SMB and RDP.
  3. Patch gaps

    What fails
    WannaCry spread in 2017 through a flaw patched two months earlier.
    Who is affected
    Unpatched hosts.
    What you would notice
    Missing critical patches on exposed services.
    What you change
    Track patch latency for critical CVEs.

Notable outbreaks

The Morris worm (1988) showed self-propagation across the early internet. ILOVEYOU (2000) spread by email. Conficker (2008) used a Windows RPC flaw and USB drives. WannaCry and NotPetya (2017) used the EternalBlue SMB exploit; NotPetya also reused stolen credentials, which patching alone does not stop.

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

What distinguishes a worm from a virus?

Sibling techniques

Pages at the same depth, plus a lab and a glossary card for this one.

  1. MapMalware fundamentals: families, delivery, persistence, and the responseWhat malware categories describe, how infections usually start, where persistence hides on Windows, Linux, and macOS, and why rebuilding usually beats cleaning.

Practice

  1. LabTerminal labRead the files on a scoped host and name the failure in a finding.

Glossary

  1. CardWormsA program spreads by itself, usually through an exposed service or a reused password.