NOTE: Anomali is continuing to investigate and monitor the WanaCry worm and will update this page as we have more information to share. Visit www.anomali.com/wanacry for the latest.
On the morning of Friday May 12th a new ransomware threat emerged infecting tens of thousands of computers across the globe at an alarming rate.
Figure 1 - WanaDecrypt0r 2.0 Pop up window and splash screen.
Named “Wana Decrypt0r 2.0” (a.k.a “WannaCry”, "WCry"), the ransomware was unique in that it appeared to be one of the first to have the ability to spread to other (Windows) computers on its own, similar to malware of the past like Conficker. This was starting to look like the first case of worm functionality being integrated into ransomware and indeed it was, sort of.
It was later determined that the ransomware was spreading on its own by scanning for systems vulnerable to MS17-010, exploiting them and then using a recently leaked NSA backdoor to install the ransomware on the system.
A lot of the hype surrounding the spreading component of the ransomware was due to the fact it was using an exploit against MS17-010, a vulnerability in Microsoft’s SMB protocol that resulted in continued spread of the ransomware. It is also a big deal because the exploits used by the malware came from the recent “Lost In Translation” dump leaked by the infamous Shadow Brokers, which included cyber-attack tools developed by the NSA. In this case, ETERNALBLUE was the name of the exploit included in the dump by the Shadow Brokers.
Figure 2 – FuzzBunch exploitation framework containing exploit targeting MS17-010, leaked by the Shadow Brokers.
While the security community at large is still investigating the worm, ransomware and the initial infection vector, details have begun to emerge giving us more insight into how the malware works and what can be done to stop it.
Worm Gives Birth
Although it was not clear at first, there were 2 malware components involved in the infections. The first being the main malware binary that drops the ransomware. The sample we looked at had md5 DB349B97C37D22F5EA1D1841E3C89EB4. Time stamp [4CE78ECC] - Nov 20, 2010 9:03:08
This is the malware binary that will call out to the domain “iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea[.]com” to see if it gets a response and determine if it should continue execution or not. Fortunately, the domain was sinkhole’d the same day it was discovered effectively stopping further ransomware infections since the malware would just exit as soon as it got a response from that domain. This was not the ransomware component, it was the dropper.
Using the tool ResourceHacker you can see actually see and extract the resource section containing the malware payload for closer analysis.
The first one is the actual WanaDecrypt0r 2.0 ransomware
Time stamp [4CE78F41] - Nov 20, 2010 9:05:05
Figure 4a – File header of the ransomware hidden inside the worm.
The next resource section of interest comes from the ransomware binary, it holds a password protected .zip containing additional files used by the ransomware. The zip file has md5 B576ADA3366908875E5CE4CB3DA6153A.
Figure 4b – “PK” File header visible in resource section of main malware binary.
Figure 5 – Zip password “WNcry@2ol7” was clearly visible during analysis.
The malware is designed so that once the system is infected, it will scan the local network and internet for systems that are listening on TCP port 445, these systems will then be checked to ensure the presence of the backdoor, known as DOUBLEPULSAR, through which it will actually send the ransomware to be installed, additional analysis is available here and here.
Figure 6 – An infected host scanning for IP’s on TCP 445.
Once the system gets infected with the ransomware, its business as usual with the ransomware pop-up windows and threats of data loss.
Figure 7 – WanaDecrypt0r 2.0 on the desktop.
The ransomware will periodically check to see if payment was made, this communication is done using TOR. Since the ransomware uses TOR to communicate, network communication will be encrypted and potentially able to skirt by detection signatures unless specific detections for TOR network traffic are enabled.
Figure 8 – Ransomware communicating to TOR nodes on ports 9001, 443 & 80.
Figure 9 – Example TOR traffic observed
As you might have guessed, blocking TOR communication can help mitigate the threat and is also good hygiene for business networks. Lists of active TOR exit nodes are readily available on the internet as well as from most threat Intelligence platforms, including Anomali ThreatStream.
Checking your logs for activity to TOR nodes can be helpful in locating hosts that may be infected or using TOR to evade network policy, potentially putting your enterprise at risk.
If you want to stay one step ahead of threats like WanaCry, it is critical you gauge your exposure levels and put mitigations in place so that infections can be avoided. If not properly protected, these types of attacks can quickly grow out of control and overwhelm security teams, bringing business to a halt (as we saw this past Friday).
As has been said over and over, vulnerable systems must be patched in order to reduce risk.
Instead of waiting for infected systems to show up as security alerts, scanning for vulnerable systems on your network ahead of time can help identify potential targets, this can be done with tools like Nessus which will report if the system is vulnerable.
Figure 10 – Example of Nessus scan results indicating a potentially vulnerable host.
Additionally, ensuring that endpoints are not exposed directly to the Internet is an important general mitigation that would help avoid infection in the case of WanaCry.
Now that weapons-grade cyber attack tools are in the wrong hands, it is clear that tools and techniques previously reserved for use by nation states are being integrated into crimeware for profit. This means you can expect to see more of these exploits and tools leveraged in future attacks, each one likely surpassing the previous in sophistication and stealth as threat actors build on lessons learned from previous attacks. Phishing, exploit kits, and watering holes are all common attack vectors that could potentially leverage these weapons-grade tools in order to continue delivering malicious payloads like WanaCry. There will be new versions of WanaCry that attempt to overcome the weaknesses in what has been observed so far. It will be up to organizations to learn from the security weaknesses that led to this attack and stay abreast of future developments to prevent infection in their environments.