Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

How the WannaCry Attack Worked

WannaCry spread itself across the internet on 12 May 2017 using a leaked intelligence agency exploit, reached around 200,000 machines, and disrupted a third of NHS trusts in England.

Illustration for the cybersecurity term WannaCry
Home / Blog / Cybersecurity Terms / How the WannaCry Attack Worked
17 November 2026

How the WannaCry Attack Worked

How the WannaCry Attack Worked

On the morning of Friday 12 May 2017, ransomware began appearing on computers worldwide without anyone opening an attachment. WannaCry was a worm as well as ransomware, and that combination is why it reached roughly 200,000 machines across 150 countries within two days. It is also the incident that put cybersecurity on the front page of every British newspaper, because of what it did to the National Health Service.

The Exploit Behind It

WannaCry spread using EternalBlue, an exploit for a flaw in version 1 of the Server Message Block protocol, tracked as CVE-2017-0144. The exploit had been developed by the United States National Security Agency and was published by the group calling itself the Shadow Brokers on 14 April 2017.

Microsoft had already issued a patch. Bulletin MS17-010 was released on 14 March 2017, two months before the outbreak and a month before the exploit became public. The attack therefore did not use a zero-day; it used an unapplied patch, which is a very different kind of failure.

Once a host was infected, the malware installed the DOUBLEPULSAR backdoor, encrypted files with a 2048-bit RSA and AES combination, displayed a ransom demand of 300 US dollars in Bitcoin rising to 600 after three days, and scanned both the local network and random internet addresses on port 445 for further victims. No user interaction was needed at any point.

The Kill Switch

Before encrypting, the malware attempted to resolve a long, meaningless domain name. If the lookup succeeded, it stopped. The British researcher Marcus Hutchins registered the domain on the afternoon of 12 May, which halted propagation globally within hours.

The mechanism was probably intended as a sandbox check, since many analysis environments answer every DNS query. Its existence is a reminder that significant outcomes can turn on implementation details rather than on defensive capability, and that organisations which block all outbound DNS except through a proxy inadvertently prevented their own machines from reaching the switch.

The NHS Impact

The National Audit Office investigation, published in October 2017, set out the English figures: 81 of the 236 hospital trusts were disrupted, 34 of them locked out of devices, along with 603 primary care and other NHS organisations including 595 general practices. More than 19,000 appointments and operations were cancelled, five accident and emergency departments diverted patients, and the Department of Health and Social Care later estimated the cost at £92 million, comprising roughly £19 million in lost output and £73 million in IT restoration.

The NAO was direct about the cause. NHS Digital had issued warnings in March and April 2017 about the need to patch, and they had not been acted upon. None of the 88 trusts NHS Digital had assessed had passed the Cyber Essentials Plus standard. A commonly repeated claim that the NHS fell because of Windows XP is largely wrong: the great majority of affected devices ran unpatched Windows 7.

In December 2017 the Foreign Office and the NCSC publicly attributed the attack to North Korea, specifically the group known as Lazarus. The financial return was negligible, around 140,000 US dollars in total, which is one reason some analysts regard the release as poorly controlled rather than carefully planned.

What Changed Afterwards

The incident reshaped UK public sector security policy. NHS organisations were required to move to supported operating systems, the Data Security and Protection Toolkit replaced the previous governance regime, and the central NHS security operations centre was expanded. More broadly, it established three propositions now treated as baseline:

The uncomfortable part of the legacy is that unpatched SMBv1 and exposed port 445 are still found during assessments years later, usually on a forgotten server that nobody owns. Finding those systems before someone else does is a core objective of our Penetration Test Services.

FAQ – Frequently Asked Questions

Was WannaCry a Zero-Day Attack?

No. Microsoft released the patch for the underlying SMBv1 vulnerability in MS17-010 on 14 March 2017, two months before the outbreak and a month before the exploit was published by the Shadow Brokers. Organisations that had applied the update were protected. The incident is a patching and asset management failure rather than a case of an unknown vulnerability.

What Was the WannaCry Kill Switch?

Before encrypting, the malware tried to resolve a specific nonsense domain name and stopped if the lookup succeeded, most likely as a check for analysis sandboxes. A British researcher registered that domain on 12 May 2017, which halted worldwide propagation within hours. Machines that could not reach external DNS directly were unaffected by the switch and continued to encrypt.

Did the NHS Fail Because of Windows XP?

Largely no, despite the widespread claim. The National Audit Office found that the great majority of affected NHS devices were running unpatched Windows 7 rather than Windows XP, which accounted for a small proportion of the estate. The real cause was that the available patch had not been deployed, despite warnings issued by NHS Digital in March and April 2017.

Could an Attack Like WannaCry Happen Again?

The same pattern remains viable wherever a remotely exploitable service is exposed and unpatched. Assessments still find SMBv1 enabled and port 445 reachable in enterprise networks years later, usually on unowned legacy systems. The defences are unchanged: accurate asset inventory, prompt patching of network-facing services, disabling obsolete protocols, and segmentation to contain automated spread.

Related Terms

You May Be Interested In These

What Is Checkov?

Cybersecurity Terms

17 November 2026

What Is Checkov?

Read More
What Is Nikto?

Cybersecurity Terms

17 November 2026

What Is Nikto?

Read More
What Is MobSF?

Cybersecurity Terms

17 November 2026

What Is MobSF?

Read More