BootStomp 是一个引导加载程序漏洞查找工具。它针对两类不同的漏洞进行检测:内存损坏和状态存储漏洞。更多信息请参考 BootStomp 论文:https://seclab.cs.ucsb.edu/academic/publishing/#bootstomp-security-bootloaders-mobile-devices-2017
要运行 BootStomp 的分析,请阅读以下说明。请注意,BootStomp 适用于为 ARM 架构(32 位和 64 位)编译的引导加载程序,并且结果可能因 angr 和 Z3 的版本而略有不同。这是因为 angr 分析基本块的时间以及 Z3 表达式具体化的结果存在差异。
$ pip install angr
使用 BootStomp 最简单的方式是在 Docker 容器中运行。
docker 文件夹包含相应的 Dockerfile。
以下是使用命令。
cd docker
# 构建 Docker 镜像
docker build -t bootstomp .
# 运行 Docker 镜像(如有需要,请使用适当的选项来持久化更改或共享文件)
docker run -it bootstomp
# 现在你在 Docker 容器内
cd BootStomp
# 对其中一个示例运行 BootStomp 的污点分析
# 这将花费大约 30 分钟
python taint_analysis/bootloadertaint.py config/config.huawei
# 输出的最后一行类似于:
# INFO | 2017-10-14 01:54:10,617 | _CoreTaint | Results in /tmp/BootloaderTaint_fastboot.img_.out
# 然后你可以使用以下命令“漂亮打印”结果:
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.pytaint_source_sink.txt 文件中。为引导加载程序二进制文件创建一个 JSON 配置文件(参见 config/ 中的示例),其中:
运行
python bootloadertaint.py 配置文件路径
结果将存储在 /tmp/BootloaderTaint_[引导加载程序名称].out 中,其中 [引导加载程序名称] 是分析的引导加载程序名称。请注意,涉及循环的路径可能会多次出现。
运行
python unlock_checker.py 配置文件路径
结果将存储在 /tmp/UnlockChecker_[引导加载程序名称].out 中,其中 [引导加载程序名称] 是分析的引导加载程序名称。请注意,涉及循环的路径可能会多次出现。
要检查 BootStomp 的结果,请使用脚本 result_pretty_print.py,如下所示:
python result_pretty_print.py 结果文件