The “code blue” NSA hack that exploits a bug in Windows SMB was used to spread WannaCry ransomware via fake emails with malicious attachments and clickable links. Microsoft released a patch for this in March, 2017 through Windows Update for Windows 7 and later. Patches for earlier versions of Windows are available here:
https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/
There are patches here for:
Windows Server 2003 SP2 x64
Windows Server 2003 SP2 x86
Windows XP SP2 x64
Windows XP SP3 x86
Windows XP Embedded SP3 x86
Windows 8 x86
Windows 8 x64