修改Dex
Using Frida on Android without root
修改so
[翻译]在未root的设备上使用frida
2个方法本质都是通过重打包让app自己加载frida-gadget.so
(但感觉没有谁家app会让人轻易重打包吧。。。)
apktool d org.telegram.messenger_4.8.4-12207.apk -rs
(-r,--no-res Do not decode resources.
-s,--no-src Do not decode sources.)
import lief
libnative = lief.parse("/Users/wiliam/temp/org.telegram.messenger_4.8.4-12207/lib/arm64-v8a/libtmessages.28.so")
libnative.add_library("libgadget.so") # Injection!
libnative.write("/Users/wiliam/temp/org.telegram.messenger_4.8.4-12207/lib/arm64-v8a/libtmessages.28.so")
执行前后对比:
mac
readelf.py -d org.telegram.messenger_4.8.4-12207/lib/arm64-v8a/libtmessages.28.so | grep NEEDED
linux有readelf
readelf -d ./libtmessages.28.so|grep NEEDED
到官网下载frida-gadget并重命名为libgadget.so
准备libgadget.config.so文件
{
"interaction": {
"type": "script",
"path": "/data/local/tmp/myscript.js",
"on_change": "reload"
}
}
一起放到arm64-v8a下
重打包并签名,安装
apktool b org.telegram.messenger_4.8.4-12207 -o my_new.apk
java -jar /Applications/uber-apk-signer-1.2.1.jar --apks my_new.apk
adb install my_new-aligned-debugSigned.apk
准备myscript.js文件
'use strict';
console.log("Waiting for Java..");
while(!Java.available) {
console.log("Not available...");
}
Java.perform(function () {
var Log = Java.use("android.util.Log");
Log.v("frida-lief", "I'm in the process!");
});
adb push到/data/local/tmp下
adb push myscript.js /data/local/tmp
打开app出现日志,成功
我试了Pixel Android8.1.0可以,Miui Android 11不行,不知道是不是路径不一致导致的
–
Pixel Android8.1.0上app路径是:
/data/app/org.telegram.messenger-3JOqehiK7XDEJ2TIc2DOVg==/lib
–
Miui上app的路径是
/data/app/~~88RoweeJkg1m32k1maESDw==/org.telegram.messenger-04jmp3aH5ri-GneXwPrZiw==/lib
–
是不是这个原因有没大佬知道的