feat(defender): 可集成静态库 + readoor 接入方案(检测→分级→数据毒化闭环)
在 iOSGuard 侧产出可集成产物与接入文档,不修改 readoor 代码。 - defender/: anti_hook/anti_frida/anti_debug/anti_jailbreak 探针 + syscall 直发、 policy 分级层、poison 数据依赖毒化、dispatch/resolve/call_bridge 等子模块 - poison: 三副本冗余、无分支掩码;健康恒等、毒化破坏 key(替代 if-exit 处置) - policy: STRONG/MEDIUM/WEAK 分级,守误报底线,仅 DETECTED 参与、组合命中才毒化 - anti_jailbreak: IGSyscall 直发 svc 检测越狱文件(400)/沙盒逃逸(401),绕 libc hook - tools/build_defender_lib.sh: 一键交叉编译打包 libIGDefender.a(arm64) + umbrella 头 - docs/18_READOOR_DEFENDER_INTEGRATION.md: 精确到文件/bridging/替换点/代码片段 - docs/05-17 + evidence + tests + macho_guard/static_sdk_redirect 工具链 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ff0aee7f47
commit
599e1da5ce
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* IGAntiDebug.c — 调试器跟踪探针实现。
|
||||
* 全部逻辑在 syscall 模块(ig_sys_is_debugged,直发 svc + P_TRACED),
|
||||
* 这里只做三态到 IGFinding 的映射与上报。
|
||||
*/
|
||||
#include "IGAntiDebug.h"
|
||||
#include "syscall/IGSyscall.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int ig_anti_debug_check(IGFindingSink sink, void *ctx) {
|
||||
int traced = ig_sys_is_debugged();
|
||||
if (traced == 1) {
|
||||
IGFinding f;
|
||||
__builtin_memset(&f, 0, sizeof(f));
|
||||
f.status = IG_DETECTED;
|
||||
f.reason = IG_REASON_DEBUGGER_ATTACHED;
|
||||
snprintf(f.subject, sizeof(f.subject), "kinfo_proc.p_flag&P_TRACED");
|
||||
snprintf(f.evidence, sizeof(f.evidence), "直发 sysctl 检出进程被调试器跟踪");
|
||||
if (sink) sink(&f, ctx);
|
||||
return 1;
|
||||
}
|
||||
if (traced < 0) {
|
||||
IGFinding f;
|
||||
__builtin_memset(&f, 0, sizeof(f));
|
||||
f.status = IG_UNAVAILABLE;
|
||||
f.reason = IG_REASON_DEBUGGER_ATTACHED;
|
||||
snprintf(f.subject, sizeof(f.subject), "kinfo_proc.p_flag&P_TRACED");
|
||||
snprintf(f.evidence, sizeof(f.evidence), "sysctl 查询失败,无法判定");
|
||||
if (sink) sink(&f, ctx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* IGAntiDebug.h — 调试器跟踪探针(接入聚合扫描)。
|
||||
*
|
||||
* 复用 syscall 模块的 ig_sys_is_debugged():直发 sysctl 读 kinfo_proc 的
|
||||
* P_TRACED 位(公开 API 语义,docs/12 已在 lldb 下实测命中),此前该能力
|
||||
* 已实现但未进入 ig_defender_scan 聚合,策略层无从消费——本模块补上接线。
|
||||
* 三态映射:1 → DETECTED(300),0 → clear,-1 → UNAVAILABLE(300)。
|
||||
*/
|
||||
#ifndef IG_ANTI_DEBUG_H
|
||||
#define IG_ANTI_DEBUG_H
|
||||
|
||||
#include "IGDefender.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 调试器跟踪检测:只采集证据不处置(绝不自行 ptrace/exit)。返回 DETECTED 条数。 */
|
||||
int ig_anti_debug_check(IGFindingSink sink, void *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IG_ANTI_DEBUG_H */
|
||||
Reference in New Issue
Block a user