【Android逆向】某小说网站签名破解

android,逆向,小说,网站,签名,破解 · 浏览次数 : 82

小编点评

**分析结果:** **错误信息:** ``` KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.559 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.559 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.559 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.559 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE ``` **问题:** 该代码调用了多个 Java API 来实现签名验证,但出现了以下错误: ``` KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.559 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.559 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign03-29 16:15:37.558 25910 26556 D KM-NATIVE ``` **解决方案:** 根据错误信息,可以确定代码调用了多个 Java API 来实现签名验证。建议您仔细检查代码中调用哪些 API,并确保它们在正常运行的情况下才能正常调用。

正文

1. 豌豆荚下载v5.4的版本

2. 参考前面两篇文章进行反编译和重打包后,安装到手机发现会有验签失败的报错

抓取log

03-29 16:15:37.545 25910 26539 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign
03-29 16:15:37.558 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign
03-29 16:15:37.559 25910 26556 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign

发现调取了这么个函数

3. 编写脚本查找这个native函数在哪个so里

var process_Obj_Module_Arr = Process.enumerateModules();
        for(var i = 0; i < process_Obj_Module_Arr.length; i++) {
            //包含"lib"字符串的
            if(process_Obj_Module_Arr[i].path.indexOf("lib")!=-1)
            {
                //console.log("模块名称:",process_Obj_Module_Arr[i].name);
                // console.log("模块地址:",process_Obj_Module_Arr[i].base);
                // console.log("大小:",process_Obj_Module_Arr[i].size);
                // console.log("文件系统路径",process_Obj_Module_Arr[i].path);

                var libname = process_Obj_Module_Arr[i].name
                frida_Module_import(libname)
            }
        }
		
function frida_Module_import(libname) {
    Java.perform(function () {
        const hooks = Module.load(libname);
        var Imports = hooks.enumerateImports();
        for(var i = 0; i < Imports.length; i++) {
            if (Imports[i].name.indexOf('Java_com_km_encryption') != -1) {
                console.log("模块名称:",libname); 

                //函数类型
                console.log("type:",Imports[i].type);
                //函数名称
                console.log("name:",Imports[i].name);
                //属于的模块
                console.log("module:",Imports[i].module);
                //函数地址
                console.log("address:",Imports[i].address); 
            }
         }
    });
}

发现在libcommon-encryption.so中

4. ida 打开看看

顺着sign,一路往下看,发现有个地方启动了一个线程,并执行了checkSignUseApplicationPackageManager方法

for ( i = 0; i < v34; ++i )
  {
	GetMethodID = (jmethodID (*)(JNIEnv *, jclass, const char *, const char *))&v37[2 * i];
	*(_BYTE *)GetMethodID = byte_1F620[(unsigned __int8)v35[i] >> 4];
	v47 = v35[i];
	*((_BYTE *)GetMethodID + 1) = byte_1F620[v47 & 0xF];
  }
  v37[2 * v34] = 0;
  _android_log_print(3, "KM-NATIVE", "PackageManager>>>sign: %s", v37);
  a1->functions->DeleteLocalRef((JNIEnv *)a1, v33);
  var10 = strcmp(v38, "846BB6E12205A3245D1E78C934EDA27EA02D5BD5");
  operator delete[](v38);
  if ( var10 )
  {
	v48 = "sign_check_sha1_error";
LABEL_95:
	throwException(a1, v48);
	return 0;
  }
  return 1;
}

对应的汇编代码

.text:00009082 FD F7 FA EF                   BLX             j__ZdaPv                ; operator delete[](void *)
.text:00009082
.text:00009086 00 2C                         CMP             R4, #0
.text:00009088 3F F4 B7 AE                   BEQ.W           loc_8DFA

把这里的CMP R4, #0改为CMP R4, R4,这样下一行就可以顺利跳转
借助反汇编工具https://armconverter.com/
image

通过010Editor 把这里改为A442即可
image'

再次打开APP,运行正常功能正常,成功绕过签名校验

与【Android逆向】某小说网站签名破解相似的内容:

【Android逆向】某小说网站签名破解

1. 豌豆荚下载v5.4的版本 2. 参考前面两篇文章进行反编译和重打包后,安装到手机发现会有验签失败的报错 抓取log 03-29 16:15:37.545 25910 26539 D KM-NATIVE: call Java_com_km_encryption_api_Security_sign

[Android 逆向]绕过小米需插卡安装apk限制

1. 确保自己手机是root的了 2. 给手机安装busybox,使可以用vi编辑文件 安装方法: 0. adb shell getprop ro.product.cpu.abi 获得 cpu架构信息 arm64-v8a 1. 下载 https://busybox.net/downloads/bin

【Android逆向】frida 破解 jwxdxnx02.apk

apk 路径: https://pan.baidu.com/s/1cUInoi 密码:07p9 这题比较简单,主要是用于练习frida 1. 安装apk到手机 需要输入账号密码 2. 使用jdax 查看apk package hfdcxy.com.myapplication; import andr

[Android逆向]Exposed 破解 jwxdxnx02.apk

使用exposed 遇到了一些坑,这里记录一下 源码: package com.example.exposedlesson01; import de.robv.android.xposed.IXposedHookLoadPackage; import de.robv.android.xposed.X

[Android 逆向]frida 破解 切水果大战原版.apk

1. 手机安装该apk,运行,点击右上角礼物 提示 支付失败,请稍后重试 2. apk拖入到jadx中,待加载完毕后,搜素失败,找到疑似目标类MymmPay的关键方法payResultFalse 4. adb logcat 或者androidstudio 查看该进程的日志,发现以下日志 com.mf

[Android 逆向]Xposed 破解 切水果大战原版.apk

代码 public class Main implements IXposedHookLoadPackage { boolean flag = false; @Override public void handleLoadPackage(XC_LoadPackage.LoadPackageParam

【Android逆向】frida 破解 滚动的天空

1. apk 安装到手机中 2. 玩十次之后,会提示 充值 3. adb shell dumpsys window | grep mCurrentFocus 查看一些当前activity是哪一个 是 AppActivity 4. 阅读代码,感觉是unity3d做的游戏 5. apk拖入到jadx中,

【Android逆向】滚动的天空中插入smali日志

1. 编写一个MyLog.java 放到一个android工程下,编译打包,然后反编译拿到MyLog的smali代码 package com.example.logapplication; import android.util.Log; public class MyLog { public st

【Android逆向】frida hook so 函数

1. apk来自52pojie 链接:https://pan.baidu.com/s/1vKC1SevvHfeI7f0d2c6IqQ 密码:u1an 2.apktool反编译apk,拿到so文件 java -jar ../apktool_2.2.4.jar d app-debug.apk 3. 用j

【Android逆向】修改so文件方式修改程序行为

1. 还是之前的那个apk 链接:https://pan.baidu.com/s/1vKC1SevvHfeI7f0d2c6IqQ 密码:u1an 尝试使用 010Editor来修改so文件 2. 使用ida打开so文件,双击 hello 52pojie!,会跳转到该字符串的偏移地址,ida显示是00