买了google pixel,重新学一遍安卓逆向。搞一搞frida。root跟着网上的教程来,不过中途挺曲折的,但是已经一个月前root的了,具体

就不记录了。(当初怎么忘记记录了啊!!)

LSPosed

安装此模块时发现未启用Zygisk,在Magisk中右上角设置,启用Zygisk即可。

MT管理器 NP管理器

adb install <电脑上的路径>

MT管理器存在activity记录的功能

adb 使用

https://blog.csdn.net/u010610691/article/details/77663770

开发者助手

进行apk资源分析

核心破解

可以解决同apk不同签名时安装失败的问题

算法助手

很牛逼的调试工具

可以进行动态插桩

log插桩流程

  1. 将插桩所用dex加进apk中,注意重命名,例如classes2.dex 序号要顺延

  2. 在需要插桩的位置(只能插桩寄存器)插入代码

    invoke-static {对应寄存器}, Lcom/mtools/LogUtils;->v(Ljava/lang/Object;)V
    1. 重新打包签名安装
    2. 在LSPosed中启用算法助手模块并启用当前apk,在算法助手中启用apk总开关并打开log捕获
    3. 运行应用
    4. 在算法助手中得到插桩结果

string@11207:”QVVHVlFUAAcMAQI=”

jeb动态调试

首先保证apk有调试权限android:debuggable=”true”

然后直接在本机运行程序,jeb附加即可

IDA动态调试

将android_server64 通过adb push进手机里

提一下权限,然后端口转发一下(本机的23946转发到手机里的23946)

之后运行server64,IDA更改ip为127.0.0.1然后附加调试就可以了

adb push <server64路径> /data/local/tmp
chmod 777 server64
adb forward tcp:23946 tcp:23946 %端口转发%
./server64
lsof | grep 23946 %查看谁监听了23946端口号%
kill -9 PID %杀死进程%

7.1 frida简单搭建

pip install frida-tools

https://github.com/frida/frida

下载好对应版本的frida_server

利用adb push 到/data/local/tmp中

su之后./frserver 运行服务端

之后进行端口转发

adb forward tcp:27042 tcp:27042

在本机终端输入frida-ps -U测试,如果出来的是手机的进程,则说明已经连接成功

编写js代码


function hookTest1() {
var test1 = Java.use("com.zj.wuaipojie.Demo");
test1.privateFunc.overload("java.lang.String").implementation = function (str) {
console.log("[*] privateFunc called with str: " + str);
var retval = this.privateFunc(str);
console.log("[*] privateFunc returned: " + retval);
return retval;
}
}

function main() {
Java.perform(function () {
hookTest1();
});
}
setImmediate(main);

然后注入

frida -U wuaipojie -l example.js

注入之后就可以在手机里触发逻辑了

native hook

CISCN2024 android_re

国赛时没买真机,一直用虚拟机,apk在虚拟机一直崩溃,在真机则可以正常运行(google pixel)

这里实现一下简单的native层hook


function hook() {
Java.perform(function () {
//根据导出函数名打印地址
var helloAddr = Module.findExportByName("libSecret_entrance.so", "Java_com_example_re11113_jni_getkey");
console.log(helloAddr);
if (helloAddr != null) {
//Interceptor.attach是Frida里的一个拦截器
Interceptor.attach(helloAddr, {
//onEnter里可以打印和修改参数
onEnter: function (args) { //args传入参数
},
//onLeave里可以打印和修改返回值

onLeave: function (retval) { //retval返回值
var string=Java.cast(retval, Java.use("java.lang.String"));
console.log("key:",string);

}
})
}
})
Java.perform(function () {
//根据导出函数名打印地址
var helloAddr = Module.findExportByName("libSecret_entrance.so", "Java_com_example_re11113_jni_getiv");
console.log(helloAddr);
if (helloAddr != null) {
//Interceptor.attach是Frida里的一个拦截器
Interceptor.attach(helloAddr, {
//onEnter里可以打印和修改参数
onEnter: function (args) { //args传入参数
},
//onLeave里可以打印和修改返回值
onLeave: function (retval) { //retval返回值
var string=Java.cast(retval, Java.use("java.lang.String"));
console.log("iv:",string);
}
})
}
})

}

function main() {
Java.perform(function () {
hook();
});
}
setImmediate(main);

https://www.52pojie.cn/thread-1840174-1-1.html

https://www.52pojie.cn/thread-1823118-1-1.html

安卓逆向这档事的文档