๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿฆพ ๋ณด์•ˆ ๐Ÿฆพ/๋ฆฌ๋ฒ„์‹ฑ

[Practical Malware Analysis] Lab01-01.exe, Lab01-01.dll ๋ถ„์„

๋ฐ˜์‘ํ˜•

์ •์  ๋ถ„์„

์ž๋™ํ™” ๋ถ„์„

  • ๋ถ„์„ ๋„๊ตฌ : virustotal.com
  • ๋ถ„์„ ๊ฒฐ๊ณผ :
    • Lab01-01.exe : ๊ฐ์ง€์œจ 55/72, ์•Œ์•ฝ, ์•ˆ๋žฉ ๋“ฑ์—์„œ ๋ฐฑ๋„์–ด, Torjan ๋กœ ๊ฐ์ง€
    • Lab01-01.dll : ๊ฐ์ง€์œจ 47/73, ์•Œ์•ฝ, Google ๋“ฑ์—์„œ ๋ฐฑ๋„์–ด, Torjan๋กœ ๊ฐ์ง€

 

ํŒจํ‚น ์—ฌ๋ถ€

  • ๋ถ„์„ ๋„๊ตฌ : exeinfo
  • ๋ถ„์„ ๊ฒฐ๊ณผ :
    Lab01-01.exe, Lab01-01.dll ๋ชจ๋‘ ํŒจํ‚น๋˜์ง€ ์•Š์€ ๊ฒƒ์„ ํ™•์ธํ•˜์˜€๊ณ , Microsoft Visual C-++ ๋กœ ์ปดํŒŒ์ผ ๋˜์—ˆ์Œ์„ ์ถ”์ธกํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Lab01-01.exe (PEiD), Lab01-01.dll (PEiD)

 

์ปดํŒŒ์ผ ์‹œ๊ฐ„

  • ๋ถ„์„ ๋„๊ตฌ : PEiD
  • ๋ถ„์„ ๊ฒฐ๊ณผ :
    Lab01-01.exe ๋Š” 2010/12/19 16:16:19 UTC ์— ์ปดํŒŒ์ผ์—, Lab01-01.dll ์€ 2010/12/19 16:16:38 UTC ์— ์ปดํŒŒ์ผ ๋œ ๊ฒƒ์œผ๋กœ ๋ณด์•„ Lab01-01.exe ์ปดํŒŒ์ผ ์งํ›„ Lab01-01.dll ์„ ์ปดํŒŒ์ผ ํ–ˆ์Œ์„ ์ถ”์ธกํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Lab01-01.exe (PEiD), Lab01-01.dll (PEiD)

 

IAT ํ™•์ธ

  • Lab01-01.exe
kerner32.dll   ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ, ์ž…์ถœ๋ ฅ ๋ช…๋ น, ํ”„๋กœ์„ธ์Šค์™€ ์Šค๋ ˆ๋“œ ์ƒ์„ฑ, ๋Œ€๋ถ€๋ถ„์˜ Win32 ๊ธฐ๋ณธ์ ์ธ ํ•จ์ˆ˜๋“ค์„ ํฌํ•จํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
  CreateFileMappingA
MapViewOfFile
UnmapViewOfFile
ํŒŒ์ผ ๋งคํ•‘์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
  FindFirstFileA
FindNextFileA
FindClose
ํŒŒ์ผ๋“ค์„ ์—ฐ์†์ ์œผ๋กœ ํƒ์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.
  CreateFileA
CopyFileA
CloseHandle
ํŒŒ์ผ์„ ์—ด๊ณ  ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.
  IsBadReadPtr ๋ฉ”๋ชจ๋ฆฌ ์ฝ๊ธฐ ๊ถŒํ•œ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
msvcrt.dll   ๋น„์ฃผ์–ผ C++ ๋ฒ„์ „ 4.2๋ถ€ํ„ฐ 6.0๊นŒ์ง€์˜ ๋งˆ์ดํฌ๋กœ์†Œํ”„ํŠธ ๋น„์ฃผ์–ผ C ๋Ÿฐํƒ€์ž„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
  _XcptFilter
__getmainargs
__p___initenv
__p__commode
__p__fmode
__set_app_type
__setusermatherr
_adjust_fdiv
_controlfp
_except_handler3
_exit
_initterm
_stricmp
malloc
exit
์ผ๋ฐ˜

 

  • Lab01-01.dll
kernel32.dll   ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ, ์ž…์ถœ๋ ฅ ๋ช…๋ น, ํ”„๋กœ์„ธ์Šค์™€ ์Šค๋ ˆ๋“œ ์ƒ์„ฑ, ๋Œ€๋ถ€๋ถ„์˜ Win32 ๊ธฐ๋ณธ์ ์ธ ํ•จ์ˆ˜๋“ค์„ ํฌํ•จํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
  CloseHandle
CreateMutexA
CreateProcessA
OpenjutexA
Sleep
 
ws2_32.dll   Windows์—์„œ ์ œ๊ณตํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ Windows Socket์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ํ•จ์ˆ˜๋“ค์ด ์ •์˜๋˜์–ด ์žˆ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
  closesocket
connect
htons
inet_addr
recv
send
shutdown
socket
WSAStartup
WSACleanup
์†Œ์ผ“์„ ์—ด์–ด ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•˜๊ณ  ๋ฐ›์Šต๋‹ˆ๋‹ค.
msvcrt.dll   ๋น„์ฃผ์–ผ C++ ๋ฒ„์ „ 4.2๋ถ€ํ„ฐ 6.0๊นŒ์ง€์˜ ๋งˆ์ดํฌ๋กœ์†Œํ”„ํŠธ ๋น„์ฃผ์–ผ C ๋Ÿฐํƒ€์ž„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
  _adjust_fdiv
_initterm
free
malloc
strncmp
์ผ๋ฐ˜

 

 

string ํ™•์ธ

  • ๋ถ„์„ ๋„๊ตฌ : strings.exe, OllyDBG
  • ๋ถ„์„ ๊ฒฐ๊ณผ :

Lab01-01.exe strings, Lab01-01.dll strings

 

  1. Lab01-01.exe๋Š” Lab01-01.dll์„ C:\windows\system32\kerne132.dll ๊ฒฝ๋กœ์— ์ €์žฅํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์ถ”์ธก
  2. Lab01-01.dll ์€ 127.26.152.13๊ณผ ํ†ต์‹ ์„ ํ•˜๊ธฐ ์œ„ํ•œ ์†Œ์ผ“์„ ์ƒ์„ฑ, hello๋กœ ์—ฐ๊ฒฐ ํ™•์ธ ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์ถ”์ธก

 

 

๋™์ž‘ ์ถ”์ธก

  • ๋ถ„์„ ๋„๊ตฌ : OllyDBG, IDA
  • ๋ถ„์„ ๊ฒฐ๊ณผ :

Lab01-01.exe

C:\windows\system32\Kernel32.dll ์˜ ํŒŒ์ผ ๋งคํ•‘์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

 

Lab01-01.dll ํŒŒ์ผ์„ C:\windows\system32\kerne132.dl์— ๋ณต์‚ฌํ•œ๋‹ค.

 

 

Lab01-01.dll

“SADFHUHF”๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ๋ฎคํ…์Šค๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

 

Winsock DLL ์‚ฌ์šฉ์„ ์‹œ์ž‘ํ•˜๊ณ  ํŠน์ • ์ „์†ก์„ ์œ„ํ•˜์—ฌ socket์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. socket ํ•จ์ˆ˜์˜ ๋‘๋ฒˆ์งธ ์ธ์ž type์ด 1์ธ ๊ฒƒ์„ ํ†ตํ•ด TCP ์—ฐ๊ฒฐ์„ ํ•œ๋‹ค๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

127.26.152.13์œผ๋กœ ํ†ต์‹ ์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

 

hello๋ฅผ ๋ณด๋‚ด๊ณ  ์„œ๋ฒ„์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ตœ๋Œ€ 1000byte ๊นŒ์ง€ ๋ฐ›์•„์˜ต๋‹ˆ๋‹ค.

 

์ผ์ •์‹œ๊ฐ„ ๊ธฐ๋‹ค๋ฆฐ ํ›„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

 

์š”์•ฝ

์œ„์—์„œ ์—ด๊ฑฐํ•œ ๋ชจ๋“  ๋‚ด์šฉ์„ ๋ฐ”ํƒ•์œผ๋กœ, ์‹คํ–‰ ํŒŒ์ผ์€ ๋ฐฑ๋„์–ด ๋˜๋Š” ํŠธ๋กœ์ด ๋ชฉ๋งˆ ์—ญํ• ์„ ํ•˜๋Š” DLL์„ ์‹คํ–‰ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋œ๋‹ค๊ณ  ์ถ”์ธก๋ฉ๋‹ˆ๋‹ค. C:\windows\system32\kerne132.dll์— ์ •์ƒ DLL ํŒŒ์ผ kernel32.dll์„ ์œ„์žฅํ•˜์—ฌ Lab01-01.dll์„ ์ €์žฅํ•˜๋ ค๋Š” ๊ฒƒ์œผ๋กœ ์ถ”์ธก๋ฉ๋‹ˆ๋‹ค. kerne132.dll ํŒŒ์ผ์„ ์‹คํ–‰ํ•˜๋ฉด 127.26.152.13 ์„œ๋ฒ„์— ์—ฐ๊ฒฐํ•  ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์Šต๋‹ˆ๋‹ค.

 

 

 

 

 

๋ฐ˜์‘ํ˜•