Notification texts go here Contact Us Buy Now!

[Write-up] Practical Malware Analysis | Part 1 - Chapter 3 - Lab 3-2

Practical-Malware-Analysis

CHAPTER 3 - BASIC DYNAMIC ANALYSIS

Write up Lab 3-2


Lab03-02.dll
Analyze the malware found in the file Lab03-02.dll using basic dynamic analysis tools.
Phân tích mã độc được tìm thấy trong tệp Lab03-02.dll sử dụng các công cụ phân tích động cơ bản.

Questions

1. How can you get this malware to install itself?

2. How would you get this malware to run after installation?

3. How can you find the process under which this malware is running?

4. Which filters could you set in order to use procmon to glean information?

5. What are the malware’s host-based indicators?

6. Are there any useful network-based signatures for this malware?

Answers 

Công cụ sử dụng:
PEview
ProcessExplorer
Process Monitor
PE Bear
Malcode Analyst Pack
Kali linux VM Ware
Windows XP VM Ware
Windows 10 Hyper V
ApateDNS
Regshot

 1.How can you get this malware to install itself?

(Làm cách nào bạn có thể khiến mã độc này tự cài đặt?)

Ta biết Lab03-01.exe  là tệp file thực thi do đó việc chạy tệp này khá dễ dàng. Tuy nhiên với Lab03-02.dll là một dạng thư viện liên kết động, cách tệp này hoạt động hoàn toàn khác với tệp .exe.

Thông tin sơ bộ mẫu:

FILELab03-02.dll
SIZE24065
MD584882C9D43E23D63B82004FAE74EBB61
SHA1C6FB3B50D946BEC6F391AEFA4E54478CF8607211
SHA265EB84360CA4E33B8BB60DF47AB5CE962501EF3420BC7AAB90655FD507D2FFCEDD
MALWARETROJAN

Upload file lên Virustotal phần lớn các nhà cung cấp xếp nó vào dạng trojan.

Virustotal report Lab03-01.dll

Sử dung PE Bear biết được tệp .dll này có 5 hàm exports.

PE Bear export Lab03-02.dll

So sánh với các lần nhập bằng công cụ PEView dự đoán rằng tệp Lab03-02.dll sẽ cài đặt một dịch vụ ( install or installA, ,ServiceMain, uninstallServicer, uninstallA).

PEView

Để xác thực những nhận định, tiến hành phân tích thêm strings.

Click full view:
!This program cannot be run in DOS mode.
Rich
.text
`.rdata
@.data
.reloc
QQSUVW3
_^]
[YY
SVW
_^[
$SV
\0h
T0l
<73
Hu4S
WVS
t+j
VVj
PSUV
5xP
j@SU
D$ 3
|$%Y
D$$SPh
=pP
dtJ
t%HHt
D$ P
D$$h
D$ P
SWj
PhDa
=xP
SSSSh
tNSh
h `
h8a
Qh4a
SSSSP
QWP
Pj@
j@P
h0a
j/P
j/P
j.P
j.P
h(a
h$a
_WSP
QSSSSSS
^_[
SVW
F;5p
_^[
SVW3
PhDa
SSSj
Ph~f
5hQ
5hQ
WPV
5hQ
5hQ
_^[
SVWjJ3
h|a
VSW
VSh
VSh
SPSS
tFSh
VSW
VSh0
SSSPS
Sh0
hta
u(hta
hla
hda
h`a
uZh`a
PSSj
SPS
VSW
VSh
VSh
SPSS
_^[t
_^[
=t/
_^[
j>X
j?X
SVWj
PhDa
SSSSh
SPW
h `
h8a
Ph4a
SSSSW
5 Q
QVPW
trh
Vj@
j@VV
h0a
h$a
t(V
_^[
SUV
=xP
UUUUh
QQjPh(`
h `
h8a
hh`
h4a
OQQQQP
Pj@h
t$
_^][
VWj
t*+
~!j
SV3
t h
h(R
PShxd
h(R
Y@Y
u)h
h(R
h(R
SSSSSh
j h
u h
h(R
hdc
h<c
hxd
5$P
h0c
h|b
hpb
hdb
SPSj
h\b
SPS3
ShTb
PhHb
h(R
Y@P
@Y@PWj
_^d
hxQ
SVW
h\e
5LP
hDe
h,e
hdc
_^[
VHtHHt3Ht
Hu_3
VVj
VVj
VVj
%HQ
u?h
Y^j
WVS
WVS
NWVS
u7WPS
u&WVS
WVS
_^[]
GetModuleFileNameA
Sleep
TerminateThread
WaitForSingleObject
GetSystemTime
CreateThread
GetProcAddress
LoadLibraryA
GetLongPathNameA
GetTempPathA
ReadFile
CloseHandle
CreateProcessA
GetStartupInfoA
CreatePipe
GetCurrentDirectoryA
GetLastError
lstrlenA
SetLastError
OutputDebugStringA
KERNEL32.dll
RegisterServiceCtrlHandlerA
RegSetValueExA
RegCreateKeyA
CloseServiceHandle
CreateServiceA
OpenSCManagerA
RegCloseKey
RegQueryValueExA
RegOpenKeyExA
DeleteService
OpenServiceA
SetServiceStatus
ADVAPI32.dll
WSASocketA
WS2_32.dll
InternetReadFile
HttpQueryInfoA
HttpSendRequestA
HttpOpenRequestA
InternetConnectA
InternetOpenA
InternetCloseHandle
WININET.dll
memset
wcstombs
strncpy
strcat
strcpy
atoi
fclose
fflush
??3@YAXPAX@Z
fwrite
fopen
strrchr
??2@YAPAXI@Z
atol
sscanf
strlen
strncat
strstr
_itoa
strchr
__CxxFrameHandler
_EH_prolog
_CxxThrowException
_except_handler3
MSVCRT.dll
??1type_info@@UAE@XZ
free
_initterm
malloc
_adjust_fdiv
_strnicmp
_chdir
_stricmp
Lab03-02.dll
Install
ServiceMain
UninstallService
installA
uninstallA
Y29ubmVjdA==
practicalmalwareanalysis.com
serve.html
dW5zdXBwb3J0
c2xlZXA=
Y21k
cXVpdA==
*/*
 Windows XP 6.11
CreateProcessA
kernel32.dll
.exe
GET
HTTP/1.1
%s %s
1234567890123456
quit
exit
getfile
cmd.exe /c
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
--!>
<!--
.PAX
.PAD
DependOnService
RpcSs
ServiceDll
GetModuleFileName() get dll path
Parameters
Type
Start
ObjectName
LocalSystem
ErrorControl
DisplayName
Description
Depends INA+, Collects and stores network configuration and location information, and notifies applications when this information changes.
ImagePath
%SystemRoot%\System32\svchost.exe -k
SYSTEM\CurrentControlSet\Services\
CreateService(%s) error %d
Intranet Network Awareness (INA+)
%SystemRoot%\System32\svchost.exe -k netsvcs
OpenSCManager()
You specify service name not in Svchost//netsvcs, must be one of following:
RegQueryValueEx(Svchost\netsvcs)
netsvcs
RegOpenKeyEx(%s) KEY_QUERY_VALUE success.
RegOpenKeyEx(%s) KEY_QUERY_VALUE error .
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost
IPRIP
uninstall success
OpenService(%s) error 2
OpenService(%s) error 1
uninstall is starting
.?AVtype_info@@
080@0^0m0r0
1,131D1S1e1n1
2+2:2A2R2r2{2
3;3B3T3[3
4$4W4b4|4
676D6P6]6r6|6
7"7,797D7]7p7w7
8)868B8O8d8n8
9+969O9b9i9v9
:$:2:K:U:\:l:
;";7;A;Q;^;e;x;
<)<9<C<S<e<x<
=*=7=A=Q=c=q=
>(>/>B>Q>_>t>~>
?-???M?b?l?~?
0-0;0P0Z0l0z0
1)1>1H1U1`1y1
2)202?2J2]2j2w2
2y3
4!4:4A4Q4_4t4{4
5 505:5E5o5x5
60676G6U6j6q6~6
7&707;7]7f7v7
8&848N8X8h8r8
9*959O9Y9i9s9
:+:6:P:Z:j:t:
;,;7;Q;[;k;u;
< <'<2<O<\<l<v<
=!=.=9=S=]=j=t=
>">/>:>T>^>n>x>
?#?0?;?U?_?o?y?
0*010<0S0`0m0w0
1!1+1Q1i1s1
2$2G2[2b2j2v2
3 3(3.33383>3D3K3\3c3}3
3`4i4|4
5J5W5v5
5%636:6Q6\6s6
7<7G7p7
888N8d8t8
8!9O9^9p9w9
:V:
;&;7;f;
<(<.<9<B<H<e<l<x<
=$=/=K=o=
=(>J>O>j>w>
4"414F4T4s4
5 5'585V5]5m5s5
6H6\6p6u6
797N7W7c7i7q7y7
8)818C8T8\8k8{8
9/9@9Q9d9u9
:0:>:G:X:^:j:r:
;#;J;P;b;w;
<F<m<z<
=~=
>.>:>@>b>t>
h1l1p1t1|1
2 242@2H2x2

D:\0 Practical Malware Analysis\LABS\BinaryCollection\Chapter_3L>



Một số chuỗi đáng lưu ý như:



Nó tham chiếu đến Windows XP 6.11.
Vì loại tệp của mã độc là PE32 có thể thực thi (DLL), nên để thực thi nó, chúng ta cần sử dụng rundll32.exe.
Trở lại máy ảo Windows XP, tớ sử dụng rundll32.exe để thực thi tệp DLL này và cài đặt nó như một dịch vụ.
Trước khi thực hiện thì sẽ bật Regshot, ProcessExplorer để ghi lại quá trình thay đổi.
  • Regshot 1st
Regshot 1st

Thực hiện chạy với rundll32.exe :
rundll32.exe Lab03-02.dll,install
Note: Vị trí lưu trữ lab là khác nhau, trong trường hợp máy của tôi là: C:\Documents and Settings\Administrator\Desktop\Practical Malware Analysis Labs\BinaryCollection\Chapter_3L
  • Regshot 2nd
Regshot 2nd
  • Kết quả Regshot
~res-x86

Thay đổi trong Regedit

Regedit

Intsall chức năng này sau khi thực hiện mình không thấy gì đáng ngờ. Mình đã thử với installA và kết luận là insatllinstallA giống nhau.

2.How would you get this malware to run after installation?
( Làm cách nào bạn có thể chạy phần mềm độc hại này sau khi cài đặt?)

Như có thể thấy trong report của RegShot, mã độc tạo ra một dịch vụ có tên là IPRIP. Vì vậy có thể khởi động nó bằng lệnh net trong windows như sau:

net start IPRIP

3.How can you find the process under which this malware is running?
( Làm cách nào để biết mã độc đang chạy trên tiến trình nào? )

Sau khi thực hiện với lệnh net để chạy IPRIP. Mình sẽ sử dụng Process Explorer để xác định quy trình nào đang chạy dịch vụ.

Có 2 cách để xác định:

Cách 1 Vì phần mềm độc hại sẽ chạy bên trong một trong các tệp svchost.exe trên hệ thống, chỉ cần di chuột qua từng tệp cho đến khi thấy tên dịch vụ.

Cách 2 Tìm kiếm Lab03-02.dll bằng tính năng Find DLL của Process Explorer.

Menu Find → Find Handle or DLL.. hoặc Ctrl+F

Hộp thoại ProcessExplorer Search xuất hiện, tại khung tìm kiếm gõ từ khóa 'lab' hoặc 'lab03-02.dll' → Search.

ProcessExplorer Search

Kết quả: PID là 1168 (lưu ý giá trị này sẽ khác nhau trên các máy tính khác nhau ).

Tiếp theo mình tìm quy trình process có PID 1168 là svchost.exe

ProcessExplorer

4. Which filters could you set in order to use procmon to glean information?
( Bạn có thể đặt loại bộ lọc nào trong công cụ procmon để thu thập thông tin về mã độc này? )

Vì có khả năng có nhiều process svchost nên có thể sử dụng giá trị PID tìm được ở ProcessExplorer để lọc.

procmon

Kết quả:

Result Filter Procmom

5.What are the malware’s host-based indicators?
(Dấu hiệu lây nhiễm mã độc này trên máy chủ như thế nào?)

Dấu hiệu lây nhiễm là việc tạo ra một dịch vụ có tên là IPRIP.

HKLM\SYSTEM\ControlSet001\Services\IPRIP
HKLM\SYSTEM\ControlSet001\Services\IPRIP\Parameters
HKLM\SYSTEM\ControlSet001\Services\IPRIP\Security
HKLM\SYSTEM\CurrentControlSet\Services\IPRIP
HKLM\SYSTEM\CurrentControlSet\Services\IPRIP\Parameters
HKLM\SYSTEM\CurrentControlSet\Services\IPRIP\Security

Ở phân tích strings ta biết tệp tạo ra một service fake “Intranet Network Awareness (INA+)

Intranet Network Awareness (INA+) fake

Trong máy ảo Windows XP, nhấn Windows+R, hộp thoại Run xuất hiện, nhập services.msc


Run service.msc

Hộp thoại Serices xuất hiện:

Quan sát thấy service fake “Intranet Network Awareness (INA+)" này rất giống với service của windows phía dưới.

Serices

Nhấp chuột phải vào service fake Intranet Network Awareness (INA+) → Properties hộp thoại xuất hiện.

Intranet Network Awareness (INA+) Properties

Quan sát thấy trang thái của dịch vụ đã chạy. như ở phân tích trên ta biết được process đang thực thi này sử dụng thư viện Lab03-02.dll.

ProcessExplorer Search


Windows Registry Editor

Tóm lại những dấu hiệu để phát hiện mã độc lây nhiễm này:
  • IPRIP
  • Intranet Network Awareness (INA+)
  • HKLM\SYSTEM\CurrentControlSet\Services\IPRIP\Parameters\ /v servicedll
  • Phụ thuộc vào INA+, thu thập và lưu trữ thông tin vị trí và cấu hình mạng, đồng thời thông báo cho các ứng dụng khi thông tin này thay đổi.
6.Are there any useful network-based signatures for this malware?
( Liệu mã độc này có một số chữ kỹ mạng hữu ích?)

Sau khi chạy IPRIP:

Run IPRIP

Sử dụng ApateDNS thì thấy nó phân giải tên miền practicalmalwareanalysis.com.

ApateDNS

Bấm đúp vào mục tương ứng của tên miền practicalmalwareanalysis.com để hiển thị chế độ xem Hex DNS, như sau:

Hex DNS

TỔNG KẾT

1. How can you get this malware to install itself?

(Làm cách nào bạn có thể khiến mã độc này tự cài đặt?)

Sử dụng rundll32.exe Lab03-02.dll,install

2. How would you get this malware to run after installation?

( Làm cách nào bạn có thể chạy phần mềm độc hại này sau khi cài đặt?)

Sử dụng lệnh net trong windows:
net start IPRIP

3. How can you find the process under which this malware is running?

( Làm cách nào để biết mã độc đang chạy trên tiến trình nào? )
  • 1168
4. Which filters could you set in order to use procmon to glean information?

( Bạn có thể đặt loại bộ lọc nào trong công cụ procmon để thu thập thông tin về mã độc này?)

Đặt bộ lọc trong procmom với PID1168.

5. What are the malware’s host-based indicators?

(Dấu hiệu lây nhiễm mã độc này trên máy chủ như thế nào?)
  • IPRIP
  • Intranet Network Awareness (INA+)
  • HKLM\SYSTEM\CurrentControlSet\Services\IPRIP\Parameters\ /v servicedll
  • Phụ thuộc vào INA+, thu thập và lưu trữ thông tin vị trí và cấu hình mạng, đồng thời thông báo cho các ứng dụng khi thông tin này thay đổi.
6. Are there any useful network-based signatures for this malware?

( Liệu mã độc này có một số chữ kỹ mạng hữu ích?)

Các kết nối http get đến domain practicalmalwareanalysis.com

KẾT THÚC LAB03-02.DLL

HẸN GẶP LẠI 😊

Đăng nhận xét

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.