
BootStomp: 부트로더 취약점 탐색기
BootStomp은 부트로더 버그 탐색기입니다. 메모리 손상(memory corruption)과 상태 저장(state storage) 취약점이라는 두 가지 유형의 버그를 찾습니다. 자세한 내용은 https://seclab.cs.ucsb.edu/academic/publishing/#bootstomp-security-bootloaders-mobile-devices-2017 에서 BootStomp 논문을 참조하십시오.
BootStomp의 분석을 실행하려면 다음 지침을 읽으십시오. BootStomp는 ARM 아키텍처(32비트 및 64비트 모두)용으로 컴파일된 부트로더에서 작동하며, angr 및 Z3 버전에 따라 결과가 약간 달라질 수 있습니다. 이는 angr이 기본 블록을 분석하는 시간과 Z3의 표현식 구체화 결과에 기인합니다.
$ pip install angr
BootStomp를 사용하는 가장 쉬운 방법은 Docker 컨테이너에서 실행하는 것입니다.
docker 폴더에는 적절한 Dockerfile이 포함되어 있습니다.
다음은 사용 명령어입니다.
cd docker
# build the docker image
docker build -t bootstomp .
# run the docker image (if you need, use proper options to have persistent changes or shared files)
docker run -it bootstomp
# now you are inside a docker container
cd BootStomp
# run BootStomp's taint analysis on one of the examples
# this will take about 30 minutes
python taint_analysis/bootloadertaint.py config/config.huawei
# the last line of the output will be something like:
# INFO | 2017-10-14 01:54:10,617 | _CoreTaint | Results in /tmp/BootloaderTaint_fastboot.img_.out
# you can then "pretty print" the results using:
python taint_analysis/result_pretty_print.py /tmp/BootloaderTaint_fastboot.img_.out
출력은 다음과 비슷합니다:
...
17)
===================== Start Info path =====================
Dereference address at: 0x5319cL
Reason: at location 0x5319cL a tainted variable is dereferenced and used as address.
...
Tainted Path
----------------
0x52f3cL -> 0x52f78L -> 0x52f8cL -> 0x52fb8L -> 0x52fc8L -> 0x52fecL -> 0x53000L -> 0x53014L -> 0x5301cL -> 0x53030L -> 0x53044L -> 0x53050L -> 0x5305cL -> 0x53068L
===================== End Info path =====================
# Total sinks related alerts: 5
# Total loop related alerts: 8
# Total dereference related alerts: 4
find_taint.py 를 실행합니다.taint_source_sink.txt 파일로 저장됩니다.부트로더 바이너리에 대한 JSON 설정 파일을 생성합니다(예제는 config/ 디렉터리 참조). 각 필드는 다음과 같습니다:
다음 명령어를 실행합니다:
python bootloadertaint.py config-file-path
결과는 /tmp/BootloaderTaint_[boot-loader].out에 저장됩니다. 여기서 [boot-loader]는 분석된 부트로더의 이름입니다. 루프를 포함하는 경로는 여러 번 나타날 수 있습니다.
다음 명령어를 실행합니다:
python unlock_checker.py config-file-path
결과는 /tmp/UnlockChecker_[boot-loader].out에 저장됩니다. 여기서 [boot-loader]는 분석된 부트로더의 이름입니다. 루프를 포함하는 경로는 여러 번 나타날 수 있습니다.
BootStomp 결과를 확인하려면 다음과 같이 result_pretty_print.py 스크립트를 사용합니다:
python result_pretty_print.py results_file