Vulnerability5 min readUpdated October 23, 2026

WannaCry: the ransomware worm that hit the NHS

A worm used a leaked NSA attack tool and a Windows flaw to lock more than 200,000 computers. How it spread, what it cost the NHS, and the fix.

Illustration: a ring showing the CVSS score 8.8, with the title WannaCry

What to do now

  1. Install MS17-010 or any later Windows update; on Windows XP, Windows 8 or Server 2003, install the emergency patch of May 2017, since these versions no longer get regular updates.
  2. Switch off SMB version 1, the old file-sharing protocol the worm used.
  3. Block port 445 at the edge of your network, so that no one can reach Windows file sharing from the internet.
Year
2017
CVSS 3.1 score
8.8 high
computers hit in at least 100 countries
200,000+
NHS appointments cancelled in England, by NHS England's estimate
19,494
Why it is on the list
  • Reach met

    More than 200,000 computers in at least 100 countries were affected (UK National Audit Office).

  • Mass exploitation met

    WannaCry was a worm: every infected computer searched its network and the internet for new victims and infected them on its own (Cisco Talos).

  • Damage met

    In England, about 19,494 appointments were cancelled and five hospital trusts had to divert ambulances; the cost to the NHS is estimated at about GBP 92 million (National Audit Office; Department of Health and Social Care).

  • Extraordinary response met

    Microsoft released emergency patches for Windows XP, Windows 8 and Windows Server 2003, which it no longer supported, and NHS England declared a national major incident (Microsoft; National Audit Office).

How a vulnerability gets on this list

The record
AffectedWindows computers with the old file-sharing protocol SMBv1
CVECVE-2017-0144
CVSS vectorCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Fixed inMS17-010 (March 14, 2017); emergency patches for Windows XP, Windows 8 and Windows Server 2003 (May 13, 2017)
On CISA's list of exploited vulnerabilities sinceFebruary 10, 2022
Found byNot named by Microsoft; the attack tool EternalBlue was stolen from the US NSA
Timeline
123456
  1. 1Fix available
  2. 2The Shadow Brokers publish EternalBlue, an attack tool stolen from the NSA+31 days
  3. 3Outbreak begins+59 days
  4. 4In the evening, a UK security researcher activates the kill switch+59 days
  5. 5Emergency patches for Windows XP, Windows 8 and Windows Server 2003+60 days
  6. 6NHS England stands down the national major incident+66 days

On May 12, 2017, a worm called WannaCry spread to more than 200,000 computers in at least 100 countries. A worm copies itself from computer to computer on its own; this one was also ransomware, which locks files and demands money to unlock them. It used a flaw in Windows file sharing that Microsoft had fixed two months earlier, and in England it disrupted the National Health Service (NHS) for days.

How it worked

Windows computers share files and printers over a network protocol called SMB. Its first version, SMBv1, had several bugs in how it handled certain requests. The one WannaCry used is a size miscalculation: a crafted network packet overflows a buffer, a reserved piece of memory, inside the Windows kernel, the core of the system. Anyone who can reach port 445, the network door for file sharing, can run code with the highest rights. In practice, no password is needed.

The attack tool for this flaw, EternalBlue, came from tools stolen from the US National Security Agency (NSA), Microsoft said. A group calling itself the Shadow Brokers published it on April 14, 2017, together with other tools. Microsoft confirmed that its security update MS17-010 of March 14 already fixed all of them.

WannaCry packed EternalBlue and DoublePulsar, a backdoor that gives attackers a hidden way back in, into a worm. Each infected computer scanned its own network and random internet addresses for an open port 445 and copied itself on. On every new victim, it encrypted the files, each with its own key, and locked those keys with a lock that only the attackers could open. The ransom note demanded 300 US dollars in Bitcoin, 600 dollars after three days, and threatened to delete the files after seven days.

  1. Infected computersearches its network and the internet for port 445
  2. SMB version 1a crafted packet overflows a buffer in the kernel
  3. New victimfiles encrypted, 300 US dollars demanded
  4. Next roundthe new victim starts searching too
No one had to click anything: an open port 445 and a missing update were enough.

Before it did anything, the worm tried to reach a long web address that no one had registered, and stopped if that worked. That check would turn out to be its off switch.

Reach and damage

The UK National Audit Office (NAO), which checks public spending, counted more than 200,000 affected computers in at least 100 countries. Its report on the NHS shows what the worm did to one large organization.

In England, 34 NHS trusts, the bodies that run hospitals and other health services, were infected and locked out of devices, and 46 more were disrupted without being infected: at least 80 of 236 trusts. A further 603 primary care and other NHS organizations were infected, including 595 GP practices, the offices of family doctors. The worm also infected 1,220 pieces of diagnostic equipment, 1 % of all such NHS equipment. Five hospital trusts had to send emergency ambulances to other hospitals.

NHS England identified 6,912 cancelled appointments in the first week and estimated the total at around 19,494.

NHS appointments cancelled because of WannaCry
Identified by NHS England, May 12 to 186,912
Estimated in total19,494

Source: UK National Audit Office. The total is an estimate based on the cancellations that were found.

The UK Department of Health and Social Care estimates the cost to the NHS at about GBP 92 million: GBP 19 million of lost patient care and GBP 73 million of IT costs. Most of it, GBP 72 million, arose after the attack.

No NHS organization paid the ransom. Worldwide, few victims did: an analysis of the worm’s three Bitcoin addresses counted 238 ransom payments up to October 2, 2017, worth about USD 86,000 at the exchange rates of the day.

Ransom payments to WannaCry, May 12 to October 2, 2017
Payments of USD 300192
Payments of USD 60046

Source: Bitcoin payment analysis, Computers & Security, 2018. Together 47.17 Bitcoin, worth USD 86,076.76 at daily average prices.

The fix and the response

Microsoft had fixed the flaw on March 14, 2017, with security update MS17-010, rated critical for all supported versions of Windows. Every infected NHS organization had run unpatched or unsupported Windows, the NAO found.

On the evening of May 12, a UK security researcher activated the kill switch by registering the web address the worm checked for. From then on, new infections stopped locking devices. NHS England had declared a national major incident at 4 p.m. that day; it stood the incident down on May 19. By the evening of May 14, 3,486 GP practices, 44 %, had installed the necessary patches.

On May 13, Microsoft released emergency patches for Windows XP, Windows 8, and Windows Server 2003, versions it no longer supported.

The NVD, the US National Vulnerability Database, rates the flaw 8.8 out of 10. Its score assumes that the attacker needs a basic user account; Microsoft says an attacker without one can use the flaw.

What happened next

About six weeks later, the same Windows flaw helped spread NotPetya, which hit companies in Ukraine and 64 more countries.

Sources

  1. Microsoft security bulletin MS17-010 learn.microsoft.com
  2. Microsoft: the leaked attack tools and the update that fixes them (April 2017) microsoft.com
  3. Microsoft: customer guidance and emergency patches for WannaCrypt (May 2017) microsoft.com
  4. Microsoft: the exploits were stolen from the NSA (May 2017) blogs.microsoft.com
  5. NVD: CVE-2017-0144 nvd.nist.gov
  6. UK National Audit Office: investigation into WannaCry and the NHS nao.org.uk
  7. UK National Audit Office: full report on WannaCry and the NHS (PDF) nao.org.uk
  8. UK Department of Health and Social Care: progress update on cyber resilience, with the cost estimate (PDF) assets.publishing.service.gov.uk
  9. Bitcoin analysis of WannaCry and NotPetya ransom payments (Computers & Security, 2018) arxiv.org
  10. Cisco Talos: WannaCry analysis (vendor data) blog.talosintelligence.com