该项目旨在分析原始二进制固件并自动确定其某些特性。 该工具兼容所有架构,因为它基本上只对固件进行简单统计。
主要功能:
首先,克隆 git 仓库:
git clone https://github.com/quarkslab/binbloom.git
cd binbloom
要构建最新版本(仅限 Linux):
autoreconf -i
./configure
make
sudo make install
binbloom firmware.bin
该命令应输出类似以下内容:
[i] 32-bit architecture selected.
[i] File read (20480 bytes)
[i] Endianness is LE
[i] 6 strings indexed
[i] Found 3 base addresses to test
[i] Base address seems to be 0x60000000 (not sure)
More base addresses to consider (just in case):
0x005b5000 (0)
0x0bcd0000 (0)
在该输出中,第三行显示猜测的字节序(LE,小端序),第六行给出猜测的地址(0x60000000)。已识别出 6 个文本字符串和 3 个可能的基地址。如果未指定架构,则默认考虑 32 位架构。
每个候选地址后面括号中的数值是对应的分数。分数越高,地址的可能性越大。
binbloom -a 64 firmware.bin
[i] 64-bit architecture selected.
[i] File read (327680 bytes)
[i] Endianness is LE
[i] 717 strings indexed
[i] Found 7535 base addresses to test
[i] Base address found: 0x0000000000010000.
More base addresses to consider (just in case):
0x000000000000e000 (276)
0x000000000000f000 (242)
0x0000000000011000 (175)
0x000000000000d000 (167)
0x000000000000b000 (121)
0x0000000000013000 (107)
0x0000000000012000 (100)
[...]
-a 选项告诉 binbloom 考虑 64 位固件,上述输出显示猜测的基地址为 0x10000。
当处理小型固件(大小 < 10 KB)时,binbloom 的字节序检测可能不可靠,并给出错误结果,导致意外的基地址。在这种情况下,可以使用 -e 选项指定字节序:
binbloom -e be firmware.bin
然后会产生如下输出:
[i] Selected big-endian architecture.
[i] File read (1048576 bytes)
[i] Endianness is BE
[i] 764 strings indexed
[i] Found 18615 base addresses to test
[i] Base address seems to be 0x00000000 (not sure).
More base addresses to consider (just in case):
0x3f740000 (121043)
0x7ff48000 (61345)
0x41140000 (59552)
[...]
此时字节序被强制指定(本例中为大端序),binbloom 依靠此配置来猜测基地址。
binbloom -a 32 -e be -b 0x0 firmware.bin
[i] 32-bit architecture selected.
[i] Selected big-endian architecture.
[i] Base address 0x0000000000000000 provided.
[i] 764 strings indexed
Most probable UDS DB is located at @000ee8c8, found 7 different UDS RID
Identified structure:
struct {
code *p_field_0;
code *p_field_1;
uint32_t dw_2;
}
该分析基于启发式方法,因此可能给出误报。您需要阅读 binbloom 找到的潜在 UDS 数据库列表,并检查哪个是正确的(如果有的话)。Binbloom 在其输出中提供了识别出的结构,允许某些反汇编器在结构声明之后解析内存。
您可以通过 -t 选项启用多线程来加速基地址查找过程。默认情况下使用单线程。
binbloom -t 8 firmware.bin
还实现了一种深度搜索模式,可通过 -d 选项启用,但仍处于实验阶段。该模式在极少数情况下可能有用,因为当其他方法无效时它可能找到有效的基地址,但速度较慢,可能需要一些时间才能完成。
如果您希望工具显示更多信息,请使用一个或多个 -v 选项。
binbloom 根据 Apache 2.0 许可证 提供。