Transcript
Page 1: Memory forensics with volatility

Memory Forensics with Volatility

ASEC(AhnLab Security Emergence response Center)

분석팀

Senior Advanced Threat Researcher

CISSP, CHFI

장영준선임연구원

Page 2: Memory forensics with volatility

Contents

01

02

03

04

05

06

07

08

Memory Forensics

Windows Memory

Windows Memory Dump and Analysis

What is Volatility

Installing Volatility on Windows and BackTrack

Memory analysis using Volatility

Case Study and Hands-on Lab

Conclusion

Page 3: Memory forensics with volatility

01

Memory Forensics

Page 4: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Memory Forensic의필요성

Memory Forensic은여러프로그램들을이용해 Memory를분석하는일련의과정

Computer는구조적으로 CPU에서연산을처리하기위해필수적으로 Memory에 Data를적재하여야만가능

이과정에서 Computer에존재하는여러 Data들중 Memory에만존재하는특유의정보추출및확인가능

Memory Forensic을위한 Memory 분석프로그램들은기본적으로 Memory에서 다음정보들을추출

1) Process와 Threads – 실행중이거나종료되었지만 Memory에 남아있는정보들추출

2) Modules와 libraries – 실행중이거나종료되었던 Process 관련 Modules와 libraries 정보들추출

3) Open Files와 sockets – 실행중이거나종료되었던파일들과 Network 연결관련 Socket 정보들추출

4) Various Data Structures – Memory에만 존재하는다양한 Data의구조정보들추출

침해사고분석과정에서 Memory Forensic은악성코드의감염및실행과관련된여러주요 Data 확인가능

침해사고분석과정에서 Memory Forensic은침해사고발생당시의다양한정보들을확인가능

Page 5: Memory forensics with volatility

02

Windows Memory

Page 6: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

32Bit Windows의Virtual Memory 구조

32Bit Windows 운영체제에서는 실행되는모든 Process는 4GB의 Virtual Memory를할당받음

4GB의 Virtual Memory는 2GB의 User Mode와 2GB의 Kernel Mode로구분

0x00000000 ~ 0x0000FFFF

64KB 보호영역

0x00010000 ~ 0x7FFEFFFF

User Mode

2 GB

0x7FFF0000 ~ 0x7FFFFFFF

64KB 보호영역

0x80000000 ~ 0xFFFFFFFF

Kernel Mode

2 GB

Process A

Page 7: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Virtual Memory와Physical Memory 구조

모든 Process는 Virtual Address 영역을가지고있음

Physical Memory의크기로인해 Virtual Memory의내용을 Disk로이동하는과정인 Paging 발생

0x00000000 ~ 0x0000FFFF

64KB 보호영역

A

B

0x00010000 ~ 0x7FFEFFFF

User Mode

2 GB

C

D

0x7FFF0000 ~ 0x7FFFFFFF

64KB 보호영역

0x80000000 ~ 0xFFFFFFFF

Kernel Mode

2 GB

Process A

A

B

C

Physical Memory

Page File

Memory Dump 생성영역으로Memory Forensic 대상

Page 8: Memory forensics with volatility

03

Windows Memory Dump and Analysis

Page 9: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

win(32/64)dd.exe를이용한Memory Dump 생성

Win(32/64)dd.exe는 Memory Dump를위해 2007년 Mattthieu Siuche가개발하여공개, 32/64 Bit 버전이별도존재

2008년 Moonsols (http://www.moonsols.com)에서 MoonSols Windows Memory Toolkit (http://www.moonsols.com/resources/) 로배포

Page 10: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

DumpIt.exe를이용한Memory Dump 생성

DumpIt.exe는 2007년 Mattthieu Siuche가개발한 Win(32/64)dd.exe를응용하여제작, 32/64 Bit 버전구분없이실행가능

2010년 Moonsols (http://www.moonsols.com)에서 MoonSols DumpIt (http://www.moonsols.com/resources/) 로배포

특정인자값입력없이 dumpit.exe 실행만으로동일경로에 Memory Dump 생성가능

Page 11: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

FTK Imager Lite를이용한Memory Dump 생성

FTK Imager Lite는 AccessData (http://www.accessdata.com/) 라는 Digital Forensic 전문업체에서개발한상용제품인 FTK(Forensic

Toolkit)의무료버전 (http://www.accessdata.com/support/product-downloads)

상용버전에비해기능적인한계는존재하나 Capture Memory, Create Disk Image와 Image Mounting 같은기본적인기능은자유롭게사용가능

AccessData에서는현재 3.1.1.8 버전을무료로제공중이며, 파일들은약 75MB 크기로 USB에복사후침해사고발생시스템에연결후바로사용가능

Page 12: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility를이용한Memory Dump 분석

Volatility는 Python으로제작되어 Memory Forensic을위한 Memory 분석시많이사용되는프로그램중하나

현재 Volatility는 Volatile Systems (https://www.volatilesystems.com/) 에의해 Volatility Framework를 Open Source

(https://code.google.com/p/volatility/)로 공개

공개용으로배포됨으로다양한 Plugin들이개발되고 Pentest를위한 BackTrack 및 Kali Linux 배포버전에도포함됨

Page 13: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Mandiant Redline 이용Memory Dump 분석 (1)

침해사고대응전문업체인 Mandiant에서개발해무료로배포하는 Redline (https://www.mandiant.com/resources/download/redline)

Windows GUI 기반 Memory 분석프로그램으로사용이비교적쉬우며, 빠르게분석진행가능

Memory Dump 생성과분석을동시에진행할수있으나, 설치및실행을위해 .NET Framework 4.0 (http://www.microsoft.com/ko-

kr/download/details.aspx?id=24872 )필요

Page 14: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Mandiant Redline 이용Memory Dump 분석 (2)

MRI(Mandiant for Intelligent Response) 기능으로의심스러운항목은붉은색으로자동표기

TimeLine 기능으로 Memory에존재하는정보들을시간순서로정렬하여나타냄

Page 15: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

VMWare를이용한Memory Dump 생성과분석 (1)

2008년 Brett Shavers가가상화기술을이용한 Computer Forensic 분석기법을공개

“Virtual Forensics : A Discussion of Virtual Machines Related to Forensics Analysis”

(http://www.forensicfocus.com/downloads/virtual-machines-forensics-analysis.pdf)

VMWare는다음의주요확장자파일들로구성

1) .Log – Virtual Machine에대한일반적인활동기록파일

2) .VMDK –Guest OS에대한실질적인 Virtual Hard Drive

3) .VMEM –Guest OS에대한실질적인 Virtual Paging File

4) .VMSN – VMWare에서생성하는 Snapshot 파일로, Guest OS에대한상태를저장

5) .VMSD – VMWare에서생성한 Snapshot 파일에대한 Metadata 기록파일

6) .NVRAM – Guest OS에대한 BIOS 정보기록파일

7) .VMX – Guest OS에대한설정기록파일

8) .VMSS – Guest OS를 Suspend 상태로변경할경우, 당시의 Guest OS 상태를저장한파일

VMWare의 Guest OS 상태로운영중인시스템의 Memory Forensic 분석대상은 .VMEM 확장자파일

Page 16: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

VMWare를이용한Memory Dump 생성과분석 (2)

Guest OS의 Memory Forensic 분석을위해운영중인 Guest OS를 Suspend 상태로변경

Guest OS의 Suspend 상태로변경후 Virtual Paging File 인 .VMEM 파일을대상으로 Memory Forensic 분석수행

Page 17: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

VMWare를이용한Memory Dump 생성과분석 (3)

2009년 Carnegie Mellon 대학에서 LiveView (http://liveview.sourceforge.net/) 를이용해 Disk Image 파일을 VMWare Guest OS 변환

LiveView를 이용해 Disk Image 파일을 VMware Guest OS로변경후 Memory Forensic을포함한 Live Response 수행

LiveView의 정상적인실행을위해서는추가적인프로그램설치필요

1) VMware Workstation 5.5 버전이상 (http://www.vmware.com/products/workstation/workstation-evaluation)

2) Virtual Disk Development Kit 5.5 (http://www.vmware.com/support/developer/vddk/)

3) Java Runtime Environment (http://www.java.com/getjava/)

Page 18: Memory forensics with volatility

04

What is Volatility

Page 19: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility Project History

2006년AAron Walters의메모리분석관련 FATKit Project에서출발해 Volatools Project로발전

“FATKit: A Framework for the Extraction and Analysis of Digital Forensic Data from Volatile System Memory”

(http://www.4tphi.net/fatkit/papers/dfrwswip.pdf)

Volatools: Integrating Volatile Memory Forensics into the Digital Investigation Process

(http://www.blackhat.com/presentations/bh-dc-07/Walters/Paper/bh-dc-07-Walters-WP.pdf)

2007년AAron Walters 가주도하는개발팀인 Volatile Systems (https://www.volatilesystems.com/) 에의해 Volatility Framework를Open Source (https://code.google.com/p/volatility/)로 공개

2008년 Open Memory Forensics Workshop (https://www.volatilesystems.com/default/omfw)에서 AAron Walters가 Volatility 1.3 버전발표 (https://www.volatilesystems.com/volatility/omfw/Walters_OMFW_2008.pdf)

현재 Volatile Systems에서는 Volatility Framework 개발과함께 Plugins 사용및제작에대한전문적인강의진행

<Source : Volatility Google code, Volatile Systems>

Page 20: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility Framework & Plugins (1)

Volatility Framework 버전 2.2 (https://code.google.com/p/volatility/wiki/Release22) 를기준으로다음버전의운영체제에서생성된Memory Dump 분석지원

1) Windows (x86)

Windows XP Service Pack 2 and 3

Windows 2003 Server Service Pack 0, 1, 2

Windows Vista Service Pack 0, 1, 2

Windows 2008 Server Service Pack 1, 2

Windows 7 Service Pack 0, 1

2) Windows (x64)

Windows XP Service Pack 1 and 2

Windows 2003 Server Service Pack 1 and 2

Windows Vista Service Pack 0, 1, 2

Windows 2008 Server Service Pack 1 and 2

Windows 2008 R2 Server Service Pack 0 and 1

Windows 7 Service Pack 0 and 1

3) Linux

32-bit Linux kernels 2.6.11 to 3.5

64-bit Linux kernels 2.6.11 to 3.5

Note : Volatility Framework 버전 2.3 Beta (https://code.google.com/p/volatility/wiki/Release23) 은다음운영체제추가지원

OpenSuSE, Ubuntu, Debian, CentOS, Fedora, Mandriva 등

32-bit 10.5.x, 10.6.x Snow Leopard, 10.7.x Lion

64-bit 10.6.x Snow Leopard, 10.7.x Lion, 10.8.x Mountain Lion

Page 21: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility Framework & Plugins (2)

Volatility Framework 버전 2.2를기준으로 CommandReferance22 (https://code.google.com/p/volatility/wiki/CommandReference22) 에서 5

가지영역으로구분

1) Windows Core

Image Identification - imageinfo, kdbgscan, kpcrscan

Processes and DLLs - pslist,pstree, psscan, psdispscan, dlllist, dlldump, handles, getsids, cmdscan, consoles, envars, verinfo,

enumfunc

Process Memory - memmap, memdump, procmemdump, procexedump, vadinfo, vadwalk, vadtree, vaddump, evtlogs

Kernel Memory and Objects - modules, modscan, moddump, ssdt, driverscan, filescan, mutantscan, symlinkscan, thrdscan

Networking - connections, connscan, sockets, sockscan, netscan

Registry - hivescan, hivelist, printkey, hivedump, hashdump, lsadump, userassist, shellbags, shimcache, getservicesids

Crash Dumps, Hibernation, and Conversion – crashinfo, hibinfo, imagecopy, raw2dmp

Miscellaneous – strings, volshell, bioskbd, patcher, pagecheck

2) Windows GUI

sessions, wndscan, deskscan, atomscan, atoms, clipboard, eventhooks, gahti, messagehooks, screenshot, userhandles,

gditimers, windows, wintree

3) Windows Malware

malfind, yarascan, svcscan, ldrmodules, impscan, apihooks, idt, gdt, threads, callbacks, driverirp, devicetree, psxview

timers

Note : 본문서에서는 4번째인 Windows Registry와 5번째인 Linux에대해서는다루지않음

Page 22: Memory forensics with volatility

05

Installing Volatility on Windows and

BackTrack

Page 23: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility 실행을위한Windows 환경

Windows 환경에서 Volatility를실행하기위해 2가지버전의 Volatility를 지원

1) volatility-2.2.standalone.exe - Volatility 2.2 Standalone Windows Program

(https://volatility.googlecode.com/files/volatility-2.2.standalone.exe)

별도프로그램추가설치없이바로사용가능

2) volatility-2.2.win32.exe - Volatility 2.2 Windows Module Installer

(https://volatility.googlecode.com/files/volatility-2.2.win32.exe)

Volatility Framework와 Plugin 들을사용하기위해 python-2.6 또는 python-2.7 추가설치필요

NOTE : Windows 환경은보안패치로인해 Volatility 결과오류가발생할수있음으로 Windows 환경에서분석을권장하지않음

Page 24: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility 실행을위한 Linux 환경 (1)

Linux Ubuntu Kernel로제작된 BackTrack과 SIFT에서 Volatility를지원

1) BackTrack (http://www.backtrack-linux.org/)

Penetration Testing과 Forensic을위한목적으로제작한 Ubuntu Kernel 기반운영체제

최신버전인 5R3 (http://www.backtrack-linux.org/downloads/ )에는 Volatility 2.2 포함

2) SIFT(SANS Investigate Forensic Toolkit)

SANS Institute에서 Forensic을위한목적으로제작한 Ubuntu Kernel 기반운영체제

최신버전인 2.14 (http://computer-forensics.sans.org/community/downloads)에는 Volatility 2.0 포함

Page 25: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility 실행을위한 Linux 환경 (2)

Linux 환경에서 Volatility 의모든 Plugins을사용하기위해서는추가적인프로그램설치가필요

1) SVN and Basic Dependencies

# apt-get install subversion pcregrep libpcre++-dev python-dev -y

2) Distorm3 (https://code.google.com/p/distorm/) - Disassembler Library For x86/AMD64

# wget https://distorm.googlecode.com/files/distorm3.zip

# unzip distorm3.zip

# cd distorm3

# python setup.py build

# python setup.py build install

3) Yara (https://code.google.com/p/yara-project/) - A malware identification and classification tool

# wget https://yara-project.googlecode.com/files/yara-1.7.tar.gz

# tar -xvzf yara-1.7.tar.gz

# cd yara-1.7

# ./configure

# make

# make install

NOTE : 모든 code는 BackTrack 5R3에서테스트되었음

Page 26: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility 실행을위한 Linux 환경 (3)

4) Yara-Python (https://code.google.com/p/yara-project/)

# wget https://yara-project.googlecode.com/files/yara-python-1.7.tar.gz

# tar -xvzf yara-python-1.7.tar.gz

# cd yara-python-1.7

# python setup.py build

# python setup.py build install

5) GMP (http://gmplib.org/)

# apt-get install libgmp3-dev

6) PyCrypto (https://www.dlitz.net/software/pycrypto/) - The Python Cryptography Toolkit

# wget http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.3.tar.gz

# tar -xzvf pycrypto-2.3.tar.gz

# cd pycrypto-2.3

# python setup.py build

# python setup.py build install

NOTE : Ubuntu Kernel을사용하는 BackTrack에서는다음명령을추가실행하여야함

# echo “/usr/local/lib” >> /etc/ld.so.conf

# ldconfig

NOTE : 모든 code는 BackTrack 5R3에서테스트되었음

Page 27: Memory forensics with volatility

06

Memory analysis using Volatility

Page 28: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility를이용한Memory 분석방법론 (1)

확보한 Memory Dump는 Volatility를 이용하여다음과같은 6단계의절차로 Memory 분석을진행

운영체제

분석

Process

분석

Network

분석

DLL 및Thread

분석

String

분석

Registry

분석

Page 29: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility를이용한Memory 분석방법론 (2)

1) 운영체제정보

어떠한운영체제에서생성한 Memory Dump인지분석

imageinfo - 생성한 Memory Dump의운영체제, Service Pack과 Hardware 정보들을나열

2) Process 분석

생성한 Memory Dump에서실행중이거나은폐된 Process 및그와관련된정보들을분석

pslist - 실행중인 Process 정보들을나열

psscan - 실행중인 Process 정보들과함께이미종료된 Process 정보도나열

psxview - pslist와 psscan에서확인한 Process 정보들을비교하여나열함으로, 은폐되어있는 Process 정보획득

pstree - pslist와유사한정보를보여주나 Parent와 Child Process 간의상관관계를나열

procexedump – Process의 Memory 영역에서 Slack space를포함하지않고 Binary 형태로추출

volshell – Memory Dump를 windbg와유사한형식으로분석

3) Network 정보

생성한 Memory Dump에서활성화되거나은폐된 Network 및그와관련된정보들을분석

connections - 활성화상태의 Network 연결정보나열, Windows XP, Windows 2003 Server만사용가능

connscan - 활성화상태의 Network 연결정보와함께이미종료된연결정보도나열

Windows XP, Windows 2003 Server만 사용가능

netscan – 활성화상태의 Network 연결정보를보여주나, Windows Vista와 7 그리고 Windows 2008 Server에서만 사용가능

Page 30: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Volatility를이용한Memory 분석방법론 (3)

4) DLL 및 Thread 분석

특정 Process에서 load 한 DLL 정보나 Thread 정보들을분석

dlllist - 특정 Process에서 load한 DLL들의정보를분석

ldrmodules - 특정 Process나 DLL에의해은폐되어진 DLL 정보를분석

dlldump - 특정 Process에서 load한 DLL을 Binary 형태로추출

Malfind - User mode 형태로은폐되어있거나 injection 되어있는코드또는 DLL 정보들을분석

apihooks – User 및 Kernel Mode에서API Hooking 정보를분석

5) String 분석

생성한 Memory Dump 전체또는 Binary 형태로추출한 Process 및 DLL Memory dump에서특정 string 분석

yarascan - YARA를이용하여, User 및 Kernel Mode memory에포함된 Byte 순서, ANSI 및 Unicode 문자검색

6) Registry 분석

생성한 Memory Dump 전체에서 Windows Registry 관련정보들을분석

printkey - 특정 Registry Key에포함되어있는 Subkeys, Values와 Data를검색하여나열

userassist - Memory Dump에서 UserAssist 관련 Registry Key 정보를추출

NOTE : UserAssist Key는 Windows에서실행되었던프로그램의목록, 실행횟수와마지막실행시간등의정보를보관

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist

Page 31: Memory forensics with volatility

07

Case Study and Hands-on Lab

Page 32: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Case Study Summary

1) Backdoor/Win32.Rbot.R327

(a.k.a Win32/IRCBot.worm.variant, W32.IRCBot, Backdoor.Win32.Rbot.aftu)

기존에많이발견되는 IRCBot 변형의형태

IRC Chanel이개설된 C&C Server와통신으로 Operator의명령에따라감염된 system에서 다양한악의적인기능수행

2) Trojan/Win32.Oficla

(a.k.a Win-Trojan/Oficla.82432.C, Trojan.Sasfis, Trojan.Win32.Oficla.bv)

Bredolab 변형중하나로 Zeus와 SpyEye의 Source Code에서파생되어제작되어진형태

정상 Windows system process인 svchost.exe의 memory 영역에 Code Injection 수행

외부 C&C Server와통신이후 Operator의명령에따라 FakeAV 나다른악성코드다운로드후실행

3) Trojan/Win32.Buzus.C8082

(a.k.a Win32/Prolaco.worm.607232, W32.Ackantta.B@mm, Trojan.Win32.Buzus.dbfm)

Prolaco worm 변형으로 Social Engineering 기법을이용한 E-mail로유포되는 Mass-mailer 형태

감염된 system에서 User Mode 은폐기법으로자신의 process를숨긴후외부로 worm이첨부된다량의 E-mail 발송

4) Backdoor/Win32.Blakken

(a.k.a Backdoor.Win32.Blakken.bx, Trojan.AVKiller.AS)

외부공격자의명령에따라원격제어등의다양한악의적인기능을수행하는 Backdoor 형태의악성코드

감염된 system에서 정상 Windows system process인 svchost.exe의 Handle을 Open 한후자신의 code 전체를 Injection

User Mode 은폐기법으로자신의 process를은폐

Page 33: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (1)

Backdoor/Win32.Rbot.R327 감염된 system에서 Memory Dump 작업으로생성한 rbot_infected_mem.raw 파일준비

Volatility를이용해 imageinfo 명령으로준비한 rbot_infected_mem.raw의분석진행

감염된 system의 운영체제정보와 Memory Dump를수행한시간정보획득

Page 34: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (2)

psscan 명령과 pslist 명령이조합된 psxview 명령으로감염된 system에서 은폐기능으로동작하는 process 확인

Page 35: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (3)

process의생성시간과종료시간정보를획득할수있는 psscan 명령으로 process 관련정보들추가획득

Page 36: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (4)

실행중인 process들의상관관계정보를획득하기위해 pstree 명령으로추가정보획득

Page 37: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (5)

Network 관련정보획득을위해 Memory Dump 생성당시활성화되어있는 network 정보를보여주는 connections 명령실행

Page 38: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (6)

감염된 system에서 network 관련추가정보를획득하기위해 connscan 명령실행

Page 39: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (7)

악성코드로의심되는 process의 memory 영역을파일형태로추출해내기위한 procexedump 명령실행

Memory Dump에서특정 process의 memory 영역을파일형태로추출할경우파일명은 executable.[PID].exe로고정

추출한특정 process의 memory 영역을추출한파일을대상으로 Backtrack에포함된 strings 명령실행

해당 strings 명령은 Binary에포함되어있는문자열들을추출하여사용자가읽을수있도록지원

Page 40: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (8)

Backtrack에포함된 strings 명령으로 Binary 내부문자열을추출한 text 파일생성

특정 process의 memory 영역으로생성한 Binary 내부문자열에서 IRCBot으로의심되는문자열다수존재

내부문자열중에서 Windows Registry와 관련된문자열다수존재

Page 41: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (9)

IRCBot으로의심되는문자열들중 “IRC”를 의심스러운 process의 memory 영역에서 yara를이용해검색

Yara 검색을위해 yarascan 명령과함께 –yara-rules=“IRC” 사용

Page 42: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Rbot.R327 (10)

Memory Dump에서 Windows Registry 검색을위해 printkey 명령과함께인자값으로추출한문자열사용

“HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run” 영역의 “Windows Update” Key에의심스러운파일이존재

추가적으로 “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices” 에도의심스러운 파일이“Windows Update” 명칭의 Key로존재

Page 43: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Lessons Learned

Backdoor/Win32.Rbot.R327의 process가은폐형태로동작하지않음을쉽게파악할수있음

악성코드가 생성한 process는 process tree 가보여주는 process 사이의상관관계로비교적쉽게파악할수있음

Memory Dump에남아있는활성화상태의 network 정보로인해 C&C Server의 IP 주소확인가능

악성코드가생성한 process memory 영역을파일형태로추출은가능하나 IAT(Import Address Table) 복구되지않음

전체 memory Dump 또는특정 process memory 영역만을대상으로 Yara를이용해 string 단위검색가능

제한적이지만악성코드에 감염된 windows system의 일부 Registry 영역검색으로악성코드의 auto startup 영역검색가능

Page 44: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (1)

Trojan/Win32.Oficla 감염된 system에서 Memory Dump 작업으로생성한 sasfis_infected_mem.raw 파일준비

Volatility를이용해 imageinfo 명령으로준비한 sasfis_infected_mem.raw의분석진행

감염된 system의 운영체제정보와 Memory Dump를수행한시간정보획득

Page 45: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (2)

psscan 명령과 pslist 명령이조합된 psxview 명령으로감염된 system에서 은폐기능으로동작하는 process 확인

Page 46: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (3)

process의생성시간과종료시간정보를획득할수있는 psscan 명령으로 process 관련정보들추가획득

Page 47: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (4)

실행중인 process들의상관관계정보를획득하기위해 pstree 명령으로추가정보획득

Page 48: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (5)

감염된 system의 network 정보를획득하기이해 connections 명령실행

활성화되어있는 network 정보가존재하지않음

감염된 system에서 network 관련추가정보를획득하기위해 connscan 명령실행

Page 49: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (6)

의심행위를보이는정상 Windows system process인 svchost.exe의 memory 영역에 Code Injection 정보획득을위해 malfind

명령실행

Disassembled Code

Page 50: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (7)

의심스러운행위를보인정상 Windows system process인 svchost.exe의 memory에 Code Injection에대한추가정보획득을위해 volshell 명령실행

실행한 volshell 명령창에서 cc 명령으로 Code Injection이존재하는정상 Windows system process인 svchost.exe의 memory

영역호출

Page 51: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (8)

실행한 volshell 명령창에서 db 명령실행으로 Code Injection 영역이시작되는 0x90000 부터 640 byte 크기만큼호출

Page 52: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (9)

의심스러운행위를보인정상 Windows system process인 svchost.exe의 module 정보를획득하기위해 ldrmodules 명령실행

svchost.exe의 process가 load한 module 중 1.tmp을 dlldump 명령으로 memory dump에서파일형태로추출

Page 53: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (10)

memory dump에서추출한 1.tmp 파일을대상으로 Backtrack에포함된 strings 명령실행

해당 strings 명령은 Binary에포함되어있는문자열들을추출하여사용자가읽을수있도록지원

Backtrack에포함된 strings 명령으로 Binary 내부문자열을추출한 text 파일생성

추출한 1.tmp 파일내부문자열에서특정웹사이트주소관련문자열존재

Page 54: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Oficla (11)

전체 memory dump를대상으로 yara를이용해웹사이트검색

Yara 검색을위해 yarascan 명령과함께 –yara-rules=“babun.bb.php” 사용

Page 55: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Lessons Learned

process가은폐형태로동작하지않음을쉽게파악할수있음

비정상적인 windows system process를 process tree 가보여주는 process 사이의상관관계로비교적쉽게파악할수있음

Memory dump에남아있는감염된 windows system의 network 접속이력으로 C&C Server의 IP 주소확인가능

특정 process memory 영역에악성코드에의한 code injection 구현되어도이를확인가능

Code injection 되어있는영역을 windbg 처럼사용자와상호작용으로추가적인분석가능

특정 process memory 영역에 DLL 형태와같이 injection 되어있는 memory 영역을파일형태로추출가능

전체 memory Dump 또는특정 process memory 영역만을대상으로 Yara를이용해 string 단위검색가능

Page 56: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Buzus.C8082 (1)

Trojan/Win32.Buzus.C8082 감염된 system에서 Memory Dump 작업으로생성한 prolaco_infected_mem.raw 파일준비

Volatility를이용해 imageinfo 명령으로준비한 prolaco_infected_mem.raw의분석진행

감염된 system의 운영체제정보와 Memory Dump를수행한시간정보획득

Page 57: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Buzus.C8082 (2)

psscan 명령과 pslist 명령이조합된 psxview 명령으로감염된 system에서 은폐기능으로동작하는 process 확인

Page 58: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Buzus.C8082 (3)

process의생성시간과종료시간정보를획득할수있는 psscan 명령으로 process 관련추가정보들획득

Page 59: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Trojan/Win32.Buzus.C8082 (4)

감염된 system의 활성화되어있는 network 정보를획득하기이해 connections 명령실행

Page 60: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Lessons Learned

악성코드의 process가은폐형태로동작하는것을쉽게파악할수있음

Memory Dump에남아있는활성화상태의 network 정보로인해악성코드가 SMTP 관련동작을쉽게파악

User Mode로동작하는은폐형태악성코드의 process memory 영역에접근할수없음

악성코드의 process memory 영역에접근할수없음으로, 해당 memory 영역역시파일로추출할수없음

User mode 은폐형태의악성코드의경우에는은폐여부와활성화또는과거의 network 정보들만파악할수있음

Page 61: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Blakken (1)

Backdoor/Win32.Blakken 감염된 system에서 Memory Dump 작업으로생성한 blakken_infected_mem.raw 파일준비

Volatility를이용해 imageinfo 명령으로준비한 blakken_infected_mem.raw의분석진행

감염된 system의 운영체제정보와 Memory Dump를수행한시간정보획득

Page 62: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Backdoor/Win32.Blakken (2)

psscan 명령과 pslist 명령이조합된 psxview 명령으로감염된 system에서 은폐기능으로동작하는 process 확인

Page 63: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Lessons Learned

악성코드에의해 windows system process가은폐형태로동작하는것을쉽게파악할수있음

은폐형태로동작하는 windows system process의 memory 영역에접근할수없음

은폐형태로동작하는 windows system process의 Handle과 Module 영역역시접근할수없음

Handle과 Module 영역에접근할수없음으로관련파일들역시 memory 영역에서추출할수없음

악성코드에의해 Process 은폐외에 network 접속정보를은폐할경우에도이를확인할수없음

Page 64: Memory forensics with volatility

08

Conclusion

Page 65: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Conclusion

장점

Memory에만 존재하는휘발성정보들로부터악성코드감염시스템의다양한정황적정보들을확보할수있음

생성한 Memory Dump를대상으로다양한 Memory 분석툴과기법들을반복적으로적용과검토가능

Volatility와추가 Plug-in 모두 Python으로제작되어, 운영체제제약을받지않는이식성과확장성이뛰어남

Python의다양한기능으로인해 system 적인자동화와부가적인응용성이뛰어남

단점

Memory Forensics 만으로는악성코드감염시스템을완벽하게분석할수없음

악성코드감염시스템의완벽한분석을위해서는 Memory Forensics과다른 Computer Forensics 방법론들이병행되어야함

Volatility를이용해 Memory Dump에존재하는 Windows Registry 정보분석에는한계가존재

Memory Dump로부터 User Mode 또는 Kernel Mode 은폐형태의악성코드탐지는가능하나추가적인분석은어려움

Page 66: Memory forensics with volatility

References

Page 67: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Books (1)

인사이드 윈도우 포렌식 (Windows Forensic Analysis 2/e, 2009년)

할랜 카비 저, 정상민, 정명주 역, 박병익 감수, BJ 퍼블릭, 2010년

제 1장 실시간 대응: 휘발성 데이터 수집

제 2장 실시간 대응: 데이터 분석

제 3장 윈도우 메모리 분석

윈도우 포렌식 실전 가이드

고원봉 저, 한빛 미디어, 2010년

1장 라이브 리스폰스

2장 메모리 분석

악성코드와 멀웨어 포렌식 (Malware Forensics, 2008년)

제임스 아퀼리나, 에이헨 케이시, 카메론 말린 저, 박재호 역, 에이콘, 2012년

01장 멀웨어 사고 대응: 동작 중인 윈도우 시스템에서 휘발성 자료 수집과 검사

03장 메모리 포렌식: 멀웨어 관련 증거물에 대한 물리적 메모리 덤프와 프로세스 메모리 덤프 분석

표적형 공격 보안 가이드, APT 공격, 실전 방어 및 대응 (HYOUTEKIGATA KOUGEKI SECURITY GUIDE, 2013년)

이와이 히로키 저,박선필 역, BJ 퍼블릭, 2013년

6장 초동 대응, 6-1 스냅샷 취득

Page 68: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Books (2)

Mastering Windows Network Forensics and Investigation, Second Edition

Steve Anson, Steve Bunting, Ryan Johnson, Scott Pearson 저, Sybex, 2012년

Chapter 6 Live-Analysis Techniques

Malware Forensics Field Guide for Windows System – Digital Forensics Field Guides

Cameron H. Malin, Eoghan Casey, James M. Aquilina 저, Syngress, 2012년

Chapter 2 Memory Forensics – Analyzing Physical and Process Memory Dumps for Malware Artifacts

SANS Forensic 508 Advanced Computer Forensic Analysis And Incident Response

Rob Lee 저, SANS Institute, 2011년

508.2 Live Response and Complex Evidence Acquisition

Windows Live Response

Page 69: Memory forensics with volatility

© AhnLab, Inc. All rights reserved.

Papers

Virtual Forensics : A Discussion of Virtual Machines Related to Forensics Analysis

http://www.forensicfocus.com/downloads/virtual-machines-forensics-analysis.pdf

FATKit: A Framework for the Extraction and Analysis of Digital Forensic Data from Volatile System Memory

http://www.4tphi.net/fatkit/papers/dfrwswip.pdf

Volatools: Integrating Volatile Memory Forensics into the Digital Investigation Process

http://www.blackhat.com/presentations/bh-dc-07/Walters/Paper/bh-dc-07-Walters-WP.pdf

Open Memory Forensics Workshop (OMFW)

https://www.volatilesystems.com/volatility/omfw/Walters_OMFW_2008.pdf

Windows Memory Dump Analysis Volatility Plugin 을이용한 Windows Memory Dump 분석

http://ls-al.org/wp-content/uploads/2012/07/volatility-plugin-manual11.pdf

Page 70: Memory forensics with volatility

D E S I G N Y O U R S E C U R I T Y


Recommended