text
stringlengths 4
429
|
---|
imp_level
|
reliable_n_tries
|
reliable_keepalive
|
reliable_rtt
|
reliable_padding
|
reliable_no_keepalive
|
m2b_raw
|
psk
|
key
|
Once the incoming data is authenticated and decrypted, the driver passes it to the DLL by using memory pipes.
|
For example, on HTTP traffic arrival it may send traffic data into a memory pipe \Device\NamedPipe\isapi_http, and then,
|
send a received peer-2-peer command message write_peer_nfo=[IP_ADDRESS:PORT]0frag_no_scrambling=Y0 into
|
another memory pipe called \Device\NamedPipe\isapi_dg.
|
In order to log its activity, the driver writes log data into the pipe \Device\NamedPipe\isapi_log, so that the DLL could log the
|
data into the log files.
|
Full list of the named pipes used for communications is provided below:
|
\Device\NamedPipe\isapi_http
|
\Device\NamedPipe\isapi_log
|
\Device\NamedPipe\isapi_dg
|
\Device\NamedPipe\services_control
|
Messages submitted into the pipes are wrapped into the structures. The structures appear to contain headers to allow the pipe
|
server, that runs within an infected userland module, to identify the messages first and then unwrap the structures accordingly.
|
For example, the message headers could be:
|
domc.np
|
frag.np
|
Once received from the pipes and unwrapped/decoded, the data is then handled by the usermode DLL as per the data intention -
|
whether it
|
s a traffic sniffing task, a peer-2-peer client logic, a logging task, or a task of saving received files into the virtual volumes.
|
BAE Systems Applied Intelligence: Snake Rootkit Report 2014 19
|
VIRTUAL FILE VOLUMES
|
The driver creates virtual file volumes for encrypted storage of its files and configuration data:
|
\\.\Hd1
|
\\.\Hd2
|
The volumes are mounted from the virtual file systems RawDisk1 and RawDisk2.
|
The first partition is created with the following steps:
|
the driver creates a 100Mb (0x6400000 bytes) file %windows%\$NtUninstallQ817473$\hotfix.dat by calling
|
IoCreateFile() API
|
then it creates a section object with the flags SEC_COMMIT and SEC_NOCACHE (0x18000000) by calling
|
ZwCreateSection(); the flags mean the file is mapped into memory, the entire range of pages will be committed
|
next, it maps a view of the created section into the virtual address space by calling ZwMapViewOfSection()
|
finally, it creates device \Device\RawDisk1 from the section map and mounts it as \\.\Hd1
|
The hook installed by the rootkit on IofCallDriver() API provides on-the-fly data encryption/decryption whenever that data is
|
written to or read from the volume. The encryption algorithm is based on CAST-128, with the hard-coded key stored in the rootkit
|
body.
|
As a result, whenever the data is saved into the volume Hd1, it will be scrambled on-the-fly, and reflected in the persistent storage
|
file hotfix.dat, which is physically located within the rootkit
|
home
|
directory:
|
Z:\WINDOWS\$NtuninstallQ817473$>dir
|
Volume in drive Z has no label.
|
Volume Serial Number is 2479-98AC
|
Directory of Z:\WINDOWS\$NtuninstallQ817473$
|
13/02/2014 04:47 PM <DIR> .
|
13/02/2014 04:47 PM <DIR> ..
|
03/02/2014 01:57 PM 210,944 fdisk.sys
|
13/02/2014 04:47 PM 104,857,600 hotfix.dat
|
2 File(s) 105,068,544 bytes
|
2 Dir(s) 8,406,433,792 bytes free
|
Analysis of the hotfix.dat file contents reveals it
|
s a fully encrypted file with flat entropy. Thus, it is not possible to reveal the
|
contents of the Snake
|
s volume by accessing the contents of this file (unless the encryption is broken, that is).
|
Enlisting the contents of the created volume is possible, along with creating files on it:
|
C:\>echo Test > \\.\Hd1\Test.txt
|
C:\>type \\.\Hd1\\Test.txt
|
Test
|
C:\>dir \\.\Hd1\\
|
Volume in drive \\.\Hd1 has no label.
|
Volume Serial Number is BA9B-99E8
|
Directory of \\.\Hd1
|
14/02/2014 02:22 PM 7 Test.txt
|
1 File(s) 7 bytes
|
0 Dir(s) 0 bytes free
|
BAE Systems Applied Intelligence: Snake Rootkit Report 2014 20
|
However, as soon as IofCallDriver() hook is removed, the same
|
command will fail, as with no hook the rootkit cannot
|
decrypt the scrambled volume:
|
C:\>dir \\.\Hd1\\
|
Incorrect function.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.