
Datalog 기반 디스어셈블러로, ELF/PE 바이너리에서 재조립 가능한 어셈블리를 생성하며, GTIRB 중간 표현을 사용하여 x86, ARM, MIPS 아키텍처에 걸쳐 바이너리 분석 및 재작성을 지원합니다.
DDisasm은 결과 어셈블리 코드를 재조립할 수 있을 만큼 정확한 빠른 디스어셈블러입니다. DDisasm은 datalog(souffle) 선언형 논리 프로그래밍 언어를 사용하여 디스어셈블 규칙과 휴리스틱을 컴파일합니다. 디스어셈블러는 먼저 ELF/PE 파일 정보를 파싱하고 가능한 명령어의 상위 집합을 디코딩하여 초기 datalog 사실 집합을 생성합니다. 이러한 사실들은 코드 위치, 심볼화, 함수 경계를 식별하기 위해 분석됩니다. 이 분석 결과인 정제된 datalog 사실 집합은 바이너리 분석 및 리버스 엔지니어링을 위한 GTIRB 중간 표현으로 변환됩니다. 그런 다음 GTIRB pretty printer를 사용하여 GTIRB를 재조립 가능한 어셈블리 코드로 예쁘게 출력할 수 있습니다.
바이너리 형식:
명령어 세트 아키텍처(ISA):
Docker를 사용하여 미리 빌드된 Ddisasm 버전을 실행할 수 있습니다:
docker pull grammatech/ddisasm:latest
Ddisasm은 바이너리를 GTIRB 표현으로 디스어셈블하는 데 사용할 수 있습니다. 저장소에 포함된 예제 중 하나로 시도해 볼 수 있습니다.
먼저 Ddisasm Docker 컨테이너를 시작합니다:
docker run -v $PWD/examples:/examples -it grammatech/ddisasm:latest
Docker 컨테이너 내에서 예제 중 하나를 빌드해 보겠습니다:
apt update && apt install gcc -y
cd /examples/ex1
gcc ex.c -o ex
이제 바이너리 디스어셈블을 진행할 수 있습니다:
ddisasm ex --ir ex.gtirb
GTIRB 표현을 얻으면 GTIRB 또는 gtirb-rewriting을 사용하여 바이너리에 프로그래밍 방식으로 변경할 수 있습니다.
그런 다음 (Docker 이미지에 포함된) gtirb-pprinter를 사용하여 바이너리의 새 버전을 생성할 수 있습니다:
gtirb-pprinter ex.gtirb -b ex_rewritten
내부적으로 gtirb-pprinter는 어셈블리 파일을 생성하고 컴파일러/어셈블러(예: gcc)를 호출하여 새 바이너리를 생성합니다. gtirb-pprinter는 컴파일 옵션, 라이브러리 종속성 또는 버전 링커 스크립트를 포함하여 새 바이너리를 생성하는 데 필요한 모든 명령줄 옵션을 처리합니다.
gtirb-pprinter를 사용하여 수동 수정을 위한 어셈블리 목록을 생성할 수도 있습니다:
gtirb-pprinter ex.gtirb --asm ex.s
그런 다음 이 어셈블리 목록을 수동으로 다시 컴파일할 수 있습니다:
gcc -nostartfiles ex.s -o ex_rewritten
추가 정보는 문서를 참조하십시오.
@inproceedings {flores-montoya2020,
author = {Antonio Flores-Montoya and Eric Schulte},
title = {Datalog Disassembly},
booktitle = {29th USENIX Security Symposium (USENIX Security 20)},
year = {2020},
isbn = {978-1-939133-17-5},
pages = {1075--1092},
url = {https://www.usenix.org/conference/usenixsecurity20/presentation/flores-montoya},
publisher = {USENIX Association},
month = aug,
}
@misc{schulte2020gtirb,
title={GTIRB: Intermediate Representation for Binaries},
author={Eric Schulte and Jonathan Dorn and Antonio Flores-Montoya and Aaron Ballman and Tom Johnson},
year={2020},
eprint={1907.02859},
archivePrefix={arXiv},
primaryClass={cs.PL}
}
@INPROCEEDINGS{11023516,
author={Flores-Montoya, Antonio and Lim, Junghee and Seitz, Adam and Sood, Akshay and Raff, Edward and Holt, James},
booktitle={2025 IEEE Symposium on Security and Privacy (SP)},
title={Disassembly as Weighted Interval Scheduling with Learned Weights},
year={2025},
volume={},
number={},
pages={3033-3050},
keywords={Measurement;Privacy;Accuracy;Heuristic algorithms;Reverse engineering;Binary codes;Benchmark testing;Scheduling;Inference algorithms;Security;disassembly;reverse engineering;learning;binary analysis},
doi={10.1109/SP61157.2025.00192}}