vmoveq
//8.0以下所有的so加载都通过dlopen
function hook_dlopen() {
  ...
多谢大佬指点。
我尝试过直接hook so的方法。但是会出现闪退,不知是不是本地frida版本的问题,我当前版本是 16.7.19。
下面是我的代码:
function startHook() {
Java.perform(function(){
console.log(">>>> Hello Frida>>>");
const dlopenFuc = Module.findExportByName(null, "android_dlopen_ext")
if (dlopenFuc)
{
console.log("Frida hook dlopenFuc succ !");
Interceptor.attach(dlopenFuc, {
onEnter: function (args) {
var pathptr = args[0];
if (pathptr !== undefined && pathptr != null) {
try {
this.path = ptr(pathptr).readCString();
console.log(`[!] dlopen so 触发: ${this.path}`);
} catch (e) {
console.error(`内存访问异常: ${e}`);
}
}
},
onLeave: function (retval) {
if (this.path == "libcocos.so") {
console.log(`[+] 目标库已加载: ${this.path}`);
}
}
});
}
})
}
setImmediate(startHook);
执行脚本挂载后会出现报错,并崩溃,详细信息如下:
Spawned `com.test.hellcc`. Resuming main thread!
[Android Emulator 5554::com.test.hellcc ]-> >>>> Hello Frida>>>
Frida hook dlopenFuc succ !
[!] dlopen so 触发: /system/lib64/arm64/nb/libtcb.so
Process crashed: Trace/BPT trap
***
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Android/aosp_marlin/marlin:9/PQ3A.190605.03202111/3793265:user/release-keys'
Revision: '0'
ABI: 'x86_64'
pid: 3515, tid: 3515, name: com.test.hellcc >>> com.test.hellcc <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
rax 0000000000000000 rbx 0000000000000dbb rcx 00007c79e5dadbf8 rdx 0000000000000006
r8 00007c79e9349190 r9 00007c79e9349190 r10 00007c79e9349190 r11 0000000000000246
r12 00007c79e9349948 r13 0000000000000000 r14 0000000000000dbb r15 00007c79e93498f8
rdi 0000000000000dbb rsi 0000000000000dbb
rbp 000062a1e0fb63f0 rsp 00007c79e93498e8 rip 00007c79e5dadbf8
backtrace:
#00 pc 0000000000026bf8 /system/lib64/libc.so (offset 0x26000) (syscall+24)
#01 pc 000000000002a7b5 /system/lib64/libc.so (offset 0x2a000) (abort+101)
#02 pc 0000000000000412 <anonymous:00007c79e5b7d000>
***