Attack12 May 2017

WannaCry Ransomware

Ransomware spread on its own through a leaked NSA exploit and hit 150 countries, until a researcher registered a strange domain name.

Severity
History books
Difficulty
beginner
Companies
Microsoft, NHS, NSA
Tech
Windows, SMB, EternalBlue, Ransomware, Bitcoin
Root cause
unpatched flaw

The story

Quick (1 min)

On Friday 12 May 2017, computers around the world started showing a ransom note: your files are encrypted, pay in Bitcoin to get them back. The ransomware was called WannaCry.

Unlike most ransomware, WannaCry was a worm: it spread by itself between computers using a Windows file-sharing bug. The attack tool for that bug, EternalBlue, had been developed by the US NSA and was leaked online a month earlier. Microsoft had released a fix in March, but many organisations hadn't installed it, and some still ran Windows XP.

It hit over 150 countries. In England, at least 81 NHS hospital trusts were affected and thousands of appointments were cancelled. It was stopped that afternoon when researcher Marcus Hutchins registered a web address hidden in the code, which acted as a kill switch.

The lesson: install security patches quickly, especially for network-facing services, and retire unsupported systems.

Keep reading to the end to earn XP.Read. XP earned.

Engineer (2 min)

The vulnerability. A flaw in Microsoft's SMB (Server Message Block) file-sharing implementation. Microsoft issued MS17-010 on 14 March 2017, with patches for all supported Windows versions.

The exploit leak. EternalBlue, an NSA-developed exploit for this flaw, and DoublePulsar, a backdoor, were leaked by the Shadow Brokers in April 2017. By late April, researchers estimated tens to hundreds of thousands of machines had DoublePulsar installed.

How WannaCry worked:

  1. On start, it checked whether a hard-coded, nonsense-looking kill switch domain responded.
  2. If not, it encrypted local files and demanded Bitcoin.
  3. It then used EternalBlue to spread to random internet addresses and laterally across the local network. It could also use existing DoublePulsar infections.

Initial infection. Wikipedia says evidence points to an initial infection in Asia at 07:44 UTC, "likely through an exposed vulnerable SMB port, rather than email phishing as initially assumed."

The kill switch. Marcus Hutchins found the domain in the code and registered it at 15:03 UTC. New infections then saw the domain respond and didn't encrypt or spread. It didn't help machines already encrypted.

Who was at risk. Anyone without the March patch, and especially unsupported Windows XP and Server 2003. Microsoft released emergency patches for those the next day. Kaspersky reported, though, that under 0.1% of affected computers ran XP; most were Windows 7.

Interview takeaway: worms turn one exposed service into an organisation-wide outage. Patch SMB, never expose it to the internet, and segment networks so lateral spread is limited.

Keep reading to the end to earn XP.Read. XP earned.

Deep dive (2 min)

Timeline (Wikipedia, UK National Audit Office)

  • 14 March 2017: Microsoft releases MS17-010 for supported Windows versions.
  • 14 April 2017: the Shadow Brokers leak EternalBlue and DoublePulsar.
  • March–April 2017: NHS Digital issues critical alerts telling NHS organisations to patch.
  • 12 May 2017, 07:44–07:45 UTC: the attack begins, with initial infection likely in Asia via exposed SMB.
  • 12 May, 15:03 UTC: Marcus Hutchins registers the kill switch domain and spread slows dramatically.
  • 13 May 2017: Microsoft releases out-of-band patches for Windows XP, Server 2003 and Windows 8. These had been created in February but were only available to customers with paid custom support.
  • 18 December 2017: the US government formally names North Korea as the main culprit.
  • 6 September 2018: the US Justice Department charges North Korean hacker Park Jin-hyok, alleging his team was also involved in WannaCry.

Scale

Europol estimated about 200,000 computers in 150 countries. Later estimates exceeded 300,000. Kaspersky's four most affected countries were Russia, Ukraine, India and Taiwan.

NHS impact (National Audit Office)

  • At least 81 of 236 trusts in England were affected, plus 603 primary care and other NHS organisations.
  • 6,912 appointments known to be cancelled; NHS England estimated over 19,000.
  • Five acute trusts diverted emergency patients.
  • "No NHS organisation paid the ransom," per the Department of Health, NHS England and the National Crime Agency.
  • The response plan "had not been tested at a local level," and it wasn't clear at first who should lead.

The disclosure debate

Many experts criticised the NSA for keeping the vulnerability secret to use it, rather than reporting it, and then losing control of the exploit. Edward Snowden argued that if the NSA had disclosed the flaw "when they found it, not when they lost it, the attack may not have happened."

Attribution

Kaspersky and Symantec noted code similarities with the Lazarus Group, linked to North Korea. The US government formally attributed the attack to North Korea in December 2017.

Keep reading to the end to earn XP.Read. XP earned.

Failure replay

Step by step, what broke and what it hit next.

  1. Mar 14, 2017
    Windows SMB patchhealthy

    Microsoft releases MS17-010 for supported Windows versions. Many organisations don't apply it.

    Affects: Unpatched Windows PCs

  2. Apr 14, 2017
    EternalBlue leakcompromised

    The Shadow Brokers publish the NSA's EternalBlue exploit and DoublePulsar backdoor.

    Affects: WannaCry worm

  3. May 12, 07:44 UTC
    WannaCry wormcompromised

    WannaCry starts in Asia, likely via an exposed SMB port. It checks a kill-switch domain, finds none, and runs.

    Affects: Unpatched Windows PCs

  4. May 12
    Unpatched Windows PCscompromised

    Files are encrypted with a Bitcoin ransom note, and the worm scans the internet and local network to spread.

    Affects: NHS and businesses

  5. May 12
    NHS and businessesdown

    Over 150 countries are hit. At least 81 NHS trusts in England are affected and thousands of appointments cancelled.

  6. May 12, 15:03 UTC
    Kill switch domainrecovering

    Marcus Hutchins registers the domain. New infections now see it respond and stop.

    Affects: WannaCry worm

  7. May 13+
    Windows SMB patchrecovering

    Microsoft ships emergency patches even for Windows XP and Server 2003, and organisations rush to patch and restore.

    Affects: Unpatched Windows PCs

Impact

Who was affected
An estimated 200,000–300,000+ Windows computers in about 150 countries, including at least 81 NHS trusts in England and 603 other NHS organisations.
How long
Main spread from 07:44 to 15:03 UTC on 12 May 2017; recovery took days to weeks.
Cost
not disclosed overall (estimates range from hundreds of millions to billions of dollars); NHS costs were not known to the Department of Health.

Lessons

  • Apply critical patches quickly; the fix had been out for two months.
  • Don't expose SMB to the internet, and segment internal networks to limit worm spread.
  • Retire or isolate unsupported operating systems.
  • Rehearse incident response plans locally, not just on paper.
  • Kill switches and sinkholes can stop self-spreading malware.

Quiz

  1. What allowed WannaCry to spread between computers by itself?

    Check answer

    The EternalBlue exploit for Windows SMB. WannaCry used EternalBlue, leaked by the Shadow Brokers, to infect machines over SMB.

  2. When had Microsoft released the patch (MS17-010)?

    Check answer

    14 March 2017, about two months before. Supported Windows versions were patched in March; many organisations hadn't applied it.

  3. How was the spread stopped?

    Check answer

    Marcus Hutchins registered a kill switch domain hard-coded in the malware. Once the domain responded, new infections stopped encrypting and spreading.

  4. How many NHS trusts in England were affected, according to the National Audit Office?

    Check answer

    At least 81 of 236. At least 81 of 236 trusts, plus 603 primary care and other NHS organisations.

Interview prep

Try answering out loud before you open the model answer.

  1. security

    Why did WannaCry spread so much faster and further than typical ransomware?

    Show model answer

    Typical ransomware needs a user to open something. WannaCry was a worm: after encrypting a machine, it used the EternalBlue SMB exploit to infect other machines automatically, both random internet hosts with exposed SMB and neighbours on the same network. One infection inside a flat network could spread everywhere unpatched. It was stopped by a kill switch domain that, once registered, made new infections exit. Defences: patch MS17-010, block SMB at the internet edge, segment internal networks, and disable SMBv1.

    A strong answer hits:

    • Worm propagation, no user action needed
    • EternalBlue SMB exploit
    • Internet and lateral spread
    • Patching, edge blocking, segmentation
  2. system design

    How would you design a patch management process so a two-month-old critical fix doesn't leave you exposed?

    Show model answer

    Keep a complete inventory of systems and software versions. Rate patches by severity and exposure, with SLAs (critical internet-facing within days). Automate deployment with staged rings and quick rollback. Build test environments so fear of breaking things doesn't stall patching. Track compliance centrally and report it to leadership. For systems that can't be patched (legacy, medical devices), isolate them and add compensating controls. The NHS had alerts out, but no way to check whether organisations complied.

    A strong answer hits:

    • Inventory and severity-based SLAs
    • Automated, staged rollout
    • Compliance tracking and accountability
    • Isolate unpatchable systems
  3. behavioural

    Should intelligence agencies keep vulnerabilities secret to use them, or report them to vendors? Discuss with WannaCry as an example.

    Show model answer

    There's a real trade-off. Keeping a vulnerability lets an agency use it for intelligence, but everyone stays exposed, and if the tool leaks, as EternalBlue did, criminals and states can use it at massive scale. WannaCry hit hospitals using an NSA exploit. A balanced view: have a transparent process for deciding, give strong weight to widely used software, and disclose quickly if the tool might be compromised. For engineers, the takeaway is to patch fast, because leaked exploits arrive with little warning.

    A strong answer hits:

    • Intelligence value vs public exposure
    • Leak risk realised by EternalBlue
    • Weight towards disclosure for common software
    • Patch speed as a defence

Go deeper