一个面向 Android APK Native SO 预筛选 的小工具。
核心目标不是"完整还原逻辑",而是作为逆向分析 / 安全审计前的前置探针,帮助你在一堆 arm64-v8a 的 .so 里,更快发现高价值目标。
ObfuScan 不是一个"全自动还原保护逻辑"的工具。
它更像一个审计前的前哨站:
- 帮你快速扫 APK 中所有 64 位 SO
- 给出简洁的中文风险摘要
- 按 高 / 中 / 低 风险排序
- 对高风险样本进一步展示关键入口预览
- 让你更快决定:
- 哪几个 SO 值得先看
- 哪些入口值得先下断点 / 先反汇编 / 先做动态跟踪
一句话总结:
先筛选,再深挖。
把有限的逆向时间优先花在更可能有价值的目标上。
-
启动 Web 服务器
cd ObfuScan python web_server.py -
访问 Web 界面
打开浏览器,访问 http://127.0.0.1:8080
-
上传 APK 并分析
- 点击"选择APK文件"按钮,选择要分析的APK文件
- 点击"开始分析"按钮
- 等待分析完成后查看结果
-
运行 ObfuScan
ObfuScan.exe <apk_path>
-
查看输出
命令行会输出 JSON 格式的分析结果,可直接重定向保存:
ObfuScan.exe app.apk > result.json
- CMake ≥ 3.14
- 支持 C++17 的编译器(GCC / Clang / MSVC)
- Git(用于自动拉取 Capstone 依赖)
git clone https://github.com/1998lixin/ObfuScan.git
cd ObfuScan
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release编译成功后,可执行文件位于:
- Windows:
build/Release/ObfuScan.exe - Linux / macOS:
build/ObfuScan
在 CMake 配置时添加链接器标志:
cmake .. -DCMAKE_EXE_LINKER_FLAGS="-static"如果你使用 CLion 2023+:
- 直接打开项目目录
- 等待 CMake 自动配置
- 选择 Release 配置并构建
ObfuScan 不依赖特征签名,而是采用多因子启发式评分:
| 检测因子 | 含义 | 加分条件(示例) |
|---|---|---|
| 段熵值 | 数据随机性(加密/压缩迹象) | 熵 > 7.0 |
| 分支密度 | 控制流复杂度 | > 12% |
| 间接跳转密度 | OLLVM / VMP 调度器特征 | > 5% |
| 算逻指令密度 | 代码膨胀程度 | > 40% |
| 入口可写段 | 自修改代码嫌疑 | 检测到即加分 |
| .init_array 异常 | 反调试 / 初始化入口数量 | > 20 个 |
| ZIP 伪装 SO | 二次打包容器 | 检测到即显著加分 |
最终分数归一化到 [0,1],并映射为:
- 高风险 ≥ 0.5
- 中风险 ≥ 0.2
- 低风险 < 0.2
完整评分逻辑可参阅源码 main.cpp 中的 analyze_elf() 函数。
自动枚举 APK 中的:
lib/arm64-v8a/*.so
支持提取和统计:
- ELF 文件头校验
- Program Header / Section Header
- .text / .rodata / .data / .init_array
- .dynsym / .dynstr
- 导入符号 / 导出符号
- 可执行段熵
- 大块高熵数据
- 是否裁剪符号表(strip)
对 .text 或可执行段进行线性反汇编,统计:
- 分支密度
- 间接跳转密度
- 算术 / 逻辑 / 比较类指令密度
用于辅助判断:
- 疑似 OLLVM
- 疑似强控制流混淆
- 疑似自定义保护逻辑
有些 APK 里的 .so 条目,实际上并不是裸 ELF,而是 ZIP 容器或二次包装资源。
ObfuScan 支持:
- 识别 ZIP 伪装 SO(检查
PK\x03\x04文件头) - 自动尝试提取内层 ELF
- 对内层 ELF 继续分析
对高风险 SO,会进一步尝试预览:
- ELF入口
- .init_array
- JNI_OnLoad
- Java_*
- 名称中包含 init / load / register 的导出函数
输出形式尽量保持简洁,方便快速人工判断。
默认输出为中文简洁结果,重点展示:
- SO 文件名
- 检测结果
- 风险等级
- 说明
- 可疑点
- 关键入口预览(高风险样本)
- 建议
适合在大量样本里先看重点,而不是一上来就被技术细节淹没。
通常可以按这个思路理解:
优先看。
这类目标往往更可能存在:
- 加壳 / loader
- 强混淆
- 可疑初始化逻辑
- 异常入口
- 值得深入跟踪的保护层
有一定可疑度,但未必真有强保护。适合结合具体业务背景决定是否深入。
通常更像普通发布版本、基础库、轻度混淆样本。一般不作为第一优先级。
目前来看,高风险样本的筛选价值相对更高。它的定位不是"百分百准确分类",而是:
尽量把更值得逆向的人先排到前面。
在这个意义上,高风险结果通常更有参考价值。
VMP 检测目前只是启发式参考,不保证准确。
原因很简单:
- 各种自研 VM 差异很大
- 一些强混淆、壳、linker 逻辑也会出现类似特征
- 静态线性反汇编本身就有局限
- 没有做完整的 dispatcher / handler / bytecode 数据流恢复
所以当前版本里:
- "疑似 VMP" = 值得重点看
- 不等于已经确认是 VMP
- "未见明显 VMP 特征" 也不等于绝对没有 VMP
建议把它理解为:一个帮助你优先级排序的辅助信号,而不是最终结论。
实际工作里,我更推荐这样用:
- 先用 ObfuScan 扫 APK(Web 界面或命令行)
- 重点看高风险样本
- 再看这些高风险样本的入口预览
- 选出最值得深入的几个 SO
- 再进入:
- IDA / Ghidra
- Frida / 自研 JNI 监控
- 动态跟踪 / 断点调试
- CFG / dispatcher / handler 深挖
这样通常会比一开始盲开几十上百个 SO 更省时间。
- 主要面向 Android 64 位 AArch64 SO(暂不支持 32 位 ARM)
- 不是完整反编译器
- OLLVM / 强混淆判断是启发式
- VMP 检测目前精度有限
- 对某些非常规壳 / 自研 VM / 深度伪装样本可能漏报或误报
- 当前更偏向"前置筛选"而不是"最终定性"
后面可能继续完善的方向包括:
- 接入 AI 辅助判断
- 更稳的入口函数深挖
- 更细的 dispatcher / handler 识别
- 基本块切分(递归反汇编)
- 更强的 OLLVM / flatten 检测
- 更严格的 VMP 结构级识别
- 更详细的可选 verbose 输出
- 批量 APK 目录扫描
这个工具更适合:
- 做 Android Native 逆向的人
- 做 APK 安全审计的人
- 需要批量初筛 SO 的研究人员
- 想先快速找高价值目标,再投入深度分析的人
欢迎任何形式的贡献!无论是:
- 报告 Bug 或提出新功能建议(Issues)
- 提交代码改进(Pull Request)
- 完善文档
请确保代码风格与现有代码保持一致,并在提交前通过编译测试。
本项目采用 MIT 许可证。详见 LICENSE 文件。
感谢以下项目 / 工具:
- GPT - 辅助开发与文案优化
- Capstone - 轻量级多架构反汇编引擎
- miniz - 单文件 ZIP 解压库
- LibChecker-Rules - 原生库识别规则
A lightweight tool for Android APK Native SO pre-screening.
The core goal is not to "completely restore logic", but to serve as a pre-probe before reverse analysis / security audit, helping you quickly find high-value targets among a bunch of arm64-v8a .so files.
- Project Positioning
- Quick Start
- Build from Source
- How It Works (Scoring Model)
- Currently Supported Capabilities
- How to Interpret Output Results
- About Accuracy
- Typical Usage Approach
- Current Known Limitations
- Possible Future Directions
- Who It's For
- Contributing
- License
- Acknowledgments
ObfuScan is not a "fully automatic protection logic restoration" tool.
It is more like an outpost before audit:
- Helps you quickly scan all 64-bit SOs in an APK
- Provides concise risk summaries (Chinese/English)
- Sorts by high / medium / low risk levels
- Further displays key entry previews for high-risk samples
- Helps you decide faster:
- Which SOs are worth looking at first
- Which entries are worth setting breakpoints / disassembling / dynamic tracking first
In a nutshell:
Screen first, then dig deeper.
Prioritize your limited reverse engineering time on targets that are more likely to be valuable.
-
Start the Web Server
cd ObfuScan python web_server.py -
Access the Web Interface
Open your browser and visit http://127.0.0.1:8080
-
Upload APK and Analyze
- Click the "Select APK File" button to choose the APK file to analyze
- Click the "Start Analysis" button
- Wait for the analysis to complete and view the results
-
Run ObfuScan
ObfuScan.exe <apk_path>
-
View / Save Output
ObfuScan.exe app.apk > result.json
- CMake ≥ 3.14
- C++17 compatible compiler (GCC / Clang / MSVC)
- Git (for automatic Capstone dependency fetch)
git clone https://github.com/1998lixin/ObfuScan.git
cd ObfuScan
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config ReleaseAfter a successful build, the executable will be located at:
- Windows:
build/Release/ObfuScan.exe - Linux / macOS:
build/ObfuScan
Add linker flags during CMake configuration:
cmake .. -DCMAKE_EXE_LINKER_FLAGS="-static"If you use CLion 2023+:
- Open the project directory directly
- Wait for CMake to auto-configure
- Select Release configuration and build
ObfuScan uses multi-factor heuristic scoring rather than signature matching:
| Factor | Meaning | Bonus Condition (example) |
|---|---|---|
| Segment entropy | Data randomness (encryption/compression) | Entropy > 7.0 |
| Branch density | Control flow complexity | > 12% |
| Indirect jump density | OLLVM / VMP dispatcher characteristic | > 5% |
| Arithmetic/logic density | Code bloat | > 40% |
| Entry in writable segment | Self-modifying code suspicion | Detected = +1.0 |
| Excessive .init_array entries | Anti-debug / initialization hooks | > 20 entries |
| ZIP disguised SO | Secondary packaging container | Significant bonus |
The final score is normalized to [0, 1] and mapped to:
- High ≥ 0.5
- Medium ≥ 0.2
- Low < 0.2
See analyze_elf() in main.cpp for the complete scoring logic.
Automatically enumerates:
lib/arm64-v8a/*.so
- ELF header verification
- Program / Section Headers
- .text / .rodata / .data / .init_array
- Symbol tables
- Segment entropy
- Stripped status
- Branch density
- Indirect jump density
- Arithmetic/logical/comparison instruction density
- Detects
PK\x03\x04magic header - Automatically extracts inner ELF for further analysis
- ELF entry
- .init_array
- JNI_OnLoad
- Java_*
- Other suspicious exported functions
File name, risk level, suspicious points, entry previews, recommendations
Priority viewing. Likely contains packing, strong obfuscation, or suspicious initialization.
Some suspicion; decide based on context.
Usually standard libraries or lightly obfuscated code.
The screening value for high-risk samples is relatively high. The goal is prioritization, not perfect classification.
VMP detection is heuristic only and not guaranteed. Self-developed VMs, strong obfuscation, and shell logic can produce similar static features. Treat it as a signal to investigate further, not a final verdict.
- Scan APK with ObfuScan
- Focus on high-risk samples
- Review entry previews
- Select top candidates for deep analysis in IDA / Ghidra / Frida
- Focuses on Android 64-bit AArch64 SO (32-bit not supported)
- Not a full decompiler
- OLLVM / strong obfuscation detection is heuristic
- VMP detection has limited accuracy
- May miss or false-alarm on unconventional shells / VMs
- AI-assisted scoring
- Deeper entry function analysis
- Basic block splitting (recursive disassembly)
- Stronger OLLVM / flatten detection
- Structural VMP identification
- Batch APK directory scanning
- Android Native reverse engineers
- APK security auditors
- Researchers needing batch SO pre-screening
Contributions are welcome! Please see CONTRIBUTING.md for guidelines (or simply open an Issue / PR).
This project is licensed under the MIT License. See the LICENSE file for details.
- GPT - Development assistance and documentation
- Capstone - Lightweight multi-architecture disassembly engine
- miniz - Single-file ZIP decompression library
- LibChecker-Rules - Native library identification rules