2012/05/14

Volatility를 이용한 Windows 2003 메모리 덤프 분석


요즘은 침해사고조사시 메모리 덤프를 뜨는 경우가 많습니다. 디스크 이미징에 비해 용량은 작지만 생각보다 많은 정보들을 가지고 있기 때문이죠.. 물론 침해사고 인지 후 시스템을 끄거나 재부팅을 하지 않을 상태여야만 많은 정보들을 획득할 수가 있습니다.

이런 메모리 덤프 이미지를 분석할때 가장 많이 쓰이는게 Volatility가 아닐까 생각됩니다.
그리고 현재 가장 많이 쓰이는 윈도우 서버는 Windows 2003 Server일 것이구요..
얼마전까지 Volatility에서 Windows 2003 메모리 덤프는 분석이 안된다...상용으로 구매해야 분석이 된다...라고 알고 있었습니다. (아직도 공부해야 할게 많다는 결론이...)

Volatility를 이용해서 덤프된 메모리를 분석하기 위해 명령 실행시 아래와 같은 메시지를 접하게 되었습니다.

root@LUCKYSTRIKE:/mem_dump# python /data/forensics/volatility_2.1_alpha/vol.py pslist -f memdump.mem 
Volatile Systems Volatility Framework 2.1_alpha
No suitable address space mapping found
Tried to open image as:
 WindowsHiberFileSpace32: No base Address Space
 WindowsCrashDumpSpace32: No base Address Space
 AMD64PagedMemory: No base Address Space
 JKIA32PagedMemory: No base Address Space
 IA32PagedMemoryPae: Module disabled
 JKIA32PagedMemoryPae: No base Address Space
 IA32PagedMemory: Module disabled
 WindowsHiberFileSpace32: No xpress signature found
 WindowsCrashDumpSpace32: Header signature invalid
 AMD64PagedMemory: Incompatible profile WinXPSP2x86 selected
 JKIA32PagedMemory: No valid DTB found
 IA32PagedMemoryPae: Module disabled
 JKIA32PagedMemoryPae: No valid DTB found
 IA32PagedMemory: Module disabled
 FileAddressSpace: Must be first Address Space


저와 같은 경험이 있으신 분들이 계실거라 생각됩니다. 덤프된 이미지를 제대로 인식하지 못해서 발생되는 현상입니다. 이런 경우 다음 절차를 통해 분석을 진행하실 수 있습니다.

먼저, Volatility의 imageinfo 플러그인으로 이미지 파일을 확인합니다.

root@LUCKYSTRIKE:/mem_dump# python /data/forensics/volatility_2.1_alpha/vol.py imageinfo -f memdump.mem 
Volatile Systems Volatility Framework 2.1_alpha
Determining profile based on KDBG search...

          Suggested Profile(s) : Win2003SP0x86, Win2003SP1x86, Win2003SP2x86
                     AS Layer1 : JKIA32PagedMemoryPae (Kernel AS)
                     AS Layer2 : FileAddressSpace (/mem_dump/memdump.mem)
                      PAE type : PAE
                           DTB : 0x3ad000
                          KDBG : 0x808943e0L
                          KPCR : 0xffdff000L
             KUSER_SHARED_DATA : 0xffdf0000L
           Image date and time : 2012-04-30 02:22:27 UTC+0000
     Image local date and time : 2012-04-30 11:22:27 +0900
          Number of Processors : 4
                    Image Type : Service Pack 2


Windows2003 SP2 x86버전의 메모리라고 이야기해줍니다.

--profile 옵션을 통해 다시 분석을 진행합니다.

root@LUCKYSTRIKE:/mem_dump# python /data/forensics/volatility_2.1_alpha/vol.py -f memdump.mem --profile=Win2003SP2x86 pslist
Volatile Systems Volatility Framework 2.1_alpha
 Offset(V)  Name                 PID    PPID   Thds   Hnds   Time 
---------- -------------------- ------ ------ ------ ------ ------------------- 
0x89f889b0 System                    4      0     83   3244 1970-01-01 00:00:00       
0x89bfa100 smss.exe                300      4      3     19 2012-04-30 02:06:46       
0x89bd3d88 csrss.exe               348    300     14    728 2012-04-30 02:06:48       
0x89cb2bc8 winlogon.exe            376    300     20    489 2012-04-30 02:06:49       
0x89c53450 services.exe            424    376     17    454 2012-04-30 02:06:50       
0x89b865a8 lsass.exe               436    376     30    583 2012-04-30 02:06:51       
0x89c52868 svchost.exe             588    424      6    101 2012-04-30 02:06:53       
0x88a5d660 svchost.exe             672    424     11    264 2012-04-30 02:06:54       
0x88a3fa20 svchost.exe             744    424      9    150 2012-04-30 02:06:54       
0x88a37020 svchost.exe             760    424     12    147 2012-04-30 02:06:54       
0x88a32978 svchost.exe             796    424     63   1078 2012-04-30 02:06:54       
0x88a22458 spoolsv.exe             912    424     12    135 2012-04-30 02:06:55       
0x88a118a8 msdtc.exe               936    424     15    183 2012-04-30 02:06:55       
0x889fd6a0 acaas.exe              1076    424     29    467 2012-04-30 02:06:56       
0x889f9418 v3clnsrv.exe           1088    424      3     70 2012-04-30 02:06:56       
0x889ed500 acaegmgr.exe           1116    424      2     41 2012-04-30 02:06:57       
0x889d3568 acais.exe              1136    424      9     94 2012-04-30 02:06:57       
0x889d1d48 AhnSDsv.exe            1152    424      2     46 2012-04-30 02:06:57       
0x889e9bc8 AYServiceNT.aye        1172    424     10    168 2012-04-30 02:06:57       
0x889d7608 DuzonFileServer        1212    424      4    278 2012-04-30 02:07:02       
0x8899c3c8 DuzonMessenger.        1296    424      2   1083 2012-04-30 02:07:05       
0x888e6020 svchost.exe            1320    424      2     79 2012-04-30 02:07:05       
0x888e1500 inetinfo.exe           1396    424      8    176 2012-04-30 02:07:06       
0x888bf360 msftesql.exe           1456    424      6    412 2012-04-30 02:07:07       
0x888b7708 sqlservr.exe           1492    424     47    570 2012-04-30 02:07:07       
0x886c9020 msmdsrv.exe            1516    424     19    642 2012-04-30 02:07:07       
0x886bd330 NeoBizMail_POP.        1560    424     11    208 2012-04-30 02:07:08       
0x883f8d88 NeoBizMail_SMTP        1660    424     12    315 2012-04-30 02:07:08       
0x883ced88 NeoBiz_Admin.ex        1700    424      6    127 2012-04-30 02:07:09       
0x88388d88 svchost.exe            1840    424      2     52 2012-04-30 02:07:10       
0x886b57a0 ReportingServic        1856    424     25    531 2012-04-30 02:07:10       
0x88349020 sqlwriter.exe          1996    424      3     93 2012-04-30 02:07:12       
0x88335770 wmiapsrv.exe           2140    424      6    182 2012-04-30 02:07:13       
0x882c2020 svchost.exe            2316    424     15    167 2012-04-30 02:07:17       
0x8820ed88 SQLAGENT90.EXE         2504    424     13    420 2012-04-30 02:07:22       
0x88208b90 wmiprvse.exe           2548    588      5    177 2012-04-30 02:07:24       
0x882b55e8 svchost.exe            2772    424     20    172 2012-04-30 02:07:36       
0x8814a020 alg.exe                2960    424      5     94 2012-04-30 02:07:38       
0x8812f020 explorer.exe           3116   3084     11    456 2012-04-30 02:07:40       
0x888b3b18 ClamTray.exe           3476   3116      4     94 2012-04-30 02:07:54       
0x88397d88 acasp.exe              3512   3116      9    225 2012-04-30 02:07:55       
0x88385b80 AhnSD.exe              3536   3116      1     58 2012-04-30 02:07:55       
0x88372790 ctfmon.exe             3568   3116      1     92 2012-04-30 02:07:56       
0x882ae9d8 AYAgent.aye            3660   3532     10    184 2012-04-30 02:08:02       
0x889dd020 svchost.exe            3956    424     17    238 2012-04-30 02:12:02       
0x889ec2a0 afmain.exe             2740   3512      2    174 2012-04-30 02:13:37       
0x880eeb60 wmiprvse.exe           1100    588      8    145 2012-04-30 02:19:24       
0x89dd2020 conime.exe             3500   3324      2     61 2012-04-30 02:20:52       
0x880ee658 FTK Imager.exe         3784   3116      9    335 2012-04-30 02:21:43 


프로파일을 지정하니 프로세스 목록이 제대로 보입니다.

네트워크 커넥션도 확인해봤습니다.

root@LUCKYSTRIKE:/mem_dump# python /data/forensics/volatility_2.1_alpha/vol.py -f memdump.mem --profile=Win2003SP2x86 connscan
Volatile Systems Volatility Framework 2.1_alpha
 Offset(P)  Local Address             Remote Address            Pid   
---------- ------------------------- ------------------------- ------ 
0x08136c68 127.0.0.1:1433            127.0.0.1:1056              1492
0x08136e38 127.0.0.1:1056            127.0.0.1:1433              1660
0x0815fa10 127.0.0.1:1057            127.0.0.1:1433              1660
0x08262e38 127.0.0.1:1433            127.0.0.1:1053              1492
0x0826d360 127.0.0.1:1050            127.0.0.1:1433              1856
0x08273ab8 127.0.0.1:1046            127.0.0.1:1433              1856
0x08273cc8 127.0.0.1:1433            127.0.0.1:1051              1492
0x08277e38 127.0.0.1:1047            127.0.0.1:1433              1560
0x08279008 127.0.0.1:1044            127.0.0.1:1433              1560
0x0827b680 127.0.0.1:1043            127.0.0.1:1433              1856
0x082d3a78 127.0.0.1:1053            127.0.0.1:1433              1560
0x08301440 127.0.0.1:1036            127.0.0.1:1433              1560
0x0830c818 127.0.0.1:1042            127.0.0.1:1433              1660
0x0832b270 127.0.0.1:1048            127.0.0.1:1433              1660
0x0832b648 127.0.0.1:1045            127.0.0.1:1433              1660
0x08356da0 127.0.0.1:1039            127.0.0.1:1433              1660
0x08370c30 127.0.0.1:1035            127.0.0.1:1433              1660
0x08395e38 127.0.0.1:1433            127.0.0.1:1055              1492
0x0839f900 127.0.0.1:1055            127.0.0.1:1433              1660
0x088e27b8 127.0.0.1:1433            127.0.0.1:1057              1492
0x089cd380 0.0.0.0:1061              211.233.80.46:80             808
0x09ccd5c8 0.0.0.0:0                 0.0.0.0:0                      0


Windows 2003 서버의 모메리 분석 전에 imageinfo 플러그인으로 꼭 확인하셔야하며 이미지 정보 확인 후 Volatility 명령 실행시에도 --profile 옵션을 주셔서 명령을 실행하셔야 합니다. 모든 플러그인을 확인해보진 않았지만 일부 플러그인은 --profile 옵션을 주지 않아도 실행이 되지만 일부 플러그인은 실행이 되지 않았습니다.

간단하게 프로세스 관련 플러그인과 네트워크 관련 플러그인 확인해보니 네트워크 관련 플러그인(sockscan, connections, connscan 등)은 --profile 옵션 없이 명령이 잘 실행되었지만 프로세스 관련 플러그인(pslist, pstree 등)은 --profile 옵션 없이 명령이 실행되지 않았습니다.

대부분 스크립트 작성해서 하실테니 --profile 옵션을 사용하시는게 그리 불편하진 않으실겁니다.
스크립트 작성시에는 아래 SANS의 Memory Forensics Cheat Sheet을 활용하시면 되겠습니다.


물론 -h 옵션을 통해 확인되는 플러그인들을 하나씩 모두 테스트해보셔서 분석시 자신이 필요한 플러그인을 찾아내시는 것도 좋은 방법이라 생각됩니다.



thanks to n0fate ;-)