xsscx/xnuimagetools
GitHub: xsscx/xnuimagetools
跨 Apple 平台的图像格式 Fuzzing 工具链,通过 ICC Profile 变异与 VideoToolbox 帧级模糊测试挖掘图像解析漏洞。
Stars: 7 | Forks: 1
# XNU Image Tools
适用于 iOS、watchOS 和 Mac Catalyst 的多平台镜像生成与 Fuzzing 工具包。生成跨平台的多样化基线镜像,然后通过嵌入 ICC Profile 对其进行 Fuzz,支持 22 种以上的输出格式,目标应用涵盖 Preview、Safari、iMessage、Mail 和 Notes。
[XNU Image Fuzzer](https://github.com/xsscx/xnuimagefuzzer) 作为 **git submodule** 包含在 `XNU Image Fuzzer/` 中。xnuimagefuzzer 是该 Fuzzer 源代码的主要开发仓库 —— 所有代码更改都应首先在该处进行。
## 克隆
```
git clone --recurse-submodules https://github.com/xsscx/xnuimagetools.git
# 如果已在无子模块情况下克隆:
git submodule update --init --recursive
# 更新子模块至最新 xnuimagefuzzer:
git submodule update --remote "XNU Image Fuzzer"
```
## 工作流程
1. 使用 xnuimagetools 生成基线镜像 (iOS, watchOS, Mac Catalyst)
2. 使用 [xnuimagefuzzer](https://github.com/xsscx/xnuimagefuzzer) 进行 Fuzz (`--pipeline`, `--chain`, `--input-dir`)
3. 嵌入 ICC Profile (原始 + [变异](https://github.com/xsscx/research/tree/main/colorbleed_tools))
4. 输入到目标应用:Preview, Safari, iMessage, Mail, Notes
5. 从 `~/Library/Logs/DiagnosticReports/` 收集崩溃日志
## 组件
| 组件 | 平台 | 语言 | LOC | 备注 |
|-----------|----------|----------|-----|-------|
| XNU Image Fuzzer | macOS (Mac Catalyst) | Objective-C | 5,800+ | git submodule → [xsscx/xnuimagefuzzer](https://github.com/xsscx/xnuimagefuzzer) |
| XNU Image Generator for iOS | iOS | Swift | — | |
| XNU Image Generator for Watch | watchOS | Swift | — | |
| VideoToolbox Fuzzer | iOS / macOS | Obj-C + C | 1,775 | |
## 快速开始
```
# 在 Xcode 中打开工作区,更新 Team ID,选择 scheme,运行
open "XNU Image Tools.xcworkspace"
# Mac Catalyst CLI build (unsigned)
xcodebuild build \
-project "XNU Image Fuzzer/XNU Image Fuzzer.xcodeproj" \
-scheme "XNU Image Fuzzer" \
-destination 'platform=macOS,variant=Mac Catalyst' \
-configuration Debug \
CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
# VideoToolbox fuzzer
cd VideoToolbox/Fuzzing && make
build/videotoolbox-runner -t 60 -o /tmp/fuzzed-frames big.mov
```
## VideoToolbox Fuzzer
针对 Apple 硬件解码 Pipeline 的三组件视频帧变异 Fuzzer:
| 组件 | 文件 | 用途 |
|-----------|------|---------|
| Runner | `videotoolbox-runner.m` | AVFoundation 帧提取、变异、PNG 输出 |
| Interposer | `videotoolbox-interposer.c` | 用于 IOKit Fuzzing 的 DYLD `IOConnectCallMethod` 替换 |
| Launcher | `runner.c` | 用于进程附加的 iOS AMFI 绕过 |
通过 Makefile 使用 ASAN+UBSAN+coverage 构建(非 Xcode)。默认使用 `big.mov` (20MB) 作为输入。
## CI/CD 工作流
| 工作流 | 任务 | 用途 |
|----------|------|---------|
| `build-and-test.yml` | 8 | 构建、生成镜像、提取 ICC 种子 |
| `cached-build.yml` | — | 使用 DerivedData 缓存的快速构建 |
| `code-quality.yml` | — | ObjC 语法、Python lint、CMake 检查 |
| `instrumented.yml` | 3 × (macOS 14, 15) | ASAN+UBSAN: Mac Catalyst + macOS 原生 + 覆盖率 |
| `videotoolbox.yml` | 4 | 构建、覆盖率、静态分析、Fuzz 并提交 |
| `release.yml` | — | 由 Tag 触发的 Release 及 Artifacts |
所有 Actions 均采用 SHA 固定。`persist-credentials: false`。`BASH_ENV=/dev/null`。
## 平台支持
| 平台 | 状态 |
|----------|--------|
| macOS 14+ (arm64, x86_64) | ✅ |
| iOS / iPadOS 18+ | ✅ |
| watchOS 11+ | ✅ |
| visionOS 2.x | ✅ |
## 示例输出
### iOS / Mac / Vision Pro
### watchOS
## 文档
- [Copilot 说明](.github/copilot-instructions.md) — 构建命令、架构、调试环境变量
- [VideoToolbox Fuzzer](VideoToolbox/Readme.md) — VideoToolbox Interceptor 文档
- [VideoToolbox 指南](.github/instructions/videotoolbox.instructions.md) — 特定路径的构建/代码模式
- [XNU Image Fuzzer](https://github.com/xsscx/xnuimagefuzzer) — 主要 Fuzzer 仓库
- [安全研究](https://github.com/xsscx/research) — ICC Profile 分析、CFL Fuzzer、MCP Server
### watchOS
## 文档
- [Copilot 说明](.github/copilot-instructions.md) — 构建命令、架构、调试环境变量
- [VideoToolbox Fuzzer](VideoToolbox/Readme.md) — VideoToolbox Interceptor 文档
- [VideoToolbox 指南](.github/instructions/videotoolbox.instructions.md) — 特定路径的构建/代码模式
- [XNU Image Fuzzer](https://github.com/xsscx/xnuimagefuzzer) — 主要 Fuzzer 仓库
- [安全研究](https://github.com/xsscx/research) — ICC Profile 分析、CFL Fuzzer、MCP Server标签:API密钥检测, Apple生态, Crash分析, CVE监控, ICC配置文件, iMessage安全, iOS安全, Mac Catalyst, macOS安全, Objective-C, Safari安全, Swift, UTI, VideoToolbox, watchOS, Xcode, XNU, 图像处理, 图片生成, 多格式支持, 情报收集, 文件格式Fuzzing, 漏洞研究, 输入验证