diff --git a/docs/19_DISPOSITION_CHAIN_DEVICE_VERIFICATION.md b/docs/19_DISPOSITION_CHAIN_DEVICE_VERIFICATION.md index 8408ef7..d58d961 100644 --- a/docs/19_DISPOSITION_CHAIN_DEVICE_VERIFICATION.md +++ b/docs/19_DISPOSITION_CHAIN_DEVICE_VERIFICATION.md @@ -45,8 +45,11 @@ | D5 | poison_mark_corrupt | 手动 `ig_poison_mark(e)` 后 apply | 两组同:mask!=0 → `out!=key`(证毒化真的坏 key) | | D6 | ctor_clean_start | 进程启动后**未** mark 时读 `ig_poison_mask()` | 两组同:==0(证构造期三副本初始化干净,无启动即毒化) | | D7 | policy_grades | 喂合成 finding(弱/单 MEDIUM/双 MEDIUM/单 STRONG) | 两组同:弱&单 MEDIUM 不触发,双 MEDIUM&单 STRONG 触发(真机复核分级) | +| D8 | svc_access_live | 自身沙盒 Documents 建真实可访问文件,喂 `ig_anti_jb_check_paths` | 两组同:命中 400(证 svc 直发 access 在真机 iOS arm64 能命中,**无需越狱**即排除「探针静默失败」假阴性) | > D4–D7 与宿主自测同构,但要在真机二进制里再跑一遍,排除交叉编译/优化差异。D1–D3 是真机独有(依赖真实 svc + 真实文件系统)。 +> +> **D8 的价值(无越狱设备时尤其关键)**:R 组 D2 的 `400=0` 单看无法区分「没有越狱文件」与「svc 直发在 iOS 上静默失败、永远返回 0」两种情况——后者是致命假阴性。D8 用自身沙盒内一个**真实可访问**的文件喂同一条 svc-access 路径,命中即证明检测机制在真机 iOS arm64 上是活的。它不能替代 J 组(证不了真实越狱文件/401 沙盒逃逸),但把「探针是否工作」这一层从 J 组依赖里剥离出来,**在没有越狱设备时仍可闭合**。 --- @@ -108,13 +111,14 @@ runner 退出码:D4–D7 不变量全过 **且** 环境判定与 `--expect` - [x] 宿主闭环基线固化并绿灯:`tests/fixtures/poison_host.c` + `tests/test_poison_policy.py`(19/19:poison 7 + policy 8 + jailbreak 4)。 - [x] `poison_device.m` + `build_poison_device.py` + `run_poison_device.py`(复用 docs/17 harness);交叉编译通过(iphoneos arm64),待真机执行。 -- [x] **R 组达标(2026-11-13)**:iPhone 16 Plus(iPhone17,4,非越狱,TouchLinked_dev 通配 profile,专用 BID `cn.touchv.iosguard.poisonpilot.20261113`,测后卸载)。`run_poison_device.py --expect clean` → **verdict PASS**。 +- [x] **R 组达标(2026-11-13)**:iPhone 16 Plus(iPhone17,4,非越狱,TouchLinked_dev 通配 profile,专用 BID `cn.touchv.iosguard.poisonpilot.20261113c`,测后卸载)。`run_poison_device.py --expect clean` → **verdict PASS,不变量 5/5**。 - D6 ctor_clean_start:`mask=0x0`(启动即健康)✓ - D4 poison_identity ✓;D5 poison_mark_corrupt ✓ - D7 policy_grades:`weak=0 single_medium=0 two_medium=1 single_strong=1`(真机分级一致)✓ + - **D8 svc_access_live:`accessible_file_hits=1`**(**svc 直发 access 在真机 iOS arm64 实测能命中 400**,排除 D2 假阴性)✓ - D1 baseline_scan:`triggered=0 mask=0x0`(**非越狱聚合扫描零毒化** — §4.1 核心反向门槛)✓ - D2/D3:`reason400=0 reason401=0`,`jailbroken=no` ✓ - - 证据:`test-results/step12-device-poison/20261113-R/`(gitignore,不进库)。 -- [ ] **J 组待跑**(**阻塞:当前无越狱设备在线**)。越狱设备 `--expect jailbroken`,达标 §4.2,分「裸越狱 / 带 bypass」两档记录。 - R 组已证反向零误报;J 组只差一台越狱机证正向命中 400/401,harness 现成即插即跑。 + - 证据:`test-results/step12-device-poison/20261113-R-final/`(gitignore,不进库)。 +- [ ] **J 组无法执行(环境天花板:无越狱设备)**。残留缺口仅剩两项,均只能在越狱机证:① 真实越狱特征文件命中 400;② 沙盒逃逸 401。 + **已有替代证据把缺口收窄到最小**:D8 已证 svc-access 检测机制在真机活跃(命中逻辑真机可工作),R 组已证反向零误报。即「机制能命中 + 非越狱不误报」在真机成立,唯独缺「真越狱环境里的端到端正向」——补一台越狱机 `--expect jailbroken` 即可闭合,harness 现成。 - [ ] 达标后进入 docs/18 §5 灰度(observer 打点 → 开毒化)。 diff --git a/tests/fixtures/poison_device.m b/tests/fixtures/poison_device.m index 9dcaa6e..00b1a86 100644 --- a/tests/fixtures/poison_device.m +++ b/tests/fixtures/poison_device.m @@ -8,6 +8,9 @@ * D5 poison_mark_corrupt mark 后 apply 坏 key(out!=key)——证毒化真的生效 * D6 ctor_clean_start 进程启动未 mark 时 mask==0——证构造期初始化干净、无启动即毒化 * D7 policy_grades 合成 finding 复核分级(弱/单MEDIUM不触发;双MEDIUM/单STRONG触发) + * D8 svc_access_live 在自身沙盒建真实可访问文件,证 svc 直发 access(2) 在真机能命中 + * reason=400——坐实 D2 的 0 命中是「无越狱文件」而非「探针静默失败」, + * 无需越狱设备即可验证检测机制在 iOS arm64 上是活的。 * * B. 环境相关观察(不写死 PASS/FAIL,输出命中供人按 R/J 组判定,见 docs/19 §4): * D1 baseline_scan ig_policy_scan_and_mark(bundle) 的返回/mask @@ -143,6 +146,27 @@ int main(int argc, char **argv) { ig_poison_init(); } + /* ===== D8 svc_access_live:合成正向,不依赖越狱 ===== + * 非越狱设备上内置越狱表必然 0 命中——但那可能是「svc 直发在 iOS 上静默失败、 + * 永远返回 0」的假阴性。此例在自身沙盒 Documents 建一个真实可访问文件,喂给 + * ig_anti_jb_check_paths,确认 svc #0x80 access(2) 在真机 iOS arm64 上能真正命中 + * (reason=400)。坐实 D2 的 0 命中是「无越狱文件」而非「探针坏了」。环境无关不变量。 */ + { + reset_findings(); + NSString *docs = NSSearchPathForDirectoriesInDomains( + NSDocumentDirectory, NSUserDomainMask, YES).firstObject; + NSString *probe = [docs stringByAppendingPathComponent:@".ig_svc_live_probe"]; + [@"x" writeToFile:probe atomically:YES encoding:NSUTF8StringEncoding error:nil]; + const char *cpath = [probe fileSystemRepresentation]; + const char *paths[] = { cpath }; + ig_anti_jb_check_paths(paths, 1, NULL, collect, NULL); + int live = count_reason(IG_REASON_JAILBREAK_FILE); + [[NSFileManager defaultManager] removeItemAtPath:probe error:nil]; + char d[96]; snprintf(d, sizeof(d), "accessible_file_hits=%d svc_access_fires_on_device", live); + mark_case("svc_access_live", live >= 1, d); + reset_findings(); + } + /* ===== D2 jb_file(观察):内置越狱特征表直发 access ===== */ reset_findings(); ig_anti_jb_check(collect, NULL);