# FwAnalyzer 固件文件系统规则检查工具

> 针对固件中文件系统镜像的规则检查工具：读取 ext2/3/4、FAT/VFAT、SquashFS 和 UBIFS 镜像、cpio 归档或目录，并以 JSON 报告列出所有违反 TOML 配置规则的文件。规则涵盖 SUID 与全局可写文件、允许的属主、SELinux 标签与 Linux capabilities、单个文件的元数据、内容正则、SHA-256 摘要、JSON 字段，以及外部脚本（例如附带的 checksec 包装脚本）；还能提取版本字符串等数值，并把文件树或指定文件与上一次运行的结果比较。Cruise 将其定位为固件安全检查流程的一环，check.py 搭配 Android OTA 解包脚本可对固件包中的每个镜像逐一运行检查。

- 类型：工具
- 目标：固件
- 类别：固件工具
- 关联：基础工具
- 来源复核于：2026-10-20
- 收录于：2026-11-02
- 原始资源：<https://github.com/cruise-automation/fwanalyzer>
- 一手来源：<https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/Readme.md>
- 目录页面：<https://awesomerea.org/zh/resources/fwanalyzer/>
- 记录 JSON：<https://awesomerea.org/resources/fwanalyzer/record.json>
- 英文版：[English](https://awesomerea.org/resources/fwanalyzer/index.md)

## 使用条件与局限

- 审阅时最新版本为 1.4.4，发布于 2022-10-24，未附带二进制文件；1.4.1 至 1.4.3 版附有预编译的 Linux 版 fwanalyzer。所审阅的 master 提交日期为 2023-10-08，仅在该版本之后修正拼写错误，也是最新提交；仓库未归档，Makefile 中的 VERSION 仍为 1.4.1。
- 需用 Go 从源码构建（go.mod 声明 Go 1.13，Makefile 默认 GOOS 为 linux），执行 make deps 和 make 后得到 build/fwanalyzer。各文件系统后端都调用外部程序：ext 镜像用 e2tools 的 e2ls 和 e2cp，FAT 用 mtools 的 mdir 和 mcopy，另需 unsquashfs、ubi_reader 的 ubireader_list_files 以及 cpio。读取 SELinux 与 capability 信息需要作者打过补丁的 e2tools 和 squashfs-tools 分支，处理 ext 中的符号链接需要 e2tools 的 link_support 分支；Dockerfile 在 golang:1.13 镜像上列出了完整依赖。
- 输入为使用者已有的文件系统镜像或已解包目录；FwAnalyzer 本身不解包固件包。check.py 需要一个把配置映射到镜像的解包脚本，附带的 Android OTA 解包脚本依赖独立的 extract_android_ota_payload 与 mkbootimg_tools 项目。检查结果完全取决于使用者的配置：devices 目录提供 Android user 构建、Android 属性和通用 Linux 根文件系统的示例规则，报告列出的是违反规则的文件，而非经过评估的漏洞。
- make test 运行 Go 单元测试，集成测试目标运行为 Python 2 编写的 test/test.py，所用夹具均位于 test/ 中：小型 ext2、SquashFS、UBIFS、VFAT 和 cpio 镜像，ARM32、ARM64 与 x86-64 的 hello-world ELF 构建，以及预编译的 e2cp 和 unsquashfs 辅助程序；make testsetup 会用到 sudo setcap。CircleCI 在 Docker 镜像中构建并测试，GitHub 工作流仅用 golangci-lint v1.29 做代码检查。
- 采用 Apache-2.0 许可，版权属 Cruise LLC；外部文件系统工具各自适用其许可。

## 一手来源

1. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/Readme.md>
2. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/Building.md>
3. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/Changelog.md>
4. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/Checksec.md>
5. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/Dockerfile>
6. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/Makefile>
7. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/go.mod>
8. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/devices/Readme.md>
9. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/devices/android/Readme.md>
10. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/pkg/extparser/extparser.go#L40-L43>
11. <https://github.com/cruise-automation/fwanalyzer/tree/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/test>
12. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/.circleci/config.yml>
13. <https://github.com/cruise-automation/fwanalyzer/blob/a0db45054642f89a5f855b0dcc0730ebd01c8c9e/LICENSE>
14. <https://github.com/cruise-automation/fwanalyzer/releases/tag/1.4.4>

## 同分区更多条目：固件与硬件

- [FwHunt 社区版 UEFI 固件规则扫描器](https://awesomerea.org/zh/resources/fwhunt-scan/index.md) · 工具
- [sniffROM 串行闪存被动嗅探重建工具](https://awesomerea.org/zh/resources/sniffrom/index.md) · 工具
- [Pawn Intel 平台 BIOS 固件提取工具](https://awesomerea.org/zh/resources/google-pawn/index.md) · 工具
- [EMBArk EMBA 固件扫描 Web 平台](https://awesomerea.org/zh/resources/embark/index.md) · 工具
- [IDAPython Embedded Toolkit 嵌入式固件分析脚本集](https://awesomerea.org/zh/resources/idapython-embedded-toolkit/index.md) · 工具
- [fiano UEFI 固件解析与修改工具集](https://awesomerea.org/zh/resources/fiano/index.md) · 工具

## 关于此条目

说明已依据一手来源复核。
原创说明采用 MIT 许可；外部项目、论文与素材保留各自的权利和许可。
