dwarf to json (dwarf2json)
DFIR/Memory Forensics

dwarf to json (dwarf2json)

Dwarf to Json을 사용하는 이유

 

메모리 포렌식을 하려면 volatility를 써야합니다.

파이썬2가 개발이 중단되고 볼라틸리티도 파이썬2를 사용하는 구버전에서 파이썬3을 사용하는 볼라틸리티3으로 개발이 진행되고 있습니다.

볼라틸리티3과 2의 큰 차이점 중 하나는 윈도우즈 덤프 파일을 분석할 때 프로필을 지정해주지 않아도 된다는 점입니다.

하지만 리눅스나 맥의 경우 여전히 프로필을 생성하고 경로에 집어넣어줘야 합니다.

이 프로필 파일의 방식 또한 볼라틸리티3 버전에서 달라진 점이 있는데 다음과 같습니다.

 

기존의 프로필 파일 형태1

 

기존의 프로필 파일 형태2

 

기존에는 위와 같이 boot 폴더와 module.dwarf 파일이 존재하며 boot 폴더에는 System.map 파일이 있는 형태입니다.

 

볼라틸리티3 버전에서는 프로필 파일을 json 형태로 변환해서 volatility3\volatility\symbols\{OS} 경로에 넣어줘야 합니다. (기존 경로 : volatility\plugins\overlays\{OS})

이번 포스팅에서는 프로필 파일을 json 형태로 변환하는 방법에 대해서 살펴보도록 하겠습니다.

 


1. dwarf2json 소스코드 다운로드

 

https://github.com/volatilityfoundation/dwarf2json

 

GitHub - volatilityfoundation/dwarf2json: convert ELF/DWARF symbol and type information into vol3's intermediate JSON

convert ELF/DWARF symbol and type information into vol3's intermediate JSON - GitHub - volatilityfoundation/dwarf2json: convert ELF/DWARF symbol and type information into vol3's intermediat...

github.com

위 링크에서 dwarf2json 소스 코드 모음을 다운로드합니다.

 

2. go 설치

 

https://golang.org/dl/

 

Downloads - The Go Programming Language

Downloads After downloading a binary release suitable for your system, please follow the installation instructions. If you are building from source, follow the source installation instructions. See the release history for more information about Go releases

golang.org

dwarf2json을 사용하기 위해선 go 언어가 필요합니다. 따라서 위 링크에서 go를 다운로드 해줍니다.

 

운영체제에 맞는 파일 다운로드

 

파일을 다운로드 했으면 설치를 해줍니다.

 

3. dwarf2json 셋팅

 

go build

 

그리고 다운로드 받은 dwarf.go 파일이 있는 경로에 가서 go build 명령어를 통해 빌드합니다.

 

dwarf2json --help

 

dwarf2json.exe --help 를 입력했을 때 위와 같이 나오면 설치가 제대로 된 것입니다.

 

json 파일 변환

 

--system-map 옵션을 사용해서 system.map 파일을 json 파일로 변환할 수 있습니다.

system.map 파일은 기존 방식의 프로필 파일에 있는 boot 폴더에서 얻을 수 있습니다.

.\dwarf2json.exe linux --system-map {Profile File} > output.json

.\dwarf2json.exe linux --elf {Profile File} > output.json

혹은 위와 같이 --elf 옵션을 줄 수 있습니다.

 

생성된 json 파일

 

위와 같이 json 파일이 생성되었습니다.

 


 

https://github.com/volatilityfoundation/dwarf2json

 

GitHub - volatilityfoundation/dwarf2json: convert ELF/DWARF symbol and type information into vol3's intermediate JSON

convert ELF/DWARF symbol and type information into vol3's intermediate JSON - GitHub - volatilityfoundation/dwarf2json: convert ELF/DWARF symbol and type information into vol3's intermediat...

github.com

https://volatility3.readthedocs.io/en/latest/symbol-tables.html

 

Creating New Symbol Tables — Volatility 3 1.1.1 documentation

This page details how symbol tables are located and used by Volatility, and documents the tools and methods that can be used to make new symbol tables. How Volatility finds symbol tables All files are stored as JSON data, they can be in pure JSON files as

volatility3.readthedocs.io

 

위 자료를 참고했습니다.