How to Defend Against WanaCrypt Ransomware
In this article
Defending against a WanaCrypt-style ransomware attack requires a multi-layered approach combining offline backups, rigorous software patching, and strict user vigilance. The defense strategy focuses on three core pillars: keeping systems patched, maintaining offline backups, and preventing initial infection. If you follow these steps, you can protect your data even when the WanaCrypt exploit is active.
What You'll Need
- A secondary storage device (external hard drive or USB stick) for backups.
- Administrator access to your computer or network.
- Administrative access to your local router.
- Access to your operating system's update settings.
- A list of your critical files and their locations.
Step-by-Step
- Create Offline Backup Volumes. The most critical defense against WanaCrypt is a backup that is not connected to your computer at the time of the attack. Connect an external hard drive or USB stick. On Windows, open File Explorer, right-click the drive, and select New > Simple volume. Follow the wizard to create a new partition. Give it a clear name like OFFLINE_BACKUP. Do not fill this drive with your daily data; leave it empty or use it only for periodic full system images.
- Configure Windows Update. WanaCrypt exploits a vulnerability in older versions of the Windows Server Message Block (SMB) protocol. To close this door, ensure your system is fully patched. Go to Settings > Windows Update > Check for updates. You must install all Important updates. Look for updates specifically labeled as Security Updates or Monthly Rollup. If you are on an older version of Windows, check the Microsoft Update Catalog manually for the specific KB3031438 patch that addresses the EternalBlue vulnerability.
- Secure Your Local Network. The ransomware spreads through local networks by scanning for open ports. To stop this, you must block the SMB protocol on port 445. The most effective way to do this is by configuring your router. Access your router's administration page (usually at 192.168.1.1 or 192.168.0.1). Look for a section labeled Firewall, NAT, or Advanced Settings. Find the option to add a Port Forwarding rule or a DMZ exclusion. Create a rule that blocks incoming traffic on port 445 for all internal devices. Alternatively, look for a setting called WAN Port Filtering and add port 445 to the blocked list.
- Enable Network Protection. For Windows 10 and 11 Pro and Enterprise editions, enable the built-in network firewall features. Go to Settings > Network & Internet > Advanced network settings > Advanced sharing settings. Ensure that Turn on network discovery is off or set to Private. More importantly, go to Windows Security > Firewall & network protection > Advanced settings > Inbound Rules. Create a new rule, select Port, choose TCP, enter 445 as the specific local port, and set the action to Block the connection. Apply this to all profiles (Domain, Private, Public).
- Implement a Ransomware Defense Policy. To protect individual workstations, you can apply specific registry keys that block the ransomware's execution. Go to the Start menu, type regedit, and open the registry editor. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon. Create a new DWORD value named AutoAdminLogon and set it to 1. This ensures the system boots automatically, which is required for some scheduled cleanup tools. Next, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Error Reporting. Create a new DWORD value named DontDisplayUI and set it to 1. This prevents error pop-ups that might alert an attacker to your system's status.
- Perform Regular Offline Backups. Schedule a weekly backup to your offline backup volume. On Windows, use the File History feature or a third-party imaging tool like Macrium Reflect. When the backup starts, ensure the external drive is connected. Once the process completes, immediately disconnect and physically unplug the drive. This ensures that even if the ransomware executes while the drive is connected, it cannot encrypt the data on it.
- Train Against Phishing. WanaCrypt often enters systems via phishing emails containing malicious attachments or links. Train all users to be skeptical of unexpected emails, especially those with urgent language or attachments in formats like .zip or .vbs. Never open attachments from unknown senders. If a user suspects an email is malicious, they should report it to the IT department and delete it without opening it.
- Deploy Endpoint Detection. Install an Endpoint Detection and Response (EDR) solution on your network. This software monitors for suspicious behavior, such as processes trying to encrypt large numbers of files or communicate with known command-and-control servers. While not a replacement for backups, EDR can provide early warning and isolate infected machines before the encryption spreads.
- Prepare a Recovery Plan. In the event of an attack, do not pay the ransom. The decryption keys are rarely provided, and paying funds criminal organizations. Instead, restore your data from your offline backup. If you have a full system image, restore the entire system to a clean state. If you only have file-level backups, restore your critical documents and overwrite the encrypted versions. Ensure that your backup software is configured to exclude system volume information to prevent it from backing up encrypted files.
Common Mistakes
The most common mistake users make is relying on cloud-only backups without an offline component. Cloud storage services like OneDrive or Dropbox can also be encrypted if the application is running at the time of the attack. An offline backup ensures that your data is physically separated from the infected system. Another mistake is delaying patching. Security updates are released to fix specific vulnerabilities; ignoring them leaves the door wide open for the exploit. Finally, users often disconnect their internet connection to stop the spread. While this stops the network scanning, it does not stop the local encryption process which runs entirely on the infected machine.
Tips
Always keep your operating system and all installed software updated. Developers release patches not just for bugs, but for security vulnerabilities that criminals actively exploit. Be cautious with USB drives. Never plug in an unknown USB drive into your computer. Ransomware can spread through USB drives using autorun features. Finally, maintain a written list of your critical data locations. If your computer is encrypted, you will need to know exactly where your files are to restore them from backup.
Troubleshooting
If the ransomware still encrypts your files despite following these steps:
1. Disconnect from the network. Immediately unplug the ethernet cable or turn off Wi-Fi to prevent the malware from spreading to other devices on your network.
2. Do not restart the computer. Restarting can sometimes cause the ransomware to complete its encryption cycle or overwrite your backup files. Leave the computer powered on and isolated.
3. Identify the ransom note. Once the encryption is complete, the malware will place a text file on your desktop (often named DECRYPT_INSTRUCTION.txt or HOW_TO_RESTORE_FILES.txt). Read this file carefully. It will contain the attacker's contact information and a unique ID for your attack. Do not click any links or attachments in this file.
4. Assess the damage. Check your offline backups to ensure they are not corrupted. If your offline backups are also encrypted, it means the malware had access to them while they were connected, or your offline backup method was compromised. In this case, you must look for alternative backups or forensic recovery services, though these are expensive.
5. Report the incident. File a report with your local law enforcement agency and your country's computer emergency response team (CERT). While they may not be able to recover your data, reporting the incident helps them track the threat and identify the attackers.
Frequently Asked Questions
Can WanaCrypt infect Mac or Linux computers?
No. WanaCrypt and its variants are designed specifically for Windows operating systems. They exploit vulnerabilities in the Windows Server Message Block (SMB) protocol. Mac and Linux computers use different file systems and network protocols that are not vulnerable to this specific attack.
Does paying the ransom guarantee I will get my files back?
No. There is no guarantee. While some victims have recovered their files, many pay and receive nothing in return. Paying also funds criminal organizations and increases the likelihood of further attacks against you or others.
Will a full system image restore protect me?
A full system image taken before the attack will protect you. If your computer is infected, you can restore this image to a new hard drive. This will wipe out the ransomware and all encrypted files, returning your system to its clean state. However, you must ensure that your imaging software does not back up the encrypted data to another location.
Can I use a virtual machine to open infected files?
It is generally not safe to open infected files in a virtual machine. While a virtual machine can be isolated from your host network, the malware may still attempt to encrypt files within the virtual machine's own storage. Furthermore, some ransomware is designed to detect virtual environments and may behave differently or delete itself. The safest approach is to isolate the infected machine and restore from backup.
How do I know if my computer is infected?
The most obvious sign is that your files have extensions added to their names, such as .wncry, .locked, or .enc. You may also see a ransom note on your desktop. Additionally, your computer may slow down significantly as the malware consumes system resources to encrypt files.
Does turning off Wi-Fi stop the attack?
No. Turning off Wi-Fi stops the ransomware from spreading to other computers on your network, but it does not stop the encryption process on the infected machine itself. The malware runs locally and will continue to encrypt your files until it is manually stopped or the system is powered off.