text
stringlengths 4
429
|
---|
ZwCreateKey |
ZwSaveKey |
ZwReadFile |
ZwQuerySystemInformation |
ZwQueryInformationProcess |
ZwClose |
ZwTerminateProcess |
ZwShutdownSystem |
ObOpenObjectByName |
BAE Systems Applied Intelligence: Snake Rootkit Report 2014 14 |
For example, the hook handlers of the registry-related APIs will block access to the registry entries that contain the name of the |
driver. In one example, the rootkit blocks access to registry entries that contain the strings |
Ultra3 |
and |
~ROOT |
The ZwReadFile() hook handler will block access to the home directory where the rootkit keeps its file. In one of the analysed |
kernel-centric Snake samples the home directory was hard-coded as %windows%\$NtUninstallQ817473$, so it blocked file |
read access from that directory. |
The ZwClose() hook handler is used to inject the DLL module into the userland processes. |
The hook handler for ZwTerminateProcess() checks if the process being shut down is svchost.exe. If so, it considers |
it to be a system shutdown, so it unloads its usermode DLL and deactivates its own network drivers, just like it does when its |
ZwShutdownSystem() hook handler gets invoked. |
The ObOpenObjectByName() hook is designed to hide the presence of its virtual partitions (described later). |
To encrypt data stored on its virtual partitions, the driver sets a hook for another API: |
IofCallDriver() |
To re-infect the usermode process svchost.exe and to re-enable its network drivers, the rootkit hooks these APIs: |
ZwCreateThread |
ZwCreateUserProcess |
WFP CALLOUT DRIVER |
Snake then proceeds to the task of deep packet inspection and modification. |
In order to accomplish it, it registers a callout driver for Windows Filtering Platform (WFP), an architecture first introduced with |
Windows Vista and nowadays normally used by antivirus and/or intrusion detection systems to inspect/block malicious traffic. |
Snake sets filters at the layers FWPM_LAYER_STREAM_V4 and FWPM_LAYER_ALE_FLOW_ESTABLISHED_V4 in the TCP/ |
IP stack, so that its callout driver is notified whenever a TCP connection is established by a browser. When that happens, the |
rootkit triggers an event named \BaseNamedObjects\wininet_activate. When the data arrives, it is intercepted with the |
FwpsCopyStreamDataToBuffer0() API, and then scanned for the presence of the hidden commands from C&C. |
The driver inspects bidirectional network data on a per stream basis, as it |
s located right on the stream data path. An ability to |
manipulate data streams is provided with the packet injection logic below, allowing Snake to covertly insert traffic destined to its |
C&C servers: |
01 int __stdcall stream_inject(int flowHandle, int calloutId, int layerId) |
02 { |
03 int iRet = 0; |
04 int ntStatus = FwpsAllocateNetBufferAndNetBufferList(m_hNdisNblPool, 0, 0, 0, 0, &iRet); |
05 if (!ntStatus) |
06 { |
07 ntStatus = _FwpsStreamInjectAsync(m_hInjection, |
08 0, |
09 0, |
10 flowHandle, |
11 calloutId, |
12 layerId, |
13 20, |
14 3, |
15 iRet, |
16 0, |
17 sStreamInjectCompletion, |
18 0); |
19 if (!ntStatus) |
20 { |
21 iRet = 0; |
22 } |
23 if (iRet) |
24 { |
25 FwpsFreeNetBufferList(iRet); |
26 } |
27 return ntStatus; |
28 } |
BAE Systems Applied Intelligence: Snake Rootkit Report 2014 15 |
In order to qualify as a browser, the usermode process must have any of the following names: |
01 bool isBrowserProcess(const wchar_t *szProcName) |
02 { |
03 return !wcsicmp(szProcName, L |
iexplore.exe |
) || |
04 !wcsicmp(szProcName, L |
firefox.exe |
) || |
05 !wcsicmp(szProcName, L |
opera.exe |
) || |
06 !wcsicmp(szProcName, L |
netscape.exe |
) || |
07 !wcsicmp(szProcName, L |
mozilla.exe |
) || |
08 !wcsicmp(szProcName, L |
chrome.exe |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.