ETC

LLVM 난독화 (feat. 기법 3가지)

wsoh9812 2022. 1. 26. 18:02

https://github.com/obfuscator-llvm/obfuscator/wiki/Installation

2021 화이트햇 문제를 풀다가 Control Flow Flattening(CFF)이라는 기법을 알게되어서 정리를 해보려고한다.

 


LLVM이란?

C, C++, Objectiv-C, Swift, Scala 등을 컴파일할 수 있는 컴파일러 이다.

 

 

 

LLVM 난독화

컴파일 단에서 Intermediate Representation (IR) 수준의 코드난독화를 해준다. 

( https://github.com/obfuscator-llvm/obfuscator/wiki  )

 

 

여기서는 3개의 LLVM 난독화를 제시해 놓았다.

각각의 난독화를 적용하여 어떻게 코드가 바뀌는지 예시 링크를 걸어 두었고, 3개의 난독화를 적용하였을때 어떻게 코드가 바뀌는지만 눈으로 확인해보려 한다.

 

1. control flow flattening

https://github.com/obfuscator-llvm/obfuscator/wiki/Control-Flow-Flattening

2. instruction substitution

https://github.com/obfuscator-llvm/obfuscator/wiki/Instructions-Substitution

3. bogus control flow

https://github.com/obfuscator-llvm/obfuscator/wiki/Bogus-Control-Flow

 

 

2021Whitehat CFF Binary

main
0.21MB

 

 

CFF Deobfuscator

https://gitlab.com/eshard/d810

 

 

 

참조

https://reverseengineering.stackexchange.com/questions/2221/what-is-a-control-flow-flattening-obfuscation-technique

https://blukat.me/2015/10/llvm-obfuscator/

https://die4taoam.tistory.com/66

 

 

 

 

 

 

'ETC' 카테고리의 다른 글

[CVE-2016-5195] Dirty COW 분석  (0) 2022.05.02
CVE-2021-1732 LPE vulnerability analysis  (2) 2022.04.08
COM(Component Object Model)의 개념 잡기  (0) 2021.11.21
[COM 객체] 가상 멤버함수 후킹 !  (0) 2021.11.14
OSCP 준비] cheat sheet  (0) 2021.09.25