Analysis by: Cris Nowell Pantanilla

 ALIASES:

Win32/Filecoder.WannaCryptor.D (ESET-NOD32), Trojan-Ransom.Win32.Wanna.b (Kaspersky), Win32.Trojan-Ransom.WannaCry.A (GData), Ransom.WanaCrypt0r (Malwarebytes)

 PLATFORM:

Windows

 OVERALL RISK RATING:
 DAMAGE POTENTIAL:
 DISTRIBUTION POTENTIAL:
 REPORTED INFECTION:
 INFORMATION EXPOSURE:

  • Threat Type: Ransomware

  • Destructiveness: No

  • Encrypted: Yes

  • In the wild: Yes

  OVERVIEW

Infection Channel: Downloaded from the Internet

This ransomware exploits the MS17-010 vulnerability to spread to other vulnerable computers.

This Ransomware arrives on a system as a file dropped by other malware or as a file downloaded unknowingly by users when visiting malicious sites.

It drops files as ransom note.

  TECHNICAL DETAILS

File Size: 3,514,368 bytes
File Type: EXE
Memory Resident: Yes
Initial Samples Received Date: 12 May 2017
Payload: Modifies files

Arrival Details

This Ransomware arrives on a system as a file dropped by other malware or as a file downloaded unknowingly by users when visiting malicious sites.

This malware arrives via the following means:

Installation

This Ransomware drops the following copies of itself into the affected system and executes them:

  • %ProgramData%\{random}\tasksche.exe

(Note: %ProgramData% is the Program Data folder, where it usually is C:\Program Files in Windows 2000, Windows Server 2003, and Windows XP (32- and 64-bit); C:\ProgramData in Windows Vista (32- and 64-bit), Windows 7 (32- and 64-bit), Windows 8 (32- and 64-bit), Windows 8.1 (32- and 64-bit), Windows Server 2008, and Windows Server 2012.)

It drops the following component file(s):

  • {folder of encrypted files}\@WanaDecryptor@.exe.lnk
  • {folder of encrypted files}\@Please_Read_Me@.txt
  • {folder of encrypted files}\@WanaDecryptor@.exe ← RANSOM_WCRY.I
  • %ProgramData%\{random}\00000000.eky
  • %ProgramData%\{random}\00000000.pky
  • %ProgramData%\{random}\00000000.res
  • %ProgramData%\{random}\@Please_Read_Me@.txt
  • %ProgramData%\{random}\@WanaDecryptor@.exe
  • %ProgramData%\{random}\@WanaDecryptor@.exe.lnk
  • %ProgramData%\{random}\TaskData\Tor\libeay32.dll
  • %ProgramData%\{random}\TaskData\Tor\libevent-2-0-5.dll
  • %ProgramData%\{random}\TaskData\Tor\libevent_core-2-0-5.dll
  • %ProgramData%\{random}\TaskData\Tor\libevent_extra-2-0-5.dll
  • %ProgramData%\{random}\TaskData\Tor\libgcc_s_sjlj-1.dll
  • %ProgramData%\{random}\TaskData\Tor\libssp-0.dll
  • %ProgramData%\{random}\TaskData\Tor\ssleay32.dll
  • %ProgramData%\{random}\TaskData\Tor\taskhsvc.exe
  • %ProgramData%\{random}\TaskData\Tor\tor.exe
  • %ProgramData%\{random}\TaskData\Tor\zlib1.dll
  • %ProgramData%\{random}\b.wnry ← background image
  • %ProgramData%\{random}\c.wnry ← TOR links
  • %ProgramData%\{random}\f.wnry ← list of encrypted files
  • %ProgramData%\{random}\r.wnry ← @Please_Read_Me@.txt
  • %ProgramData%\{random}\s.wnry ← TOR module
  • %ProgramData%\{random}\t.wnry
  • %ProgramData%\{random}\taskdl.exe
  • %ProgramData%\{random}\tasksche.exe
  • %ProgramData%\{random}\taskse.exe
  • %ProgramData%\{random}\u.wnry ← @WanaDecryptor@.exe
  • %All User Profile%\{random}\00000000.eky
  • %All User Profile%\{random}\00000000.pky
  • %All User Profile%\{random}\00000000.res
  • %All User Profile%\{random}\@Please_Read_Me@.txt
  • %All User Profile%\{random}\@WanaDecryptor@.exe
  • %All User Profile%\{random}\@WanaDecryptor@.exe.lnk
  • %All User Profile%\{random}\TaskData\Tor\libeay32.dll
  • %All User Profile%\{random}\TaskData\Tor\libevent-2-0-5.dll
  • %All User Profile%\{random}\TaskData\Tor\libevent_core-2-0-5.dll
  • %All User Profile%\{random}\TaskData\Tor\libevent_extra-2-0-5.dll
  • %All User Profile%\{random}\TaskData\Tor\libgcc_s_sjlj-1.dll
  • %All User Profile%\{random}\TaskData\Tor\libssp-0.dll
  • %All User Profile%\{random}\TaskData\Tor\ssleay32.dll
  • %All User Profile%\{random}\TaskData\Tor\taskhsvc.exe
  • %All User Profile%\{random}\TaskData\Tor\tor.exe
  • %All User Profile%\{random}\TaskData\Tor\zlib1.dll
  • %All User Profile%\{random}\b.wnry
  • %All User Profile%\{random}\c.wnry ← TOR links
  • %All User Profile%\{random}\f.wnry ← list of encrypted files
  • %All User Profile%\{random}\r.wnry ← @Please_Read_Me@.txt
  • %All User Profile%\{random}\s.wnry ← TOR module
  • %All User Profile%\{random}\t.wnry
  • %All User Profile%\{random}\taskdl.exe
  • %All User Profile%\{random}\tasksche.exe
  • %All User Profile%\{random}\taskse.exe
  • %All User Profile%\{random}\u.wnry ← @WanaDecryptor@.exe
  • %User Temp%\{number}.WNCRYT ← temporary files
  • %Desktop%\@Please_Read_Me@.txt
  • %Desktop%\@WanaDecryptor@.bmp
  • %Desktop%\@WanaDecryptor@.exe

(Note: %ProgramData% is the Program Data folder, where it usually is C:\Program Files in Windows 2000, Windows Server 2003, and Windows XP (32- and 64-bit); C:\ProgramData in Windows Vista (32- and 64-bit), Windows 7 (32- and 64-bit), Windows 8 (32- and 64-bit), Windows 8.1 (32- and 64-bit), Windows Server 2008, and Windows Server 2012.. %User Temp% is the user's temporary folder, where it usually is C:\Documents and Settings\{user name}\Local Settings\Temp on Windows 2000, Windows Server 2003, and Windows XP (32- and 64-bit); C:\Users\{user name}\AppData\Local\Temp on Windows Vista (32- and 64-bit), Windows 7 (32- and 64-bit), Windows 8 (32- and 64-bit), Windows 8.1 (32- and 64-bit), Windows Server 2008, and Windows Server 2012.. %Desktop% is the desktop folder, where it usually is C:\Documents and Settings\{user name}\Desktop in Windows 2000, Windows Server 2003, and Windows XP (32- and 64-bit); C:\Users\{user name}\Desktop in Windows Vista (32- and 64-bit), Windows 7 (32- and 64-bit), Windows 8 (32- and 64-bit), Windows 8.1 (32- and 64-bit), Windows Server 2008, and Windows Server 2012.)

It creates the following folders:

  • %ProgramData%\{random} ← malware path
  • %ProgramData%\{random}\msg ← language notes
  • %ProgramData%\{random}\TaskData
  • %ProgramData%\{random}\TaskData\Data
  • %ProgramData%\{random}\TaskData\Data\Tor
  • %ProgramData%\{random}\TaskData\Tor
  • %All User Profile%\{random}\msg ← language notes
  • %All User Profile%\{random}\TaskData
  • %All User Profile%\{random}\TaskData\Data
  • %All User Profile%\{random}\TaskData\Data\Tor
  • %All User Profile%\{random}\TaskData\Tor

(Note: %ProgramData% is the Program Data folder, where it usually is C:\Program Files in Windows 2000, Windows Server 2003, and Windows XP (32- and 64-bit); C:\ProgramData in Windows Vista (32- and 64-bit), Windows 7 (32- and 64-bit), Windows 8 (32- and 64-bit), Windows 8.1 (32- and 64-bit), Windows Server 2008, and Windows Server 2012.)

It adds the following mutexes to ensure that only one of its copies runs at any one time:

  • Global\MsWinZonesCacheCounterMutexA

Autostart Technique

This Ransomware adds the following registry entries to enable its automatic execution at every system startup:

HKEY_CURRENT_USER\Software\Microsoft\
Windows\CurrentVersion\Run
{random} = "%ProgramData%\{random}\tasksche.exe"

It registers as a system service to ensure its automatic execution at every system startup by adding the following registry keys:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\
services\mssecsvc2.0
Type = "16"

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\
services\mssecsvc2.0
Start = "2"

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\
services\mssecsvc2.0
ErrorControl = "1"

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\
services\mssecsvc2.0
ImagePath = {initial malware file path} -m security

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\
services\mssecsvc2.0
DisplayName = Microsoft Security Center (2.0) Service

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\
services\mssecsvc2.0
ObjectName = LocalSystem

Other System Modifications

This Ransomware adds the following registry keys:

HKEY_CURRENT_USER\Software\Classes\
VirtualStore\MACHINE\SOFTWARE\
WanaCrypt0r

It adds the following registry entries:

HKEY_CURRENT_USER\Software\WanaCrypt0r
wd = "%ProgramData%\{random}"

It changes the desktop wallpaper by modifying the following registry entries:

HKEY_CURRENT_USER\Control Panel\Desktop
Wallpaper = "%Desktop%\@WanaDecryptor@.bmp"

(Note: The default value data of the said registry entry is {user settings}.)

It sets the system's desktop wallpaper to the following image:

Other Details

This Ransomware encrypts files with the following extensions:

  • .123
  • .3dm
  • .3ds
  • .3g2
  • .3gp
  • .602
  • .7z
  • .ARC
  • .PAQ
  • .accdb
  • .aes
  • .ai
  • .asc
  • .asf
  • .asm
  • .asp
  • .avi
  • .backup
  • .bak
  • .bat
  • .bmp
  • .brd
  • .bz2
  • .cgm
  • .class
  • .cmd
  • .cpp
  • .crt
  • .cs
  • .csr
  • .csv
  • .db
  • .dbf
  • .dch
  • .der
  • .dif
  • .dip
  • .djvu
  • .doc
  • .docb
  • .docm
  • .docx
  • .dot
  • .dotm
  • .dotx
  • .dwg
  • .edb
  • .eml
  • .fla
  • .flv
  • .frm
  • .gif
  • .gpg
  • .gz
  • .hwp
  • .ibd
  • .iso
  • .jar
  • .java
  • .jpeg
  • .jpg
  • .js
  • .jsp
  • .key
  • .lay
  • .lay6
  • .ldf
  • .m3u
  • .m4u
  • .max
  • .mdb
  • .mdf
  • .mid
  • .mkv
  • .mml
  • .mov
  • .mp3
  • .mp4
  • .mpeg
  • .mpg
  • .msg
  • .myd
  • .myi
  • .nef
  • .odb
  • .odg
  • .odp
  • .ods
  • .odt
  • .onetoc2
  • .ost
  • .otg
  • .otp
  • .ots
  • .ott
  • .p12
  • .pas
  • .pdf
  • .pem
  • .pfx
  • .php
  • .pl
  • .png
  • .pot
  • .potm
  • .potx
  • .ppam
  • .pps
  • .ppsm
  • .ppsx
  • .ppt
  • .pptm
  • .pptx
  • .ps1
  • .psd
  • .pst
  • .rar
  • .raw
  • .rb
  • .rtf
  • .sch
  • .sh
  • .sldm
  • .sldx
  • .slk
  • .sln
  • .snt
  • .sql
  • .sqlite3
  • .sqlitedb
  • .stc
  • .std
  • .sti
  • .stw
  • .suo
  • .svg
  • .swf
  • .sxc
  • .sxd
  • .sxi
  • .sxm
  • .sxw
  • .tar
  • .tbk
  • .tgz
  • .tif
  • .tiff
  • .txt
  • .uop
  • .uot
  • .vb
  • .vbs
  • .vcd
  • .vdi
  • .vmdk
  • .vmx
  • .vob
  • .vsd
  • .vsdx
  • .wav
  • .wb2
  • .wk1
  • .wks
  • .wma
  • .wmv
  • .xlc
  • .xlm
  • .xls
  • .xlsb
  • .xlsm
  • .xlsx
  • .xlt
  • .xltm
  • .xltx
  • .xlw
  • .zip

Ransomware Routine

This Ransomware avoids encrypting files found in the following folders:

  • \Intel
  • \ProgramData
  • \WINDOWS
  • \Program Files
  • \Program Files (x86)
  • \AppData\Local\Temp
  • \Local Settings\Temp
  • Temporary Internet Files
  • Content.IE5

It renames encrypted files using the following names:

  • {original filename}.WNCRY

It drops the following file(s) as ransom note:

NOTES:

It connects to http://www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com. If the connection is successful, it will stop execution. Hence, it is used as a kill switch for the infection.

It scans the following to check for open port 445:

  • Hosts on the Local Area Network
  • randomly-generated IP address over the Internet

If it finds a host either on the LAN/Internet with open port 445, it will attempt to exploit MS17-010 vulnerability to drop and execute a copy of itself to the remote host.

It uses the following file path for its dropped copies on the remote hosts:

  • %Windows%\mssecsvc.exe

It checks for the presence of the file %WINDOWS%\tasksche.exe. If the file exist, it will move the file to the following directory %WINDOWS%\qeriuwjhrf\tasksche.exe.

It executes %Windows%\tasksche.exe with /i parameter.

  SOLUTION

Minimum Scan Engine: 9.850
FIRST VSAPI PATTERN FILE: 13.402.02
FIRST VSAPI PATTERN DATE: 12 May 2017
VSAPI OPR PATTERN File: 13.403.00
VSAPI OPR PATTERN Date: 13 May 2017

Step 1

Before doing any scans, Windows XP, Windows Vista, and Windows 7 users must disable System Restore to allow full scanning of their computers.

Step 2

Identify and terminate files detected as Ransom_WCRY.SM

[ Learn More ]
  1. Windows Task Manager may not display all running processes. In this case, please use a third-party process viewer, preferably Process Explorer, to terminate the malware/grayware/spyware file. You may download the said tool here.
  2. If the detected file is displayed in either Windows Task Manager or Process Explorer but you cannot delete it, restart your computer in safe mode. To do this, refer to this link for the complete steps.
  3. If the detected file is not displayed in either Windows Task Manager or Process Explorer, continue doing the next steps.

Step 3

Delete this registry key

[ Learn More ]

Important: Editing the Windows Registry incorrectly can lead to irreversible system malfunction. Please do this step only if you know how or you can ask assistance from your system administrator. Else, check this Microsoft article first before modifying your computer's registry.

  • In HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE
    • WanaCrypt0r
  • In HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services
    • mssecsvc2.0

Step 4

Delete this registry value

[ Learn More ]

Important: Editing the Windows Registry incorrectly can lead to irreversible system malfunction. Please do this step only if you know how or you can ask assistance from your system administrator. Else, check this Microsoft article first before modifying your computer's registry.

 
  • In HKEY_CURRENT_USER\Software\WanaCrypt0r
    • wd = "%ProgramData%\{random}"
  • In HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
    • {random} = "%ProgramData%\{random}\tasksche.exe"

Step 5

Search and delete these folders

[ Learn More ]
Please make sure you check the Search Hidden Files and Folders checkbox in the More advanced options option to include all hidden folders in the search result.
%ProgramData%\{random}
%ProgramData%\{random}\msg
%ProgramData%\{random}\TaskData
%ProgramData%\{random}\TaskData\Data
%ProgramData%\{random}\TaskData\Data\Tor
%ProgramData%\{random}\TaskData\Tor
%All User Profile%\{random}\msg
%All User Profile%\{random}\TaskData
%All User Profile%\{random}\TaskData\Data
%All User Profile%\{random}\TaskData\Data\Tor
%All User Profile%\{random}\TaskData\Tor

Step 6

Search and delete these files

[ Learn More ]
There may be some files that are hidden. Please make sure you check the Search Hidden Files and Folders checkbox in the "More advanced options" option to include all hidden files and folders in the search result.
{folder of encrypted files}\@WanaDecryptor@.exe.lnk
{folder of encrypted files}\@Please_Read_Me@.txt
{folder of encrypted files}\@WanaDecryptor@.exe
%User Temp%\{number}.WNCRYT ← temporary files
%Desktop%\@Please_Read_Me@.txt
%Desktop%\@WanaDecryptor@.bmp
%Desktop%\@WanaDecryptor@.exe

Step 7

Restart in normal mode and scan your computer with your Trend Micro product for files detected as Ransom_WCRY.SM. If the detected files have already been cleaned, deleted, or quarantined by your Trend Micro product, no further step is required. You may opt to simply delete the quarantined files. Please check this Knowledge Base page for more information.

Step 8

Reset your Desktop properties

[ Learn More ]

Step 9

Restore encrypted files from backup.


Did this description help? Tell us how we did.