As you might be aware this Friday (12th of May 2017) there was a massive outbreak of a new type of crypto virus dubbed WannaCrypto aka WannaCry. The UK was hit the hardest, especially in the Health Sector, with Spanish Telecom – Telefonica, along with Portuguese & Argentinian telecoms and Russia.
How does that affect the UK? – The NHS is badly crippled (more than 30 hospitals reported malware spread), patients are being turned away, important data such as scans and personal test results are lost and planned surgeries are cancelled. We could easily say that lives are at stake as sometimes more critical operations had to be postponed or done without important tests/scan results.
About the attack:
The WannaCry outbreak is the quickest spread of malware ever (over 100 countries with many affected endpoints in a matter of hours).
This link shows the spread over time. The animation was made possible because the authors of MalwareTech, could hack into one of the Command and Control domains and gain control over it so they can trace the incoming call home requests from the hacked machines (keep in mind that this does not depict the whole spread of the virus as MalwareTech operated in EST time and the spread in Europe and Asia was already going for some hours).
Another unique thing – the virus exploited a vulnerability in Windows OS systems that was used for years by the NSA and GCHQ government agencies but only revealed for the public a couple of months ago (by the ShadowBroker dump on the 14th of April)
Here the Security Industry in the world are divided in their opinions.
One opinion is that the vulnerability should have never been leaked so bad guys would not be aware of it and hence would not be able to exploit it. This is usually the opinion of non-hardened security guys since it loudly shouts – Security through Obscurity or the ostrich effect.
The second opinion is that not a single discovered vulnerability should remain hidden, the more people are aware of the threat, the more people can react to it. General security admins had more than two months to patch their systems as official patch from Microsoft was released quickly after the leak (official patch was released on the March 14th). One important note was that many government, slow and big organization (due their sheer size and bureaucracy) are still running Windows XP and since XP is out of life and support, there was no patch for it – An example for such organization was the NHS.
The virus had a kill switch designed by its creators, a hidden nonsense long domain that if alive will make the virus stop spreading. A researcher found it by looking at the malware (reverse engineering it) and he was not sure why is was there, so he registered the domain and luckily helped in stopping the spread (the malware checks if that domain is alive before attempting worm like spread in the same L2 network)
The Onion Router
Botnet Command and Control centres are located in TOR (the onion router)
OK, that has been done before so not quite unique but very hard to implement as the malware needs to download a whole lot of files to the end user device to make this work. The technique is adding anonymity to the guys running the botnet (hence the creators of the malware). CC is very important for Crypto Viruses as these are usually created not to destroy but to extort money out of people who want their files recovered and recovery is done via this backchannel by supplying the key. If people pay and their files do not get recovered the rumour spreads and people accept their losses and do not pay anything. The current estimation for infected systems with encrypted files is more than $55 000 and attackers want an average of £300 for endpoint recovery, that amounts to a hefty ransom sum (if 20 000 users pay, that is over 6 million dollars).
Heavily customised and detailed interaction user/victim – The information displayed to the user explains in detail what has happened and what needs to be done (how to pay) to recover your files and it is translated and shown in 28 languages. The presentation (ransom note below) is done via an executable file and offers many options.
How does the attack work?
The malware uses a vulnerability in the SMBv2 remote code execution in Microsoft Windows. The exploit (codenamed “EternalBlue”) has been made available on the internet through the Shadowbrokers dump on April 14th, 2017 and patched by Microsoft on March 14. Usually, SMB’s are not directly connected to the outside world, the attack point was via email as well as the spread or a quick vertical scan for port TCP 445. After initial infection, the virus spread like a worm, probing all hosts within the subnet for open SMB ports and trying to infect them. Also, quite unique for this virus is that it uses different services for performing different tasks, aka Modular Service approach – for example, it uses different services for file dumping, for finding files with particularly important extensions and encrypting them, for disabling the shadow copy/system restore, for presenting the screen with the note/demands/payment information – yes that is a separate executable file.
- Patch – regular/automated patching of windows systems would have prevented the malware to do any damage by removing the vulnerability that should be exploited
- Security Training – organisation employees should be aware of the dangers of executing files from emails or clicking on links
- Advanced malware protection on the endpoints – could stop the execution of the malware in the first stage or downloading and installation of the malware in the second stage
- Email security – strong email security would have greatly reduced the spread of the malware or disabled any executable files from being delivered to the users (depends on tuning, but even files with unknown status should be held back and guaranteed before further analysis can be done) or will check URLs in mails and you determine if you able to click on them (more modern Email protection systems have built in Web URL protections)
- Web security controls – would help in cases when the infection point happens by URL link in email
- Advanced IPS with Command and Control botnet detection – would not be effective in the first minutes of the spread but will quickly update itself (depending on vendor) and will detect/drop outgoing CC connections. Traditional firewalls with stateful technology would not help except by blocking SMB traffic based on TCP 139/445 ports (however traditional firewall deployment does not scan east to west traffic and traffic in the same L2 network)
- Backup your important information in a separate secure location – a reactive approach but very effective towards crypto viruses
Mitigation techniques (after the attack)
Unfortunately, after files are encrypted, it is close to impossible to decrypt them without having the proper key. Most endpoint protection companies give you a list of things to do to remove the virus, hinder its spread, and be immune in the future but not to recover files. General recommendation varies between different vendors but most of them follow these steps.
- Make sure your endpoint protection software is running and not disabled by virus.
- Download latest signatures
- Install the PATCH from Microsoft (MS17-010) which fixed the SMBv2 vulnerability
- Scan all systems, the virus is detected (usually by the name MEM: Trojan.Win64.EquationDrug.gen), and reboot the system (before that make sure you have the patch installed).
Indicators of compromise
How to check if your network has the malware. Typical indications are listed in the link below
Basically, you must request certain IPs on the Internet and you have seen a file transfer with the mentioned SHA-256 fingerprint (keep in mind there is small variations of the virus so there is multiple fingerprints)