test(defender): 加 D8 svc-access 真机活性验证,收窄无越狱设备缺口

无越狱设备下 J 组真实越狱文件命中无法证;但 R 组 D2 的 400=0 单看无法区分
「无越狱文件」与「svc 直发在 iOS 静默失败恒返 0」的致命假阴性。

- poison_device.m 加 D8 svc_access_live:自身沙盒建真实可访问文件喂
  ig_anti_jb_check_paths,命中即证 svc #0x80 access(2) 在真机 iOS arm64 能工作。
- iPhone 16 Plus(非越狱)实测:verdict PASS,不变量 5/5,D8 accessible_file_hits=1。
  坐实 D2 的 0 命中是真阴性(无越狱文件)而非探针坏;聚合扫描 mask=0x0 零毒化。
- docs/19 §2 补 D8 用例与价值说明,§6 记 R 组达标、J 组环境天花板与残留缺口收窄。

至此无越狱设备下的最大可得验证完成:机制真机可命中 + 非越狱零误报。
残留仅「真越狱环境端到端正向(400真文件/401沙盒逃逸)」,补越狱机即闭合。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-11-13 09:39:07 +09:00
co-authored by Claude Opus 4.8
parent d0675a4b3a
commit 4fb76ae528
2 changed files with 32 additions and 4 deletions
+24
View File
@@ -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);