CVE-2026-112652 - iOS 27.0.1 SecPolicyCreateWithProperties 证书验证绕过:根因分析、差分 PoC 测试框架与构建工具
Security.framework 中的证书验证对 iOS 27.0.1 → 27.2 证书验证修复的根因分析,附带经差分验证的证明和可复现的测试框架。
| CVE | CVE-2026-112652 |
| CWE | CWE-295 — 证书验证不当 |
| CVSS 3.1 | 5.5 MEDIUM — AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N |
| 组件(Apple) | Security |
| 组件(实际) | Security.framework(用户态)→ SecPolicyCreateWithProperties |
| 受影响的策略类 | 1.2.840.113635.100.1.62 — Apple 固定策略(SecPolicyCreateApplePinned) |
| 修复版本 | iOS 27.2 · iPadOS 27.2 · macOS 15.8.2 / 26.7.2 / Golden Gate 27.2 · visionOS 27.2 |
| 安全公告 | HT149230 |
| 报告者 | Aditya Kumar |
| CISA KEV | 未列入 · 无已知利用 |
本仓库中没有任何预构建的产物。 每个二进制文件、证书和固件镜像均由
make在本地生成。参见构建。
SecPolicyCreateWithProperties() 根据调用方提供的属性字典构建 SecPolicy。在 iOS 27.0.1 上,它只验证了策略所需输入中的一个。省略 kSecPolicyPolicyName 和/或 kSecPolicyLeafMarkerOid 后,它仍然返回一个非 NULL 的策略——一个缺少调用方所要求约束的策略——而不是拒绝。iOS 27.2 增加了两项缺失的存在性检查、一个专用的 kSecPolicyErrorMissingProperties 错误,以及一个新的 SecPolicyCreateWithPropertiesWithError API 来报告该失败。
Apple 自己的描述是*“通过改进状态管理解决了一个逻辑问题”*:该策略对象在部分初始化的情况下被带入信任评估,而不是在创建时被拒绝。
iOS 27.0.1 — 固定类的分派分支检查三个值,而其中没有一个是 kSecPolicyPolicyName 或 kSecPolicyLeafMarkerOid:
0x187f11f8c: add x1, x1, #0x640 ; OID 1.2.840.113635.100.1.63
0x187f11f94: bl 0x188140ec0 ; CFEqual(policyIdentifier, OID)
0x187f11f98: cbz w0, loc_187f12000 ; not this class -> next
0x187f11f9c: cbz x19, loc_187f12040 ; SecPolicyPolicyName missing
0x187f11fa0: ldr x1, [sp, #0x18] ; value of SecPolicyName
0x187f11fa4: cbz x1, loc_187f12040 ; SecPolicyName missing
0x187f11fa8: cbz x25, loc_187f12040 ; SecPolicyLeafMarkerOid missing
0x187f11fb8: bl _SecPolicyCreateAppleSSLPinned
iOS 27.2 — 同一分支,新增了两项存在性检查:
0x187e88318: ldr x8, [sp, #0x10] ; SecPolicyPolicyName value
0x187e8831c: cbz x8, loc_187e88440 ; MISSING -> error <-- ADDED
0x187e88320: cbz x22, loc_187e88440 ; SecPolicyIntermediateMarkerOid MISSING <-- ADDED
0x187e88324: cbz x24, loc_187e88440 ; SecPolicyLeafMarkerOid MISSING <-- ADDED
0x187e88334: bl _SecPolicyCreateApplePinned
两个新的失败都汇入新的辅助函数,该函数返回 errSecParam 和
NULL:
0x187e884c4: bl _SecPolicyErrorMissingProperties
...
0x187e87d18: mov w0, #0xffffffce ; errSecParam = -50
0x187e87d20: bl _SecError
0x187e87d24: mov x22, #0 ; return NULL
公共 API 也已重新指向新的实现:
_SecPolicyCreateWithProperties:
0x187e8feb0: mov x2, #0 ; CFErrorRef *out = NULL
0x187e8feb4: b _SecPolicyCreateWithPropertiesWithError
该测试框架扫描 123 个策略标识符 × 5 个属性子集 = 618 个用例, 在存在漏洞的 iPhone 18 Pro Max 上运行,并与固定的 macOS 进行对比:
| iOS 27.0.1(存在漏洞) | macOS 26.7.2(已修复) | |
|---|---|---|
CONTROL anchored-basic-x509 | ACCEPT | ACCEPT — 测试框架已验证 |
policy=OK | 579 | 555 |
policy=NULL | 39 | 63 |
| 两者均实现的类 | 347 | 347 |
该修复涉及三个策略类 —
1.2.840.113635.100.1.62(Apple pinned)、.68(IDS)和.47(Apple Server Authentication)— 并且在 存在漏洞的构建上,其中两个会接受描述不充分的字典:.47 (Apple Server Auth): full=OK no-leafmarker=OK no-policyname=OK name-only=OK .68 (IDS): full=OK no-leafmarker=OK no-policyname=OK name-only=OKmacOS 26.7.2 返回相同的值,这证明其对这些分支的实现 与 iOS 27.2 不同 — 因此 macOS 恰恰在修复所涉及的类上 是错误的参照。其余 24 个存在差异的行位于 macOS 完全未实现的五个类中。
预测: 在 iOS 27.2 上,这六行将翻转为
policy=NULL。这是 决定性的测量,需要一台运行 27.2 的 iPhone — 参见docs/FINDINGS.md§3。
该修复已通过静态方式精确定位:在 1.2.840.113635.100.1.62
(Apple pinned)分支上,27.2 要求 kSecPolicyPolicyName、
kSecPolicyIntermediateMarkerOid 以及 kSecPolicyLeafMarkerOid,并
返回 errSecParam + kSecPolicyErrorMissingProperties,而不是仅返回
NULL。
完整分析见 docs/IMPACT.md。简要版本如下:
这不是设备沦陷。 可达性,从 dyld 共享 缓存符号表中解析得出:
SecPolicyCreateWithProperties 仅被 CFNetwork、Accounts、
StoreServices 和 CloudServices 导入。1.2.840.113635.100.1.62 在整个缓存中恰好只出现在一个
映像中:Security。没有任何系统组件请求它。因此没有跨越任何权限边界。想要信任恶意
证书的应用并不需要这个漏洞 — SecPolicyCreateBasicX509() 加上
SecTrustSetAnchorCertificates() 已经可以做到这一点。现实中的危害是
静默丢失开发者预期的固定约束:API 成功返回,
而开发者无从察觉。
它与 TrollStore 无关。 TrollStore 的核心漏洞是 installd / amfid
中的权限和代码签名验证
(CVE-2022-26766、CVE-2022-29967)。而这里是
Security.framework 中的信任策略构建。相同的 CWE 类别,不同的二进制文件,不同的权限
边界,不同的后果。从调用方控制的信任
策略到签名或权限决策之间不存在路径。
它作为研究的价值: 一个真正的 Apple 分配的 CWE-295,其根本
原因已证明到指令级别,在真实硬件上进行了差分验证,
外加一个可复用的工具包。更高价值的工作是寻找
27.2 修复的绕过 — 这是通往新的、未修复 CVE 的唯一途径 — 以及审计 CFNetwork 的调用
点。参见 docs/IMPACT.md §5。
docs/
ROOT_CAUSE.md the proof: disassembly, string resolution, the exact defect
FINDINGS.md the measured differential and the attack chain
IMPACT.md reachability, attacker gain, the TrollStore question
METHODOLOGY.md how every conclusion was reached, and the pitfalls
EVIDENCE.md how to read the captured reports
RESEARCH-PLAN.md the A-Z plan this work followed
analysis/ the reusable tooling
resolve_cfstring.py resolves CFString constants inside a dyld shared cache
compare_code.py byte-level Mach-O section comparator
compare_frameworks.py userspace dylib comparator
extract_fn.sh splits a function body out of a disassembly dump
regen-artifacts.sh re-downloads the firmware and regenerates everything
cve/ the CVE record
CVE-2026-112652.md
fetch-records.sh pulls the public NVD and MITRE JSON
diff/ kernelcache diff 27.0.1 -> 27.2
analyze.py, report.md, *.csv
poc/ the reproducible harness
build.sh one command: certs -> embed -> verify -> build
PoC/ the iOS app (Run button, 618-case matrix)
macos-cli/ the same matrix as a macOS command-line tool
Certs/regen.sh generates the throwaway CA and leaf
embed_certs.py inlines the generated DER into the sources
check-embedded-certs.py asserts the inlined bytes match
compare_reports.py differential analyser for two device reports
evidence/ captured device reports
没有任何预构建内容被提交。你需要自行生成所有内容。
python3 3.9+opensslblacktop/ipsw v3.1+ — 仅用于重新生成固件分析输入git clone https://github.com/FAHAD21313/cve-2026-112652-secpolicy-research
cd cve-2026-112652-secpolicy-research
make # generate the certs, embed them, verify
make macos # build the macOS command-line harness
make ios # build the iOS app (macOS + Xcode)
make 按顺序执行以下操作:
poc/Certs/regen.sh — 生成一个一次性 CA 以及一个用于 victim.test 的叶子证书。
私钥绝不会离开你的机器,也绝不会被提交。poc/embed_certs.py — 将生成的 DER 内联到 Swift 源码中。poc/check-embedded-certs.py — 断言内联的字节仍与生成的文件匹配,
因此过期的证书绝不会被悄无声息地发布出去。./cve/fetch-records.sh # pulls the public NVD and MITRE JSON into cve/raw/
这些文件很大(约 15 GB),未提交到仓库:
./analysis/regen-artifacts.sh
它从 Apple 的 CDN 下载两个 IPSW,提取两个 kernelcache 以及
两个 dyld shared cache 中的 Security.framework,并重新运行
反汇编。
poc/README.md)并安装它。poc-report.txt 写入应用的 Documents
目录。