Engine Deep Dive · Kernel-Space Uprobes引擎详解 · 内核态探针
eBPF Engine
Kernel-level bpftrace uprobe capture with Android 10+ APEX libdexfile.so + libart.so discovery, UND/0x0 symbol filtering, per-symbol bpftrace -l verification, and safe offset fallback.
基于内核态 bpftrace uprobe 捕获 DEX 加载事件,支持 Android 10+ APEX libdexfile.so 与 libart.so 自动发现、UND/0x0 符号过滤、bpftrace -l 逐项验证与安全偏移回退。
APEX libdexfile.so FixAndroid 10+ APEX 适配
- On Android 10+,
DexFile&DexFileLoaderlive inlibdexfile.sowhilelibart.soonly holdsUNDimportsAndroid 10+ 起DexFile与DexFileLoader移至libdexfile.so,libart.so仅保留UND导入 - Discovers both APEX libraries automatically and strips
@@VERSIONtags自动发现两个 APEX 库,剔除UND/非FUNC/0x0并清理@@VERSION后缀 - Verified by dedicated regression suite (
tests/test_ebpf_engine.py)由独立回归测试集(tests/test_ebpf_engine.py)全程守护
Requirements运行前提
- Rooted device with Linux Kernel ≥ 5.4,
CONFIG_BPF, andCONFIG_UPROBES已 Root 设备,内核 ≥ 5.4 且启用CONFIG_BPF与CONFIG_UPROBES - Static
bpftracebinary pushed to/data/local/tmp/bpftrace推送静态bpftrace二进制至/data/local/tmp/bpftrace unpack dump app.apk -e ebpf
Practical Considerations实战注意事项
- Stock OEM kernels (e.g., Pixel Android 13 Kernel 5.10) may restrict user-space uprobe attachment部分厂商原厂内核可能限制用户态 uprobe 挂载,此时自动降级到偏移校验或回退 Memory 引擎
bpftraceJIT compilation takes ~5–8s at startupbpftrace启动编译 BPF 字节码约需 5–8 秒- Passive capture: combine with
unpack rescanfor lazy function-extracted methods被动捕获模式:对抗函数抽取壳可搭配unpack rescan增量触发