Files
iOSGuard/defender/anti_jailbreak/IGJailbreakPaths.inc
T
shenleiandClaude Opus 4.8 b76d7cdc21 harden(defender): docs/18 §7 抗静态分析硬化(符号隐藏/串混淆/副本分散/基线派生)
针对「纯客户端抗静态分析」的最高性价比项落地,守在 tests/test_static_hardening.py(6 条,gate 于 iphoneos SDK):

- 符号隐藏 + strip(§7.0 新增):IGVisibility.h 定 IG_INTERNAL=hidden,全库
  -fvisibility=hidden;仅四入口 ig_defender_scan/ig_poison_init/ig_poison_apply/
  ig_policy_scan_and_mark 标 IG_PUBLIC 保持导出,其余 ig_* 变 private external,
  链接后 strip -x 彻底消失——攻击者 nm 不再能按名定位 ig_poison_mark/mask 去 NOP。
- §7.1 串混淆:gen_jb_paths.py(唯一真源)生成 IGJailbreakPaths.inc /
  IGInjectSignatures.inc(XOR keystream,两表不共享 key),运行期解码进栈、用完擦除;
  decode 内 volatile key 屏障阻止 -O2 把常量折叠回 __const 明文。strings 已捞不到
  /var/jb、Cydia、substrate、gum-js-loop 等。--check 守 .inc 与清单同步。
- §7.2 副本分散:g_h0/h1/h2 置于不相邻命名段 __DATA,__ig_p0/p1/p2,加 __ig_pd 诱饵
  (mask 不读);刻意不用 TLS(会破坏跨线程毒化一致性)。
- §7.4 基线派生:删硬编码 0xA5C3F10E7B2D4968,改 ig_poison_baseline() 由拆分种子经
  volatile 屏障派生;otool -tV 已无旧魔数立即数。
- §7.3 OLLVM/VMP:仅留 build 的 IG_OBFUSCATOR hook,stock clang 无能力,需另备工具链(未完成)。
- §7.5 越狱设备正向验证仍阻塞(无设备)。

构建/快照同步:build_defender_lib.sh 加 -fvisibility=hidden + gen --check + IG_OBFUSCATOR
hook;build_poison_device.py 快照纳入 *.inc。全量 69 测试通过;poison_device.m 全模块
iphoneos 交叉编译通过(arm64)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-13 10:47:35 +09:00

29 lines
3.0 KiB
PHP

/* IGJailbreakPaths.inc — 由 tools/gen_jb_paths.py 生成,请勿手改。 */
/* 越狱路径 XOR 混淆表(§7.1):enc[j]=plain[j]^((K0+idx*K1+j*K2)&0xFF)。 */
#define IG_JB_XOR_K0 0x5au
#define IG_JB_XOR_K1 0x2fu
#define IG_JB_XOR_K2 0x13u
static const unsigned char kIGJbEnc0[] = { 0x75, 0x1b, 0xe1, 0xe1, 0x89, 0xd3, 0xae }; /* len=7 */
static const unsigned char kIGJbEnc1[] = { 0xa6, 0xdd, 0xdf, 0xb2, 0xb9, 0x81, 0x98, 0x6f, 0x55, 0x5d, 0x28, 0x34, 0x1e, 0xaf, 0xd0, 0xdf, 0xdd, 0xa5, 0xbe, 0xdc, 0x64, 0x68, 0x5b }; /* len=23 */
static const unsigned char kIGJbEnc2[] = { 0x97, 0x8a, 0xae, 0x81, 0x68, 0x7e, 0x49, 0x5c, 0x24, 0x0a, 0x19, 0xe7, 0xef, 0x80, 0x91, 0xbc, 0x84, 0x9e, 0x61, 0x0f, 0x55, 0x37, 0x2a }; /* len=23 */
static const unsigned char kIGJbEnc3[] = { 0xc8, 0xbb, 0x7d, 0x50, 0x5f, 0x2f, 0x3a, 0x0d, 0x0b, 0xfb, 0xca, 0xd6, 0xb8, 0xf1, 0xab, 0x61, 0x75, 0x58, 0x5c, 0x7e, 0x02, 0x06, 0xf9 }; /* len=23 */
static const unsigned char kIGJbEnc4[] = { 0x39, 0x5c, 0x4f, 0x3d, 0x4d, 0x06, 0xea, 0xf2, 0xc0, 0xee, 0xa7, 0x94, 0x92, 0x69 }; /* len=14 */
static const unsigned char kIGJbEnc5[] = { 0x6a, 0x2d, 0x18, 0x0c, 0xbe, 0xc6, 0xde, 0xa4, 0xf2, 0x83, 0x70, 0x7e }; /* len=12 */
static const unsigned char kIGJbEnc6[] = { 0x5b, 0xe5, 0xf3, 0xc3, 0xef, 0xb1, 0x87, 0x8a, 0x64 }; /* len=9 */
static const unsigned char kIGJbEnc7[] = { 0x8c, 0xd4, 0xa0, 0xb2, 0xc0, 0x71, 0x7d }; /* len=7 */
static const unsigned char kIGJbEnc8[] = { 0xfd, 0x80, 0x8c, 0x68, 0x31, 0x50, 0x34, 0x23 }; /* len=8 */
static const unsigned char kIGJbEnc9[] = { 0x2e, 0x64, 0x55, 0x53, 0x3b, 0x01, 0x07, 0xe3, 0xb6, 0xda, 0xde, 0xa0, 0xca, 0x94, 0x62, 0x7c, 0x1e, 0x25, 0x27, 0x1e }; /* len=20 */
static const unsigned char kIGJbEnc10[] = { 0x1f, 0x36, 0x25, 0x1b, 0x53, 0xe3, 0xcb, 0xd7, 0xe7, 0xa8, 0x9b, 0x63, 0x67, 0x53, 0x48, 0x2c, 0x14, 0x16 }; /* len=18 */
static const unsigned char kIGJbEnc11[] = { 0x70, 0x3e, 0xec, 0xfa, 0xd9, 0xdf, 0xa3, 0x9d, 0xd8, 0x47, 0x72, 0x52, 0x2a, 0x3a, 0x0c, 0x2f, 0xfa, 0xc0, 0xc6, 0xbc, 0xa9, 0x8f, 0x75, 0x71, 0x08, 0x77, 0x22, 0x02, 0x1a, 0xea, 0xfc, 0xff, 0xca, 0xb0, 0x96, 0x8c, 0x79, 0x7f, 0x45, 0x21, 0x79, 0x0e, 0x04, 0xfc, 0xca, 0xd4 }; /* len=46 */
static const unsigned char kIGJbEnc12[] = { 0xa1, 0xd4, 0xc7, 0xb5, 0xf5, 0x81, 0x69, 0x71, 0x09, 0x6d, 0x3b, 0x3a, 0x13, 0xee, 0xd1, 0xc5, 0xd4, 0xb4, 0x87, 0x83 }; /* len=20 */
static const struct { const unsigned char *b; unsigned char n; } kIGJbEnc[] = { { kIGJbEnc0, 7 }, { kIGJbEnc1, 23 }, { kIGJbEnc2, 23 }, { kIGJbEnc3, 23 }, { kIGJbEnc4, 14 }, { kIGJbEnc5, 12 }, { kIGJbEnc6, 9 }, { kIGJbEnc7, 7 }, { kIGJbEnc8, 8 }, { kIGJbEnc9, 20 }, { kIGJbEnc10, 18 }, { kIGJbEnc11, 46 }, { kIGJbEnc12, 20 } };
#define IG_JB_ENC_COUNT 13
/* 沙盒逃逸探测路径(idx 用一个与上表不冲突的独立下标)。 */
static const unsigned char kIGJbProbeEnc[] = { 0x8a, 0xc8, 0xb9, 0xb7, 0x87, 0x65, 0x63, 0x4f, 0x12, 0x7e, 0x0a, 0x11, 0xd6, 0xf6, 0xcd, 0x9d, 0xa5, 0x9a, 0x94, 0x6c, 0x44 }; /* len=21 */
#define IG_JB_PROBE_LEN 21
#define IG_JB_PROBE_IDX 0xa5