WannaCry Ransomware: Why It Spread So Fast
In this article
The WannaCry ransomware attack spread so widely because it combined two powerful ingredients: a stolen NSA exploit that let it move automatically between computers on a network, and the fact that thousands of organizations had unpatched Windows systems and exposed SMB ports. In short, it didn't need anyone to click a link—it wormed its way through networks by itself. This guide explains the technical and human factors behind its rapid spread, and what you can do to prevent similar attacks.
What You'll Need
- A basic understanding of networking concepts (IP addresses, ports, firewalls).
- Familiarity with Windows Update and patch management.
- No special tools required—this is an educational explainer.
Step-by-Step
- Understand the exploit: EternalBlue (MS17-010). The attack used a vulnerability in Microsoft's SMBv1 protocol (Server Message Block, used for file sharing). The exploit, nicknamed EternalBlue, was developed by the NSA and later leaked by a group called Shadow Brokers. It allowed remote code execution—meaning an attacker could run code on a target machine without any user interaction.
- See how the worm spreads. Unlike typical ransomware that relies on phishing emails, WannaCry scanned the local network and the internet for computers with port 445 open (the SMB port). When it found a vulnerable machine, it sent a specially crafted packet that triggered the exploit, giving it a foothold. Then it installed itself and repeated the process—each new infection became a launching pad for more scans.
- Note the lack of patching. Microsoft had released a patch for the vulnerability in March 2017 (MS17-010), but many organizations hadn't applied it by May 2017. Reasons included: IT teams prioritizing other updates, concerns about compatibility, and simply not knowing about the critical update. The exploit worked on unpatched Windows 7, Windows XP, Windows Server 2008, and other older systems.
- Recognize the role of outdated operating systems. Many hospitals, manufacturing plants, and government agencies were still running Windows XP or Windows Server 2003, which were no longer supported with security updates. Microsoft even released an emergency patch for these legacy systems—an extremely rare move—but it was too late for many.
- Understand the network architecture. In large organizations, computers are often connected in flat networks, meaning once one machine is infected, the worm can easily reach every other machine. Segmentation (dividing the network into smaller parts) would have contained the spread, but many networks lacked that.
- Consider the human factor. Even though the initial infection vector was the worm, some early infections came from phishing emails with malicious attachments. Once inside, the worm took over. Also, many users had local administrator rights, giving the malware more freedom to execute and spread.
- Look at the global impact. The attack hit over 200,000 computers in 150 countries within a day. Major victims included the UK's National Health Service (NHS), which had to cancel appointments and surgeries, and FedEx, Renault, and Telefonica. The scale was unprecedented because the worm spread automatically without human interaction.
- Identify the kill switch. A security researcher accidentally discovered a hardcoded domain in the malware's code. When the domain was registered, the malware stopped spreading. This was not a deliberate defense—it was a quirk in the code—but it effectively halted the worm's expansion.
- Learn from the aftermath. The attack highlighted the importance of regular patching, network segmentation, and having a robust backup strategy. It also showed that even sophisticated nation-state tools can leak and be used by criminals.
Common Mistakes
- Assuming that antivirus software alone can stop a worm—it can't, if the system is unpatched.
- Ignoring patches because they might break legacy applications. Test and deploy them promptly.
- Running unsupported operating systems (like Windows XP) on critical infrastructure.
- Keeping all computers on one flat network without segmentation.
- Not blocking SMB port 445 at the firewall if it's not needed for business.
Tips
- Enable automatic updates for Windows, or at least have a strict patch management schedule.
- Disable SMBv1 if you don't use it—Microsoft provides guidance on how to do this safely.
- Segment your network: separate guest Wi-Fi, IoT devices, and critical servers.
- Use the principle of least privilege—don't give users admin rights by default.
- Maintain offline backups and test restoration regularly.
- Educate employees about phishing, even though WannaCry didn't primarily rely on it.
Troubleshooting
If you're trying to understand why a specific system was affected:
- Check if the system had the MS17-010 patch installed. You can use the Microsoft Update Catalog or your patch management tool to verify.
- Look at the firewall logs to see if SMB traffic (port 445) was allowed inbound from the internet.
- Review network segmentation—was the infected machine on the same subnet as other vulnerable systems?
If you're trying to prevent a similar attack:
- Run a vulnerability scanner (like Nessus or OpenVAS) to identify unpatched systems.
- Check if SMBv1 is enabled: open PowerShell as admin and run
Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol. If it's enabled, consider disabling it after testing. - Ensure your firewall blocks inbound SMB from the internet. For a quick test, use an online port scanner to check if your public IP has port 445 open.
If you're dealing with a current ransomware infection:
- Disconnect the infected machine from the network immediately to prevent further spread.
- Do not pay the ransom—there's no guarantee you'll get your files back, and it funds criminals.
- Restore from backups after ensuring the malware is removed.
- Report the incident to law enforcement (like the FBI's Internet Crime Complaint Center).
Frequently Asked Questions
Did WannaCry affect Windows 10?
Yes, but only if the system was unpatched. Microsoft had released a patch for Windows 10 in March 2017, so systems with automatic updates were protected. Older versions like Windows 7 were more vulnerable because they were often not updated.
Was WannaCry a state-sponsored attack?
The exploit was developed by the NSA, but the attack itself was carried out by criminals. The identity of the attackers is still unknown, but they used a leaked NSA tool. It's believed they were a North Korean hacking group, but that's not officially confirmed.
Why did the NHS get hit so hard?
The NHS was running many outdated Windows XP systems and had poor network segmentation. Also, they had limited IT budgets and couldn't patch quickly. The attack disrupted hospitals for days.
Can WannaCry still infect computers today?
Yes, if a computer is running an unpatched Windows version and has SMB exposed. However, most modern systems have the patch, and firewalls typically block SMB from the internet. Still, it's a risk for legacy systems.
What is the kill switch domain?
The malware checked a specific URL (iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com). When a security researcher registered it, the malware's spread stopped because it couldn't find a response. This was a vulnerability in the malware's code.
How can I check if my system is vulnerable?
Ensure you have the latest Windows updates installed. You can also use Microsoft's free MBSA (Microsoft Baseline Security Analyzer) or a third-party scanner. For a quick check, see if port 445 is open on your firewall.