0x The Malware Lab
Ransomware
Ransomware.WannaCry.Win32

Win32 · WannaCry

The infamous 2017 WannaCry ransomware worm. It encrypts victim files, changes the wallpaper, and drops the WannaDecryptor UI. It contains a kill switch — if a hardcoded URL is reachable it exits without encrypting — and spreads over SMB (EternalBlue) via IPC$ shares.

Identification

Original name
Ransomware.WannaCry.exe.malz
Aliases
Ransomware.wannacry.exe.malz, WanaCrypt0r, mssecsvc2.0
File type
PE32 executable, for MS Windows
SHA256
24d004a104d4d54034dbcffc2a4b19a11f39008a575aa614ea04703480b1022c
MD5
db349b97c37d22f5ea1d1841e3c89eb4
VirusTotal
Positive — identified as WannaCry

Capabilities

Indicators of Compromise

Network indicators

TypeValueNote
urlhttp://www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.comKill switch URL — if reachable, the payload does NOT execute
ip192.168.56.20SMB target (\\192.168.56.20\IPC$) for lateral movement
ip172.16.99.5SMB target (\\172.16.99.5\IPC$) for lateral movement

Host indicators

TypeValueNote
servicemssecsvc2.0 ("Microsoft Security Center (2.0) Service")Persistence service that launches tasksche.exe
filetasksche.exePersistent executable started by the new service
filetaskhsvc.exeBundled Tor client unpacked at runtime
pathC:\ProgramData\<random>\ (hidden)Hidden directory of unpacked artifacts (includes a "Tor" directory)
fileC:\%s\qeriuwjhrfArtifact path referenced in strings
mutexWanaCrypt0rFamily marker string

MITRE ATT&CK

TechniqueIDNote
Data Encrypted for ImpactT1486Encrypts victim files using the CryptoAPI.
Exploitation of Remote ServicesT1210Spreads over SMB (EternalBlue) to IPC$ shares.
Create or Modify System Process: Windows ServiceT1543.003Installs the mssecsvc2.0 service for persistence.
Inhibit System RecoveryT1490Classic WannaCry recovery-inhibition behaviour (diskpart present).
Virtualization/Sandbox EvasionT1497Kill-switch URL check acts as an environment/analysis check.

Execution flow

Kill switch (checked first):

its result goes into EAX and then EDI.

function and detonates.

In a lab this means INetSim must be OFF for the sample to detonate, and it must be run as administrator.

Static analysis

Hashes match the well-known WannaCry sample and VirusTotal identifies it directly. Interesting imports point to the CryptoAPI and networking:


InternetOpenUrlA  InternetOpenA
CryptAcquireContextA  CryptGenRandom  CryptGenKey
CryptEncrypt  CryptDecrypt  CryptImportKey  CryptDestroyKey

Interesting strings include the kill-switch URL, SMB IPC$ targets, the mssecsvc2.0 service name, WanaCrypt0r, diskpart.exe, and the classic PADDINGXXPADDING... filler.

Dynamic analysis

Observed symptoms: all files encrypted, the desktop wallpaper is changed to a ransom background, and a WannaDecryptor app appears on the desktop.

Host indicators: a hidden directory with a random name is created under C:\ProgramData, containing many unpacked artifacts — including taskhsvc.exe and a Tor directory that unpacks a Tor client. A new service is created to run tasksche.exe persistently.

Detonation requirements: must run as administrator, and the kill-switch URL must be unreachable (INetSim off) or it exits immediately.

Screenshots

Ransom screen / WannaDecryptor
Ransom screen / WannaDecryptor
Encrypted files
Encrypted files
Kill-switch URL in strings
Kill-switch URL in strings
CryptoAPI imports
CryptoAPI imports
SMB IPC$ targets
SMB IPC$ targets
Service creation (mssecsvc2.0)
Service creation (mssecsvc2.0)
Hidden ProgramData directory
Hidden ProgramData directory
Unpacked Tor artifacts
Unpacked Tor artifacts
Kill-switch logic (disassembly)
Kill-switch logic (disassembly)
Payload trigger evaluation
Payload trigger evaluation
Persistence overview
Persistence overview
← All samples