text
stringlengths
4
429
$Id: named_mutex.c 15594 2011-03-18 08:04:09Z gilg $
$Id: nt.c 20719 2012-12-05 12:31:20Z gilg $
$Id: ntsystem.c 19662 2012-07-09 13:17:17Z gilg $
$Id: rw_lock.c 14516 2010-11-29 12:27:33Z gilg $
$Id: rk_bpf.c 14518 2010-11-29 12:28:30Z gilg $
$Id: t_status.c 14478 2010-11-27 12:41:22Z gilg $
It also exposed the project name of this particular variant as
sengoku
d:\proj\cn\fa64\sengoku\_bin\sengoku\win32_debug\sengoku_Win32.pdb
Now it
s time to execute the driver and see what it does.
BAE Systems Applied Intelligence: Snake Rootkit Report 2014 7
ROOTKIT EXECUTION
When first executed, the driver creates device named \Device\vstor32 with a symbolic link \DosDevices\vstor32.
This device is used for userland/kernel communications.
Next, it drops a DLL into the %windows% directory - the DLL is carried in the body of the driver as a binary chunk with
XOR 0xAA applied on top of it, so the driver decrypts it first.
Depending on the variant, the DLL is dropped either under a random name or a hard-coded name, such as mscpx32n.dll.
The purpose of this DLL is to be injected into the user-mode processes. Some variants of Snake carry the DLL modules that can be
installed as a service, to be run within taskhost.exe or services.exe processes.
Next, the driver sets up the hooks for the following kernel-mode APIs:
ZwCreateThread
ZwCreateUserProcess
ZwShutdownSystem
After that, it calls PsSetCreateProcessNotifyRoutine() in order to be notified whenever a new process is started.
The handlers of the hooks above along with the notification callback allow Snake to stay persistent on a system, being able to infect
any newly created processes, and restore its driver file in case it gets deleted.
Another set of hooks it sets is designed to hide the presence of the Snake components on the system:
ZwQuerySystemInformation
ZwQueryInformationProcess
ZwClose
ZwTerminateProcess
The driver then watches for all userland processes to see if they load any web pages.
As long as the user is not using the Internet, Snake stays dormant too, as there is no process that communicates with the web
servers.
However, as soon as the user goes online, the driver intercepts that event and then immediately injects the malicious DLL module
into the process that initiated connection (the browser).
Once injected, the module initiates polling from one of the hard-coded C&C servers.
The purpose of this behaviour is to blend Snake
s traffic with the browser traffic, bypassing the firewalls, and keeping a low profile
at the same time. By communicating from within a process that also communicates, even a technically savvy user will find it
challenging to detect Snake traffic among legitimate traffic.
The reason behind such difficulty is because modern web pages often fetch pages from the different web servers, including such
data as additional scripts, CSS templates, advertising contents, analytics data, blogs, social networking data, etc. When intercepted
with the purpose of analysis, such traffic may literally represent itself hundreds of DNS and HTTP requests made when a popular
website, such as a news website is open.
Hiding a few DNS/HTTP requests among busy network traffic allows Snake rootkit to stay unnoticed.
In order to test Snake
s communications with the C&C servers, and still being able to clearly distinguish its traffic, a small tool was
built to generate GET request to a web server running on the analysed system.
The tool was named as chrome.exe in order to trigger the malware communications.
BAE Systems Applied Intelligence: Snake Rootkit Report 2014 8
COMMAND-AND-CONTROL COMMUNICATIONS
As long as the test tool named chrome.exe did not make any requests, its memory stayed pristine. There were no injections made
by the driver.
As soon as the tool made its first GET requests, the driver immediately injected a malicious DLL module in it, and that module
started producing the following traffic:
No. Time Source Destination Protocol Length Info
38 44.290689000 192.168.202.131 192.168.202.2 DNS 77 Standard query 0x6ad3 A winter.site11.com
41 44.292830000 192.168.202.2 192.168.202.131 DNS 93 Standard query response 0x6ad3 A 31.170.161.136
45 44.518185000 192.168.202.131 31.170.161.136 HTTP 219 GET /D/pub.txt HTTP/1.1
47 44.743999000 31.170.161.136 192.168.202.131 HTTP 474 HTTP/1.1 302 Found (text/html)
84 45.990199000 192.168.202.131 31.170.161.136 HTTP 233 GET /D/1/f42cce984070b8ab1c0 HTTP/1.1
86 46.216079000 31.170.161.136 192.168.202.131 HTTP 474 HTTP/1.1 302 Found (text/html)
94 46.525887000 192.168.202.131 31.170.164.249 HTTP 217 GET /? HTTP/1.1
101 46.939359000 192.168.202.131 192.168.202.2 DNS 82 Standard query 0x5ae5 A swim.onlinewebshop.net
102 46.940914000 192.168.202.2 192.168.202.131 DNS 98 Standard query response 0x5ae5 A 83.125.22.197
107 47.287205000 192.168.202.131 83.125.22.197 HTTP 224 GET /D/pub.txt HTTP/1.1
109 48.219805000 83.125.22.197 192.168.202.131 HTTP 330 HTTP/1.1 200 OK (text/html)
118 48.813394000 192.168.202.131 192.168.202.2 DNS 82 Standard query 0x5362 A july.mypressonline.com
119 48.814837000 192.168.202.2 192.168.202.131 DNS 98 Standard query response 0x5362 A 83.125.22.197
123 49.131675000 192.168.202.131 83.125.22.197 HTTP 224 GET /D/pub.txt HTTP/1.1
125 49.780323000 83.125.22.197 192.168.202.131 HTTP 330 HTTP/1.1 200 OK (text/html)
137 50.536285000 192.168.202.131 31.170.161.136 HTTP 220 GET /D/77568289 HTTP/1.1
139 50.762073000 31.170.161.136 192.168.202.131 HTTP 474 HTTP/1.1 302 Found (text/html)
147 51.101706000 192.168.202.131 31.170.164.249 HTTP 217 GET /? HTTP/1.1
154 51.548661000 192.168.202.131 83.125.22.197 HTTP 225 GET /D/77568289 HTTP/1.1
163 52.014730000 192.168.202.131 83.125.22.197 HTTP 225 GET /D/77568289 HTTP/1.1
165 52.637958000 83.125.22.197 192.168.202.131 HTTP 679 HTTP/1.1 200 OK (text/html)
Received command
The domain names of the C&C servers it relies on are hard-coded in the body of the malware. Some examples are given below, and
a full list of known domains is given in the Appendix D:
north-area.bbsindex.com
winter.site11.com
swim.onlinewebshop.net