Frida Mobile Security — 逆向分析总控

SkillSecurity

For security reverse engineering of Android/iOS mobile apps: Frida dynamic instrumentation, bypassing anti-debugging/anti-injection/packing protections, unpacking, encryption and native SO-layer hooking, runtime behavior analysis, and jadx-mcp static attack surface analysis. Built-in toolchain: one-

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Frida Mobile Security — 逆向分析总控 skill

What this skill tells your AI

The instructions your AI receives, as published by index-login/mobilere-skill in .kilo/skill/frida-mobile-security/SKILL.md and read by ahel’s review.

模块优先,决策树驱动。 本文件是总控:任务路由 + 决策树导航 + 模块目录。各技巧域的详细打法在 references/ 分域文件,按需读取。

硬性规则:scripts/core/utils.js 必须作为第一个 -l 参数加载。


快速命令卡片

# 加解密自吐
frida -U -f com.app -l scripts/core/utils.js -l scripts/monitors/crypto_monitor.js

# 行为摸底
frida -U -f com.app -l scripts/core/utils.js -l scripts/monitors/file_monitor.js -l scripts/monitors/network_monitor.js -l scripts/monitors/thread_monitor.js

# 反检测 Phase 1 (保活 + 定位检测 so)
frida -U -f com.app -l scripts/core/utils.js -l scripts/bypass/exit_blocker.js -l scripts/bypass/so_loader_tracer.js

# HTTP 明文拦截
frida -U -f com.app -l scripts/core/utils.js -l scripts/monitors/ssl_plaintext.js

# Native 函数发现
frida -U -f com.app -l scripts/core/utils.js -l scripts/monitors/native_hooker.js

# 跨组件 Intent 污点追踪
frida -U -f com.app -l scripts/core/utils.js -l scripts/monitors/intent_tracker.js

# 内存敏感数据扫描 + 密码输入监听
frida -U -f com.app -l scripts/core/utils.js -l scripts/monitors/memory_scanner.js

运行时配置通过 -e 'var CONFIG_OVERRIDE={...}' 注入,见 §五。


一、任务路由

匹配用户意图 → 加载对应 references 分域 → 按决策树执行。不要逐章浏览。

意图关键词手法域名加载
"绕过检测" "过掉反调试" "挂上就闪退" "防注入" "加固壳" "SVC" "TracerPid" "GDB"环境对抗references/anti-detection.md
"脱壳" "加固解密" "提取 dex" "so 提取"脱壳references/unpacking.md默认 scripts/utils/unpack.py 一键跑;深挖/异常才用底层脚本
"加密明文" "算法" "密钥" "AES" "hook 方法" "修改参数" "伪造返回值" "SSL 证书" "TrustManager" "onReceivedSslError"加密/功能 hookreferences/crypto-hook.md
"看网络请求" "抓包" "还原协议" "行为摸底" "全程监控" "污点追踪" "内存扫描" "Intent" "Serializable"行为分析references/behavior-analysis.md
"分析这个类" "攻击面" "序列化" "WebView" "深链" "Provider" "反序列化"静态分析references/static-analysis.md
"分析这个 so" "native 函数" "so 里的加密" "字符串引用" "交叉引用" "逆向 so" "找不到导出"SO 层分析references/native-analysis.md
"模块无输出" "闪退" "ANR" "hook 不生效" "报错"故障诊断references/troubleshooting.md
"写自定义 hook" "API 用法" "Stalker" "RegisterNatives" "内存搜索"API 参考references/api-reference.md

前置判断:检测是否已绕过

用户是否已能稳定挂载 Frida?
├─ [否] "挂上就闪退" → 加载 anti-detection.md
├─ [是] 已用 hluda/魔改 frida/已跑过 exit_blocker → 跳过反检测,直接匹配任务
└─ [不确定] → 快速探路:utils + exit_blocker + so_loader_tracer
     ├─ exit_blocker 有 BLOCKED → 存在检测但已被保活 → 可继续
     └─ exit_blocker 无日志且进程正常 → 无检测 → 可继续

二、决策树导航

每种技巧在对应 references 有完整决策树,此处只给入口:

技巧域入口决策树详细
加密算法Step 1 crypto_monitor → Step 2 native_hooker → Step 3 network_monitorcrypto-hook.md
网络协议Step 1 network_monitor → 明文/密文分流behavior-analysis.md
行为摸底file + network + thread 三模块画像 → 按信号追加behavior-analysis.md
反检测Phase 1 保活 → 分支 A/B → Phase 2-6anti-detection.md
跨组件污点intent_tracker → 三链路对齐behavior-analysis.md
内存敏感数据memory_scanner 自动扫描 + 交互式搜索crypto-hook.md
SO 层分析分层下钻:Java → JNI → .so → libc → syscall → svcnative-analysis.md
静态攻击面攻击面枚举 → 逐类审查 → 序列化链路static-analysis.md

三、模块目录

scripts/ 下全部模块,按用途分类。utils.js 始终首个加载。

core/

模块用途
utils.js公共工具(日志格式化/hexdump/backtrace),必须首个加载

monitors/(被动观察,不修改行为)

模块用途归属
crypto_monitor.jsJava 层加解密自吐(算法/密钥/IV/明文)crypto-hook
native_crypto_monitor.jsOpenSSL/BoringSSL 加密监控crypto-hook
native_hooker.js任意 native 函数 hook(加密/发送/校验)native-analysis
ssl_plaintext.jsOkHttp/Retrofit HTTP 明文crypto-hook
memory_scanner.js内存敏感数据扫描 + 密码输入监听crypto-hook
file_monitor.js文件读写监控behavior-analysis
network_monitor.js网络连接/收发监控behavior-analysis
thread_monitor.js线程创建监控behavior-analysis
dl_monitor.jsSO 加载/卸载监控native-analysis
proc_monitor.js子进程/命令执行监控behavior-analysis
syscall_tracer.jssyscall 层追踪native-analysis
svc_tracer.jsSVC #0 指令追踪(Stalker)native-analysis
intent_tracker.js跨组件 Intent 污点追踪behavior-analysis

bypass/(主动干预,修改行为)

模块用途归属
exit_blocker.js拦截 exit_group/_exit/abort/kill/tgkill 保活anti-detection
thread_blocker.js阻断检测线程 pthread_createanti-detection
init_hook.jscall_constructors 抢时机(init_array 检测)anti-detection
frida_feature_hider.js隐藏 Frida 特征(/proc/线程/内存)anti-detection
function_patcher.js已知偏移 NOP patchanti-detection
shellcode_detector.js定位 mmap+PROT_EXEC shellcodeanti-detection
dlsym_tracer.js追踪运行时符号解析anti-detection
so_loader_tracer.js记录 do_dlopen 路径+基址anti-detection
root_bypass.jsRoot 检测绕过(File.exists/系统属性)anti-detection

utils/(SO/DEX 静态工具)

工具用途归属
unpack.py脱壳一键入口(线性流水线:回填+补充+自动pull+fix-checksum+去重+方法体标记)unpacking
so_dump.js内存 dump SO(脱壳提取)unpacking
dex_cache_dump.jsDexCache 精确 dump(免疫假 DEX/抹 magic)unpacking
dex_finder.js内存搜索 + 指纹校验 + 去重(备选:frida-dexdump 不可用时直接用)unpacking
dex_defineclass_dump.jsDefineClass 被动拦截 dumpunpacking
codeitem_dump.js二代壳提取:主动 loadClass 触发回填 + 整 DEX dumpunpacking
dex_rebuilder.py--fix-checksum 重算 checksum(默认操作)② CodeItem 离线重组回填unpacking
dex_dedupe.py产物去重/校验unpacking
find_strref.py字符串引用定位native-analysis
find_branch_callers.py交叉引用/调用者定位native-analysis
elfinfo.pyELF 侦察(段/依赖/导出/导入/重定位/vaddr↔offset,模拟 harness 前置)native-analysis
fix_elf.py修复 ELF headerunpacking
fix_axml.py修复爱加密魔改 AXML(Manifest 多 4 字节填充+headerSize 谎报 0x000C,jadx/apktool 无法解析时用)static-analysis
patch_gadget_threadnames.pypatch gadget 线程名native-analysis
scan_inline_svc.py扫描内联 SVC 指令native-analysis
scan_register_natives.js定位 native 方法实现(Dex2C 按需分析)native-analysis

templates/ + checklist/

文件用途
templates/analysis.pyPython 工作流模板(推荐,自动处理模块加载顺序)
templates/custom_hook.js自定义 hook 模板
checklist/webview_ssl_check.jsWebView SSL 检测清单
checklist/fridainject.jsfrida 环境检测项:注入后弹窗不出现/进程被杀 = 存在检测(验证注入是否成功)

四、分层分析原则

当上层 hook 失效时,按此递推下钻(完整方法见 native-analysis.md):

Java/ObjC → JNI/Runtime → Native .so → libc → syscall → SVC #0

常见下钻:crypto_monitor 无输出→native_hooker;file_monitor 无输出→syscall_tracer;network_monitor 无 connect→检查 recvfrom;dl_monitor 无输出→syscall_tracer(mmap+PROT_EXEC)。


五、运行时配置(CONFIG_OVERRIDE)

所有模块接受 CONFIG_OVERRIDE,通过 -e 或 Python dict 注入:

var CONFIG_OVERRIDE = {
    file_monitor:     { filterPath: ["/data/data/com.target/"] },
    network_monitor:  { showPayload: true },
    crypto_monitor:   { showStack: true },
    native_hooker:    { targetLibs: ["libencrypt.so"] },
    ssl_plaintext:    { urlFilter: ["api.example.com"] },
    exit_blocker:     { showBacktrace: false },
    init_hook:        { onModuleInit: [{ moduleName: "libDetect.so" }], probeCallers: true, autoHideFrida: true },
    thread_blocker:   { blockCallers: ["libmsaoaidsec.so"] },
    frida_feature_hider: { indirectHook: true },
};

各模块特有配置见对应 references 文件。


六、独立检测工具(前置,无需 Frida)

tools/ 下 bat 脚本,Agent 不能代跑,输出命令让用户自行执行(方便截图取证)。Python 工具可直接跑(python3 tools/janus_check.py ...python tools/debug-gdb.py ...,注意本机 python 可能是 Python 2,用 py -3)。

工具检测目标用法
check-anti-inject.bat防注入(ptrace + /proc/pid/mem)tools/check-anti-inject.bat <包名>
debug-gdb.py防调试(ptrace / TracerPid)py -3 tools/debug-gdb.py <包名>
check-janus.batAPK 元数据提取(GetAPKInfo.jar)tools/check-janus.bat <apk路径>
janus_check.pyJanus 备选检测:apksigner V1/V2/V3 签名验证(不解析 Manifest,免疫加固魔改)python3 tools/janus_check.py <apk路径>

首次分析新 App:check-janus → debug-gdb → check-anti-inject → Frida Phase 1。所有工具前置条件:root + SELinux Permissive。注意 debug-gdb.py 附加成功后目标若被反调试杀死,属于检测到反调试(正结论),非工具失败。

GetAPKInfo.jar 解析失败(爱加密等魔改 Manifest,报 0x000c0003)时,直接用 janus_check.py——经 apksigner 验证签名方案(V1+V2 通过 = Janus 安全),效果与 GetAPKInfo.jar 一致。


七、交互式协作流程

需要用户在 app 上手动操作时(点击按钮/切换页面触发行为):

配置 analysis.py(TIMEOUT=0 手动停止、LOG_TO_FILE=True 日志落盘)
→ 运行 → 用户操作 app → 停止 → 读日志 → 改 CUSTOM_HOOK_SCRIPT → 再运行

日志分析:读 .txt 日志,按时间戳锚定用户操作窗口,关联多模块信号。详见 references/behavior-analysis.md 交叉分析。


references 指引

场景读取
反检测 Pipeline / 经验模式 / 检测工具references/anti-detection.md
脱壳流程 / 壳识别 / 提取修复references/unpacking.md
加密决策树 / SSL/TLS / Hook 模板 / Python 工作流references/crypto-hook.md
行为摸底 / 网络协议 / 污点追踪 / 交叉分析references/behavior-analysis.md
攻击面枚举 / 序列化 / WebView / jadx-mcpreferences/static-analysis.md
SO 层分析 / Ghidra / unidbg / 分层下钻 / 字符串引用references/native-analysis.md
故障排查(无输出/闪退/init_hook 陷阱)references/troubleshooting.md
Frida API 手册(写自定义 hook 时)references/api-reference.md
参考文章索引(脱壳原理/攻击面方法论)references/articles.md

Signals

GitHub stars
27
Forks
9
Last commit
Sep 2026

ahel review

  • K1binfo
    installs-packages (in scripts/templates/analysis.py)
  • K1binfo
    installs-packages (in scripts/utils/elfinfo.py)

Automated review, not a security audit. Ruleset v1+k2.

Advanced
Catalog kind
skill
Gateway key
frida-mobile-security
Source
github.com/index-login/mobilere-skill