吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 73610|回复: 266
收起左侧

[Android 原创] 某手游反外挂分析

    [复制链接]
我是小三 发表于 2017-11-1 14:25
本帖最后由 我是小三 于 2017-11-1 14:40 编辑

个人博客: http://www.cnblogs.com/2014asm/
工具与环境:
IDA7.0
JEB2.2.5
Nexus5
Android4.4
目录
:一:app简单分析与java层反编译
二: compatible.so反调试与反反调试
三: compatible.so注册jni函数分析
四: stub.so反调试与反反调试
五: stub.so注册jni函数分析
六: Assembly-CSharp.dll解密分析
七: libengine模块分析
八:总结
一:app简单分析与java层反编译
整体图:

1

1

1.最近在学习手游保护方面的技术,本文是学习过程中分析某反外挂的一点记录,高手莫要见笑,有不对的地方还请指教,首先简单通过资源目录中文件名做基本了解,在lib目录中有libmono.so、libunity.so,资源目录中存在(assets\bin\Data\Managed\Assembly-CSharp.dll),应该是unity 3D编写,通过反编译发现该文件己被加密,在资源目录下armeabi文件夹中还存放着libengine.sox与libstub.sox文件,看名字猜测很可能这两个文件就是反外挂其中的一些模块了,在看看lib目录下只有libcompatible.so模块比较可疑。如下图所示:

2

2

3

3

4

4

当我们用调试器附加游戏程进时会有如下提示:

5

5


被发现有调试器附加,下节我们将分析它的反调试机制。2.通过JEB反编译来看看大致流程,反编译后先找到application类,代码如下图:

6

6

主要是加载so模块,so名称字符串被加密了,解密出来后so名称"compatible",将compatible.so放到IDA中反编译发现函数名被混淆了,字符串己加密,如下图:

7

7

通过以上简单分析,我们主要关注的重点关注的模块主要有lib目录下的libcompatible.so与资源目录中的libengine.sox与libstub.sox,还有就是发现java层的字符串与函数名都被混淆,so模块中的字符串也函数名也被混淆。3.拷贝资源,解密libstub.sox并加载 。在Lcom/inca/security/Core/AppGuardEngine初始函数<init>(Landroid/content/Context;Lcom/inca/security/AppGuard/AppGuardEventListener;Z)V中将判断X86或ARM平台并将对应的\assets\appguard中的libengine.sox、libstub.sox、update.dat拷贝到程序安装目录。JEB未能正常反编译出java代码,看smali代码。
[Asm] 纯文本查看 复制代码
:1946
00001946  const/4             v9, 3
00001948  if-ge               v6, v9, :1C16
:194C
0000194C  invoke-static       Binder->getABI()I
00001952  move-result         v6
00001954  move-object/from16  v0, p0
00001958  move-object/from16  v1, p1
0000195C  invoke-virtual      AppGuardEngine->iiIIIiiiIi(Context, I)Z, v0, v1, v6  # 拷贝资源
00001962  move-result         v6
00001964  if-eqz              v6, :1BE0
:1968
00001968  new-instance        v6, qb
0000196C  invoke-static       JNISoxProxy->getContext()Context
00001972  move-result-object  v9
00001974  invoke-direct       qb-><init>(Context)V, v6, v9
0000197A  const-string        v9, "fChY~_h\u0004yEr"  # libstub.sox
0000197E  invoke-virtual      qb->iiIIIiiiIi([B)V, v6, v8
00001984  invoke-static       b->iiIIIiiiIi(String)String, v9
0000198A  move-result-object  v9
0000198C  const-string        v10, "j\u000Fd\u0015r\u0013dHu\t"  # libstub.so
00001990  invoke-static       yb->iiIIIiiiIi(String)String, v10
00001996  move-result-object  v10
00001998  const/4             v11, 0
0000199A  invoke-virtual      qb->iiIIIiiiIi(String, String, [B)Z, v6, v9, v10, v11  # 解密libstub.sox((最终传入so层解密private static native byte[] iIiIIIiIiI(byte[] arg0, int arg1)))
000019A0  move-result         v6
000019A2  if-eqz              v6, :1BE0
:19A6
000019A6  new-instance        v6, File
000019AA  new-instance        v9, StringBuilder
000019AE  invoke-direct       StringBuilder-><init>()V, v9
000019B4  const/4             v10, 0
000019B6  invoke-static       JNISoxProxy->getContext()Context
000019BC  move-result-object  v11
000019BE  invoke-virtual      Context->getFilesDir()File, v11
000019C4  move-result-object  v11
000019C6  invoke-virtual      File->getAbsolutePath()String, v11
000019CC  move-result-object  v11
000019CE  invoke-virtual      StringBuilder->insert(I, String)StringBuilder, v9, v10, v11
000019D4  move-result-object  v9
000019D6  const-string        v10, "%FcHy^\u007FH$Ye"  # /libstub.so
000019DA  invoke-static       b->iiIIIiiiIi(String)String, v10
000019E0  move-result-object  v10
000019E2  invoke-virtual      StringBuilder->append(String)StringBuilder, v9, v10
000019E8  move-result-object  v9
000019EA  invoke-virtual      StringBuilder->toString()String, v9
000019F0  move-result-object  v9
000019F2  invoke-direct       File-><init>(String)V, v6, v9
000019F8  invoke-virtual      File->exists()Z, v6
:19FE
000019FE  move-result         v9
00001A00  if-eqz              v9, :1BE0
:1A04
00001A04  invoke-virtual      File->getAbsolutePath()String, v6
00001A0A  move-result-object  v9
00001A0C  invoke-static       System->load(String)V, v9  # 加载指定路径的SO
00001A12  invoke-direct/range AppGuardEngine->lllIIIlllI(Context)V, p0 .. p1  # 调用Native
:1A18
00001A18  invoke-virtual      File->delete()Z, v6
00001A1E  new-instance        v6, File
00001A22  new-instance        v9, StringBuilder
00001A26  invoke-direct       StringBuilder-><init>()V, v9
00001A2C  const/4             v10, 0
00001A2E  invoke-static       JNISoxProxy->getContext()Context
00001A34  move-result-object  v11
00001A36  invoke-virtual      Context->getFilesDir()File, v11
00001A3C  move-result-object  v11
00001A3E  invoke-virtual      File->getAbsolutePath()String, v11
00001A44  move-result-object  v11
00001A46  invoke-virtual      StringBuilder->insert(I, String)StringBuilder, v9, v10, v11
00001A4C  move-result-object  v9
00001A4E  const-string        v10, ")\no\u0004u\u0012s\u0004(\u0015i\u001E"  # /libstub.sox
00001A52  invoke-static       yb->iiIIIiiiIi(String)String, v10
00001A58  move-result-object  v10
00001A5A  invoke-virtual      StringBuilder->append(String)StringBuilder, v9, v10
00001A60  move-result-object  v9
00001A62  invoke-virtual      StringBuilder->toString()String, v9
00001A68  move-result-object  v9
00001A6A  invoke-direct       File-><init>(String)V, v6, v9
00001A70  invoke-virtual      File->delete()Z, v6

4. 解密libstub.sox模块。
解密函数在类com/inca/security/qb中iiIIIiiiIi函数,代码如下:
[Asm] 纯文本查看 复制代码
 @SuppressLint(value={"SdCardPath"}) public boolean iiIIIiiiIi(String arg25, String arg26, byte[] arg27) throws IOException, InvalidKeyException {
        Object v18;
        Object v5_2;
        long v16_1;
        Method v8_3;
        Class v11_2;
        Object v7_2;
        Object v4_7;
        Method v15;  // doFinal
        Method v14_1;  // init java.security.Key
        Object v13_1;  // RSA/ECB/PKCS1Padding
        int v8_1;
        int v7;
        FileInputStream v13;
        Method v4_6;
        byte[] v7_1;
        boolean v4_2;
        Method v5_1;  // read
        byte[] v12;
        byte[] v11;
        Object v10;  // /
        Class v9;  // java.io.FileInputStream
        try {
            v9 = Class.forName(vb.iiIIIiiiIi("&3:3b;#|\n; 7\u0005<<\'8\u00018 )3!"));  // java.io.FileInputStream
            Constructor v4_1 = v9.getConstructor(String.class);
            v10 = v4_1.newInstance(arg25.indexOf(yb.iiIIIiiiIi("I")) == 0 ? arg25 : new StringBuilder().insert(0, this.iiIiiiIIIi).append(arg25).toString());  // /
            v11 = new byte[16];
            v12 = new byte[4];
            v5_1 = v9.getMethod(vb.iiIIIiiiIi(" )3("), byte[].class, Integer.TYPE, Integer.TYPE);  // read
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(3));
            if(v11[0] == 83 && v11[1] == 79 && v11[2] == 88) {  // 判断开头是否为SOX
                goto label_82;
            }

            v4_2 = false;
            return v4_2;
        }
        catch(Exception v4) {
            goto label_78;
        }

    label_82:
        int v4_3 = 3;
        try {
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(2));
            if((((short)((((short)v11[0])) | (((short)v11[1])) << 8))) != 1) {
                return false;
            }

            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(1));
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(2));
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(2));
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(4));
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(4));
            v5_1.invoke(v10, v12, Integer.valueOf(0), Integer.valueOf(4));
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(12));
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(16));
            v5_1.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(16));
            byte[] v4_5 = null;
            if(v11[0] == 0 || v11[1] == 0 || v11[14] == 0 || v11[15] == 0) {
                v7_1 = v4_5;
                v4_6 = v5_1;
                goto label_291;
            label_276:
                while(v7 < 64) {
                    v13.read(v11);
                    if(v8_1 == v14) {
                        v4_5 = new byte[16];
                        System.arraycopy(v11, 0, v4_5, 0, 16);
                    }

                    v7 = v8_1 + 1;
                    v8_1 = v7;
                }

                v13.close();
                v7_1 = v4_5;
                v4_6 = v5_1;
            }
            else {
                File v8 = new File(String.format(yb.iiIIIiiiIi("CuI#\u0015(\u0012v\r"), arg25.substring(0, arg25.lastIndexOf(47)), qb.iiIIIiiiIi(v11)));  // %s/%s.tpk
                if(v8.exists()) {
                    v13 = new FileInputStream(v8);
                    v13.read(v11);
                    int v14 = (Math.abs(v11[0] << 24 | v11[4] << 16 | v11[8] << 8 | v11[12]) + 1) % 64;
                    v7 = 1;
                    v8_1 = 1;
                    goto label_276;
                }
                else {
                    return false;
                }
            }

        label_291:
            v4_6.invoke(v10, v11, Integer.valueOf(0), Integer.valueOf(4));
            v4_5 = new byte[(v11[3] & 255) << 24 | 0 | (v11[2] & 255) << 16 | (v11[1] & 255) << 8 | v11[0] & 255];
            v5_1 = v9.getMethod(vb.iiIIIiiiIi(" )3("), byte[].class);  // read
            v5_1.invoke(v10, v4_5);
            Class v8_2 = Class.forName(yb.iiIIIiiiIi("\fg\u0010g\u001E(\u0005t\u001Fv\u0012iHE\u000Fv\u000Ec\u0014"));  // javax.crypto.Cipher
            Method v11_1 = v8_2.getMethod(vb.iiIIIiiiIi("+78\u001B\"!83\"1)"), String.class);  // getInstance
            v13_1 = v11_1.invoke(null, yb.iiIIIiiiIi("T5GIC%DIV-E576g\u0002b\u000Fh\u0001"));  // RSA/ECB/PKCS1Padding
            v14_1 = v8_2.getMethod(vb.iiIIIiiiIi(";\";8"), Integer.TYPE, Class.forName(yb.iiIIIiiiIi("\fg\u0010gHu\u0003e\u0013t\u000Fr\u001F(-c\u001F")));  // init java.security.Key
            v14_1.invoke(v13_1, Integer.valueOf(2), this.iIiIIiIiIi);
            v15 = v8_2.getMethod(vb.iiIIIiiiIi("(=\n;\"3 "), byte[].class);  // doFinal
            v4_7 = v15.invoke(v13_1, v4_5);
            if(v7_1 != null) {
                v13_1 = v11_1.invoke(null, yb.iiIIIiiiIi("\'C5"));  // AES
                v14_1.invoke(v13_1, Integer.valueOf(2), Class.forName(vb.iiIIIiiiIi("&3:34|/ 5\"8=b!<7/|\u001F7/ )&\u000775\u0001<7/")).getConstructor(byte[].class, String.class).newInstance(v7_1, yb.iiIIIiiiIi("\'C5")));  // javax.crypto.spec.SecretKeySpec AES
                v4_7 = v15.invoke(v13_1, v4_7);
            }

            v7_2 = null;
            v7_2 = v11_1.invoke(v7_2, vb.iiIIIiiiIi("\r\u0017\u001F"));
            v14_1.invoke(v7_2, Integer.valueOf(2), Class.forName(yb.iiIIIiiiIi("\fg\u0010g\u001E(\u0005t\u001Fv\u0012iHu\u0016c\u0005(5c\u0005t\u0003r-c\u001FU\u0016c\u0005")).getConstructor(byte[].class, String.class).newInstance(v4_7, vb.iiIIIiiiIi("\r\u0017\u001F")));
            v11_2 = Class.forName(yb.iiIIIiiiIi("\fg\u0010gHo\t($\u007F\u0012c\'t\u0014g\u001FI\u0013r\u0016s\u0012U\u0012t\u0003g\u000B"));
            v13_1 = v11_2.getConstructor(null).newInstance(null);
            byte[] v14_2 = new byte[1024];
            v15 = v8_2.getMethod(vb.iiIIIiiiIi("\'<6-&)"), byte[].class, Integer.TYPE, Integer.TYPE);
            Method v16 = v11_2.getMethod(yb.iiIIIiiiIi("\u0011t\u000Fr\u0003"), byte[].class);
            for(v4_6 = v5_1; true; v4_6 = v5_1) {
                v4_3 = v4_6.invoke(v10, v14_2).intValue();
                if(v4_3 == -1) {
                    break;
                }

                v16.invoke(v13_1, v15.invoke(v7_2, v14_2, Integer.valueOf(0), Integer.valueOf(v4_3)));
            }

            v16.invoke(v13_1, v8_2.getMethod(vb.iiIIIiiiIi("(=\n;\"3 "), null).invoke(v7_2, null));
            v4_7 = v11_2.getMethod(yb.iiIIIiiiIi("\u0012i$\u007F\u0012c\'t\u0014g\u001F"), null).invoke(v13_1, null);
            if(arg25.indexOf(vb.iiIIIiiiIi("c")) != 0) {
                arg26 = new StringBuilder().insert(0, this.iiIiiiIIIi).append(arg26).toString();
            }

            Class v7_3 = Class.forName(yb.iiIIIiiiIi("l\u0007p\u0007(\u000FiH@\u000Fj\u0003I\u0013r\u0016s\u0012U\u0012t\u0003g\u000B"));
            v8_3 = v7_3.getMethod(vb.iiIIIiiiIi("; %&)"), byte[].class);
            v14_1 = v7_3.getMethod(yb.iiIIIiiiIi("\u0005j\tu\u0003"), null);
            v15 = v7_3.getMethod(vb.iiIIIiiiIi("*>9!$"), null);
            v7_2 = v7_3.getConstructor(String.class).newInstance(arg26);
            v16_1 = na.iIIIiiiIII(((byte[])v4_7), 5);
            v5_2 = null;
        }
        catch(Exception v4) {
            goto label_78;
        }

        try {
            v18 = Binder.getReserved1();
            if(v18 == null) {
                goto label_761;
            }
        }
        catch(Exception v4) {
            goto label_760;
        }

        try {
            v5_2 = v18.getClass().getMethod(yb.iiIIIiiiIi("o/o/O\u000Fo/o/"), byte[].class, Integer.TYPE).invoke(v18, v4_7, Integer.valueOf(((int)v16_1)));
        }
        catch(Exception v4) {
            try {
                v4.printStackTrace();
                goto label_659;
            label_761:
                byte[] v5_3 = AppGuardEngine.iiIIIiiiIi(((byte[])v4_7), ((int)v16_1));  // 传入SO层解密 (该Native函数在compatible.so进行动态注册)
            label_760:
            }
            catch(Exception v4) {
                goto label_760;
            }
        }

    label_659:
        v4_3 = 3;
        try {
            int v12_1 = v12[0] & 255 | ((v12[v4_3] & 255) << 24 | 0 | (v12[2] & 255) << 16 | (v12[1] & 255) << 8);
            Class v16_2 = Class.forName(vb.iiIIIiiiIi("&3:3b\'8; |6;<|\r6 7>a~"));
            Object v17 = v16_2.getConstructor(null).newInstance(null);
            v16_2.getMethod(yb.iiIIIiiiIi("s\u0016b\u0007r\u0003"), byte[].class, Integer.TYPE, Integer.TYPE).invoke(v17, v5_2, Integer.valueOf(0), Integer.valueOf(v5_2.length));
            v16_1 = v16_2.getMethod(vb.iiIIIiiiIi("5)&\u001A3 \')"), null).invoke(v17, null).longValue();
            if(v12_1 != 0 && v12_1 != (((int)v16_1))) {
                v14_1.invoke(v7_2, null);
                v4_2 = false;
            }
            else {
                v8_3.invoke(v7_2, v5_2);
                v15.invoke(v7_2, null);
                v14_1.invoke(v7_2, null);
                v9.getMethod(yb.iiIIIiiiIi("\u0005j\tu\u0003"), null).invoke(v10, null);
                v11_2.getMethod(vb.iiIIIiiiIi("/>#!)"), null).invoke(v13_1, null);
                v9.getMethod(yb.iiIIIiiiIi("\u0005j\tu\u0003"), null).invoke(v10, null);
                v4_2 = true;
            }

            return v4_2;
        }
        catch(Exception v4) {
        label_78:
            Exception v5_4 = v4;
            v4_2 = false;
            v5_4.printStackTrace();
            return v4_2;
        }
    }

java层AES解密再传入传入so层解密private static native byte[] iIiIIIiIiI(byte[] arg0, int arg1)。
5. 解密libengine.sox模块
在Lcom/inca/security/Core/AppGuardEngine;->iiIIIiiiIi([B)Z生成一个随机数后SHA1后字会串做为解密后的文件名存放在/data/data/包名/files/目录下,解密函数与上一步相同。
生成随机数代码:
[Asm] 纯文本查看 复制代码
.method private synthetic iiIIIiiiIi([B)Z
          .registers 12
          .annotation build SuppressLint
              value = {
                  "TrulyRandom"
              }
          .end annotation
          .annotation system Throws
              value = {
                  AppGuardException
              }
          .end annotation
00000000  const/4             v9, 2
00000002  const/16            v8, -0x007E
00000006  const/16            v7, 0x0030
0000000A  const/4             v2, 0
0000000C  const/4             v3, 1
:E
0000000E  const-string        v1, "U.GW"  # SHA1
00000012  invoke-static       yb->iiIIIiiiIi(String)String, v1
00000018  move-result-object  v1
0000001A  invoke-static       MessageDigest->getInstance(String)MessageDigest, v1
:20
00000020  move-result-object  v1
:22
00000022  new-instance        v4, SecureRandom
00000026  invoke-direct       SecureRandom-><init>()V, v4
0000002C  const/16            v5, 0x0100
00000030  new-array           v5, v5, [B
00000034  const/16            v6, 0x0126
00000038  invoke-virtual      SecureRandom->nextBytes([B)V, v4, v5
0000003E  invoke-virtual      MessageDigest->update([B)V, v1, v5
00000044  invoke-virtual      SecureRandom->nextBytes([B)V, v4, v5
0000004A  invoke-virtual      MessageDigest->update([B)V, v1, v5
00000050  new-instance        v4, BigInteger
00000054  invoke-virtual      MessageDigest->digest()[B, v1
0000005A  move-result-object  v1
0000005C  invoke-direct       BigInteger-><init>(I, [B)V, v4, v3, v1
00000062  const/16            v1, 0x0010
00000066  invoke-virtual      BigInteger->toString(I)String, v4, v1  # 随机数后SHA1值
0000006C  move-result-object  v1
0000006E  iput-object         v1, p0, AppGuardEngine->IiIIiiiiii_Random_SHA1:String  # 解密后文件名
//解密并调用
00000D7A  new-instance        v4, qb
00000D7E  invoke-static       JNISoxProxy->getContext()Context
00000D84  move-result-object  v5
00000D86  invoke-direct       qb-><init>(Context)V, v4, v5
00000D8C  const-string        v5, "fChOdMcDo\u0004yEr"  # libengine.sox
00000D90  invoke-virtual      qb->iiIIIiiiIi([B)V, v4, v1
00000D96  invoke-static       b->iiIIIiiiIi(String)String, v5
00000D9C  move-result-object  v1
00000D9E  iget-object         v5, p0, AppGuardEngine->IiIIiiiiii_Random_SHA1:String
00000DA2  const/4             v6, 0
00000DA4  invoke-virtual      qb->iiIIIiiiIi(String, String, [B)Z, v4, v1, v5, v6  # 解密libengine.sox(最终传入so层解密private static native byte[] iIiIIIiIiI(byte[] arg0, int arg1))
:DAA
00000DAA  move-object         v0, p0
:DAC
00000DAC  invoke-static       JNISoxProxy->getContext()Context
00000DB2  move-result-object  v1
00000DB4  new-instance        v4, StringBuilder
00000DB8  invoke-direct       StringBuilder-><init>()V, v4
00000DBE  invoke-static       JNISoxProxy->getContext()Context
00000DC4  move-result-object  v5
00000DC6  invoke-virtual      Context->getFilesDir()File, v5
00000DCC  move-result-object  v5
00000DCE  invoke-virtual      File->getAbsolutePath()String, v5
00000DD4  move-result-object  v5
00000DD6  invoke-virtual      StringBuilder->insert(I, String)StringBuilder, v4, v2, v5
00000DDC  move-result-object  v4
00000DDE  const-string        v5, "%"  # /
00000DE2  invoke-static       b->iiIIIiiiIi(String)String, v5
00000DE8  move-result-object  v5
00000DEA  invoke-virtual      StringBuilder->append(String)StringBuilder, v4, v5
00000DF0  move-result-object  v4
00000DF2  iget-object         v5, p0, AppGuardEngine->IiIIiiiiii_Random_SHA1:String
00000DF6  invoke-virtual      StringBuilder->append(String)StringBuilder, v4, v5
00000DFC  move-result-object  v4
00000DFE  invoke-virtual      StringBuilder->toString()String, v4
00000E04  move-result-object  v4
00000E06  invoke-direct       AppGuardEngine->IIIIIIIlIl(Context, String, [B)I, v0, v1, v4, p1  # 将解密后将libengine文件路径传入该Native函数中调用
00000E0C  move-result         v1
00000E0E  if-gez              v1, :E9A

解密后的so会在Native函数中通过dlopen、dlsym来调用。
二: compatible.so反调试与反反调试
1. 反调试 (文件偏移 13284)
[Asm] 纯文本查看 复制代码
.text:757DB284             loc_757DB284                            ; CODE XREF: JNI_OnLoad+254↑j
.text:757DB284 00 00 5C E3 CMP     R12, #0
.text:757DB288 18 00 00 BA BLT     loc_757DB2F0
.text:757DB28C 00 30 68 E2 RSB     R3, R8, #0
.text:757DB290 03 00 20 E0 EOR     R0, R0, R3
.text:757DB294 08 80 80 E0 ADD     R8, R0, R8
.text:757DB298 0D 00 58 E3 CMP     R8, #0xD                        ; 判断SDK版本
.text:757DB29C 9F FF FF DA BLE     loc_757DB120
.text:757DB2A0
.text:757DB2A0             loc_757DB2A0                            ; CODE XREF: JNI_OnLoad+2E4↓j
.text:757DB2A0 7D 2B 00 EB BL      _Z11lIlIlIIIIIIv                ; 创建3进程和多线程反调试
.text:757DB2A4 00 20 50 E2 SUBS    R2, R0, #0                      ; char *

如果SDK大于0XD时就创建3进程与多线程反调试:
[Asm] 纯文本查看 复制代码
.text:756F84B0             EXPORT _Z11IIIIIIIllllv
.text:756F84B0             _Z11IIIIIIIllllv                        ; CODE XREF: JNI_OnLoad:loc_756EE6E4↑p
.text:756F84B0
.text:756F84B0             var_2C= -0x2C
.text:756F84B0             var_28= -0x28
.text:756F84B0             var_24= -0x24
.text:756F84B0             var_20= -0x20
.text:756F84B0
.text:756F84B0             ; __unwind {
.text:756F84B0 F0 43 2D E9 STMFD   SP!, {R4-R9,LR}
.text:756F84B4 C0 43 9F E5 LDR     R4, =(_GLOBAL_OFFSET_TABLE_ - 0x756F84C8)
.text:756F84B8 C0 23 9F E5 LDR     R2, =(__stack_chk_guard_ptr - 0x7572FED0)
.text:756F84BC C0 33 9F E5 LDR     R3, =(_ZN6Global10lIlIIllIIlE_ptr - 0x7572FED0)
.text:756F84C0 04 40 8F E0 ADD     R4, PC, R4                      ; _GLOBAL_OFFSET_TABLE_
.text:756F84C4 02 70 94 E7 LDR     R7, [R4,R2]
.text:756F84C8 14 D0 4D E2 SUB     SP, SP, #0x14
.text:756F84CC 00 20 97 E5 LDR     R2, [R7]
.text:756F84D0 0C 20 8D E5 STR     R2, [SP,#0x30+var_24]
.text:756F84D4 03 60 94 E7 LDR     R6, [R4,R3]
.text:756F84D8 06 00 A0 E1 MOV     R0, R6                          ; int *
.text:756F84DC 72 F2 FF EB BL      pipi
.text:756F84E0 00 00 50 E3 CMP     R0, #0
.text:756F84E4 13 00 00 BA BLT     loc_756F8538
.text:756F84E8 08 00 86 E2 ADD     R0, R6, #8                      ; int *
.text:756F84EC 6E F2 FF EB BL      pipi
.text:756F84F0 00 00 50 E3 CMP     R0, #0
.text:756F84F4 0F 00 00 BA BLT     loc_756F8538
.text:756F84F8 48 00 86 E2 ADD     R0, R6, #0x48                   ; int *
.text:756F84FC 6A F2 FF EB BL      pipi
.text:756F8500 00 00 50 E3 CMP     R0, #0
.text:756F8504 0B 00 00 BA BLT     loc_756F8538
.text:756F8508 30 00 86 E2 ADD     R0, R6, #0x30                   ; int *
.text:756F850C 66 F2 FF EB BL      pipi
.text:756F8510 00 00 50 E3 CMP     R0, #0
.text:756F8514 07 00 00 BA BLT     loc_756F8538
.text:756F8518 38 00 86 E2 ADD     R0, R6, #0x38                   ; int *
.text:756F851C 62 F2 FF EB BL      pipi
.text:756F8520 00 00 50 E3 CMP     R0, #0
.text:756F8524 03 00 00 BA BLT     loc_756F8538
.text:756F8528 40 00 86 E2 ADD     R0, R6, #0x40                   ; int *
.text:756F852C 5E F2 FF EB BL      pipi
.text:756F8530 00 00 50 E3 CMP     R0, #0
.text:756F8534 01 00 00 AA BGE     loc_756F8540
.text:756F8538
.text:756F8538             loc_756F8538                            ; CODE XREF: IIIIIIIllll(void)+34↑j
.text:756F8538                                                     ; IIIIIIIllll(void)+44↑j ...
.text:756F8538 00 00 A0 E3 MOV     R0, #0                          ; int
.text:756F853C 4E F2 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F8540
.text:756F8540             loc_756F8540                            ; CODE XREF: IIIIIIIllll(void)+84↑j
.text:756F8540 01 10 A0 E3 MOV     R1, #1
.text:756F8544 04 00 A0 E3 MOV     R0, #4                          ; option
.text:756F8548 AF CB FF EB BL      prctl
.text:756F854C 72 F2 FF EB BL      getpid_0
.text:756F8550 30 33 9F E5 LDR     R3, =(_ZN6Global10lIllllIllIE_ptr - 0x7572FED0)
.text:756F8554 03 50 94 E7 LDR     R5, [R4,R3]
.text:756F8558 00 00 85 E5 STR     R0, [R5]                        ; Global::lIllllIllI
.text:756F855C 60 F2 FF EB BL      fork
.text:756F8560 01 00 70 E3 CMN     R0, #1
.text:756F8564 04 00 85 E5 STR     R0, [R5,#(dword_757309F4 - 0x757309F0)]
.text:756F8568 92 00 00 0A BEQ     loc_756F87B8
.text:756F856C
.text:756F856C             loc_756F856C                            ; CODE XREF: IIIIIIIllll(void)+314↓j
.text:756F856C 00 00 50 E3 CMP     R0, #0
.text:756F8570 34 00 00 DA BLE     loc_756F8648
.text:756F8574 00 80 A0 E3 MOV     R8, #0
.text:756F8578 01 90 A0 E3 MOV     R9, #1
.text:756F857C 08 33 9F E5 LDR     R3, =(_ZN6Global10IIlIIlIIlIE_ptr - 0x7572FED0)
.text:756F8580 10 10 8D E2 ADD     R1, SP, #0x30+var_20
.text:756F8584 38 00 96 E5 LDR     R0, [R6,#(dword_75730EBC - 0x75730E84)] ; int
.text:756F8588 03 30 94 E7 LDR     R3, [R4,R3]
.text:756F858C 04 20 A0 E3 MOV     R2, #4                          ; unsigned int
.text:756F8590 10 80 21 E5 STR     R8, [R1,#-0x10]!
.text:756F8594 00 90 C3 E5 STRB    R9, [R3]                        ; Global::IIlIIlIIlI
.text:756F8598 7B F2 FF EB BL      read
.text:756F859C EC 12 9F E5 LDR     R1, =(_ZN6Global6ThreadE_ptr - 0x7572FED0)
.text:756F85A0 EC 22 9F E5 LDR     R2, =(_Z10IlIIlllIIlPv_ptr - 0x7572FED0)
.text:756F85A4 04 30 85 E2 ADD     R3, R5, #4                      ; void *
.text:756F85A8 01 60 94 E7 LDR     R6, [R4,R1]
.text:756F85AC 02 20 94 E7 LDR     R2, [R4,R2]                     ; void *(__cdecl *)(void *)
.text:756F85B0 08 10 A0 E1 MOV     R1, R8                          ; pthread_attr_t *
.text:756F85B4 06 00 A0 E1 MOV     R0, R6                          ; int *
.text:756F85B8 6D F1 FF EB BL      pthread_create_0
.text:756F85BC 08 00 50 E1 CMP     R0, R8
.text:756F85C0 80 00 00 BA BLT     loc_756F87C8
.text:756F85C4
.text:756F85C4             loc_756F85C4                            ; CODE XREF: IIIIIIIllll(void)+334↓j
.text:756F85C4 CC 32 9F E5 LDR     R3, =(_Z10IIlIlllllIPv_ptr - 0x7572FED0)
.text:756F85C8 04 00 86 E2 ADD     R0, R6, #4                      ; int *
.text:756F85CC 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F85D0 03 20 94 E7 LDR     R2, [R4,R3]                     ; void *(__cdecl *)(void *)
.text:756F85D4 09 30 A0 E3 MOV     R3, #9                          ; void *
.text:756F85D8 65 F1 FF EB BL      pthread_create_0
.text:756F85DC 00 00 50 E3 CMP     R0, #0
.text:756F85E0 6C 00 00 BA BLT     loc_756F8798
.text:756F85E4
.text:756F85E4             loc_756F85E4                            ; CODE XREF: IIIIIIIllll(void)+304↓j
.text:756F85E4 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F85E8 AC 22 9F E5 LDR     R2, =(_Z11IIIlllIIIIIPv_ptr - 0x7572FED0)
.text:756F85EC 01 30 A0 E1 MOV     R3, R1                          ; void *
.text:756F85F0 02 20 94 E7 LDR     R2, [R4,R2]                     ; void *(__cdecl *)(void *)
.text:756F85F4 10 00 86 E2 ADD     R0, R6, #0x10                   ; int *
.text:756F85F8 5D F1 FF EB BL      pthread_create_0
.text:756F85FC 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F8600 98 22 9F E5 LDR     R2, =(_Z11IIIlIIlIllIPv_ptr - 0x7572FED0)
.text:756F8604 01 30 A0 E1 MOV     R3, R1                          ; void *
.text:756F8608 02 20 94 E7 LDR     R2, [R4,R2]                     ; void *(__cdecl *)(void *)
.text:756F860C 04 00 8D E2 ADD     R0, SP, #0x30+var_2C            ; int *
.text:756F8610 57 F1 FF EB BL      pthread_create_0
.text:756F8614 88 32 9F E5 LDR     R3, =(_Z10IIllIIlIlIPv_ptr - 0x7572FED0)
.text:756F8618 08 00 8D E2 ADD     R0, SP, #0x30+var_28            ; int *
.text:756F861C 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F8620 03 20 94 E7 LDR     R2, [R4,R3]                     ; void *(__cdecl *)(void *)
.text:756F8624 01 30 A0 E3 MOV     R3, #1                          ; void *
.text:756F8628 51 F1 FF EB BL      pthread_create_0
.text:756F862C
.text:756F862C             loc_756F862C                            ; CODE XREF: IIIIIIIllll(void)+250↓j
.text:756F862C 0C 20 9D E5 LDR     R2, [SP,#0x30+var_24]
.text:756F8630 00 30 97 E5 LDR     R3, [R7]
.text:756F8634 01 00 A0 E3 MOV     R0, #1
.text:756F8638 03 00 52 E1 CMP     R2, R3
.text:756F863C 8D 00 00 1A BNE     loc_756F8878
.text:756F8640 14 D0 8D E2 ADD     SP, SP, #0x14
.text:756F8644 F0 83 BD E8 LDMFD   SP!, {R4-R9,PC}
.text:756F8648             ; ---------------------------------------------------------------------------
.text:756F8648
.text:756F8648             loc_756F8648                            ; CODE XREF: IIIIIIIllll(void)+C0↑j
.text:756F8648 72 CB FF EB BL      getpid
.text:756F864C 04 00 85 E5 STR     R0, [R5,#(dword_757309F4 - 0x757309F0)]
.text:756F8650 23 F2 FF EB BL      fork
.text:756F8654 04 10 85 E2 ADD     R1, R5, #4                      ; void *
.text:756F8658 08 00 85 E5 STR     R0, [R5,#(dword_757309F8 - 0x757309F0)]
.text:756F865C 04 20 A0 E3 MOV     R2, #4                          ; unsigned int
.text:756F8660 3C 00 96 E5 LDR     R0, [R6,#(dword_75730EC0 - 0x75730E84)] ; int
.text:756F8664 56 F2 FF EB BL      write_0
.text:756F8668 08 30 95 E5 LDR     R3, [R5,#(dword_757309F8 - 0x757309F0)]
.text:756F866C 01 00 73 E3 CMN     R3, #1
.text:756F8670 64 00 00 0A BEQ     loc_756F8808
.text:756F8674
.text:756F8674             loc_756F8674                            ; CODE XREF: IIIIIIIllll(void)+364↓j
.text:756F8674 00 00 53 E3 CMP     R3, #0
.text:756F8678 01 00 A0 E3 MOV     R0, #1                          ; option
.text:756F867C 09 10 A0 E3 MOV     R1, #9
.text:756F8680 1F 00 00 DA BLE     loc_756F8704
.text:756F8684 60 CB FF EB BL      prctl
.text:756F8688 00 12 9F E5 LDR     R1, =(_ZN6Global6ThreadE_ptr - 0x7572FED0)
.text:756F868C 00 22 9F E5 LDR     R2, =(_Z10IlIIlllIIlPv_ptr - 0x7572FED0)
.text:756F8690 08 30 85 E2 ADD     R3, R5, #8                      ; void *
.text:756F8694 01 60 94 E7 LDR     R6, [R4,R1]
.text:756F8698 02 20 94 E7 LDR     R2, [R4,R2]                     ; void *(__cdecl *)(void *)
.text:756F869C 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F86A0 06 00 A0 E1 MOV     R0, R6                          ; int *
.text:756F86A4 32 F1 FF EB BL      pthread_create_0
.text:756F86A8 00 00 50 E3 CMP     R0, #0
.text:756F86AC 59 00 00 BA BLT     loc_756F8818
.text:756F86B0
.text:756F86B0             loc_756F86B0                            ; CODE XREF: IIIIIIIllll(void)+384↓j
.text:756F86B0 E0 31 9F E5 LDR     R3, =(_Z10IIlIlllllIPv_ptr - 0x7572FED0)
.text:756F86B4 04 00 86 E2 ADD     R0, R6, #4                      ; int *
.text:756F86B8 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F86BC 03 20 94 E7 LDR     R2, [R4,R3]                     ; void *(__cdecl *)(void *)
.text:756F86C0 01 30 A0 E3 MOV     R3, #1                          ; void *
.text:756F86C4 2A F1 FF EB BL      pthread_create_0
.text:756F86C8 00 00 50 E3 CMP     R0, #0
.text:756F86CC 45 00 00 BA BLT     loc_756F87E8
.text:756F86D0
.text:756F86D0             loc_756F86D0                            ; CODE XREF: IIIIIIIllll(void)+354↓j
.text:756F86D0 CC 31 9F E5 LDR     R3, =(_Z10IIllIIlIlIPv_ptr - 0x7572FED0)
.text:756F86D4 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F86D8 03 20 94 E7 LDR     R2, [R4,R3]                     ; void *(__cdecl *)(void *)
.text:756F86DC 02 30 A0 E3 MOV     R3, #2                          ; void *
.text:756F86E0 08 00 8D E2 ADD     R0, SP, #0x30+var_28            ; int *
.text:756F86E4
.text:756F86E4             loc_756F86E4                            ; CODE XREF: IIIIIIIllll(void)+2E4↓j
.text:756F86E4 22 F1 FF EB BL      pthread_create_0
.text:756F86E8 08 00 9D E5 LDR     R0, [SP,#0x30+var_28]           ; int
.text:756F86EC 00 10 A0 E3 MOV     R1, #0                          ; void **
.text:756F86F0 A9 F1 FF EB BL      pthread_join
.text:756F86F4 00 00 96 E5 LDR     R0, [R6]                        ; int
.text:756F86F8 00 10 A0 E3 MOV     R1, #0                          ; void **
.text:756F86FC A6 F1 FF EB BL      pthread_join
.text:756F8700 C9 FF FF EA B       loc_756F862C
.text:756F8704             ; ---------------------------------------------------------------------------
.text:756F8704
.text:756F8704             loc_756F8704                            ; CODE XREF: IIIIIIIllll(void)+1D0↑j
.text:756F8704 40 CB FF EB BL      prctl
.text:756F8708 03 F2 FF EB BL      getpid_0
.text:756F870C 05 10 A0 E1 MOV     R1, R5
.text:756F8710 04 20 A0 E3 MOV     R2, #4                          ; unsigned int
.text:756F8714 08 00 A1 E5 STR     R0, [R1,#(dword_757309F8 - 0x757309F0)]!
.text:756F8718 34 00 96 E5 LDR     R0, [R6,#(dword_75730EB8 - 0x75730E84)] ; int
.text:756F871C 28 F2 FF EB BL      write_0
.text:756F8720 68 21 9F E5 LDR     R2, =(_ZN6Global6ThreadE_ptr - 0x7572FED0)
.text:756F8724 68 31 9F E5 LDR     R3, =(_Z10IlIIlllIIlPv_ptr - 0x7572FED0)
.text:756F8728 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F872C 02 60 94 E7 LDR     R6, [R4,R2]
.text:756F8730 03 20 94 E7 LDR     R2, [R4,R3]                     ; void *(__cdecl *)(void *)
.text:756F8734 05 30 A0 E1 MOV     R3, R5                          ; void *
.text:756F8738 06 00 A0 E1 MOV     R0, R6                          ; int *
.text:756F873C 0C F1 FF EB BL      pthread_create_0
.text:756F8740 00 00 50 E3 CMP     R0, #0
.text:756F8744 43 00 00 BA BLT     loc_756F8858
.text:756F8748
.text:756F8748             loc_756F8748                            ; CODE XREF: IIIIIIIllll(void)+3C4↓j
.text:756F8748 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F874C 44 21 9F E5 LDR     R2, =(_Z10IIlIlllllIPv_ptr - 0x7572FED0)
.text:756F8750 01 30 A0 E1 MOV     R3, R1                          ; void *
.text:756F8754 02 20 94 E7 LDR     R2, [R4,R2]                     ; void *(__cdecl *)(void *)
.text:756F8758 04 00 86 E2 ADD     R0, R6, #4                      ; int *
.text:756F875C 04 F1 FF EB BL      pthread_create_0
.text:756F8760 00 00 50 E3 CMP     R0, #0
.text:756F8764 33 00 00 BA BLT     loc_756F8838
.text:756F8768
.text:756F8768             loc_756F8768                            ; CODE XREF: IIIIIIIllll(void)+3A4↓j
.text:756F8768 00 10 A0 E3 MOV     R1, #0                          ; pthread_attr_t *
.text:756F876C 30 21 9F E5 LDR     R2, =(_Z10IIllIIlIlIPv_ptr - 0x7572FED0)
.text:756F8770 01 30 A0 E1 MOV     R3, R1                          ; void *
.text:756F8774 02 20 94 E7 LDR     R2, [R4,R2]                     ; void *(__cdecl *)(void *)
.text:756F8778 08 00 8D E2 ADD     R0, SP, #0x30+var_28            ; int *
.text:756F877C FC F0 FF EB BL      pthread_create_0
.text:756F8780 20 21 9F E5 LDR     R2, =(_Z11IlIIllIIlIlPv_ptr - 0x7572FED0)
.text:756F8784 05 30 A0 E1 MOV     R3, R5
.text:756F8788 02 20 94 E7 LDR     R2, [R4,R2]
.text:756F878C 06 00 A0 E1 MOV     R0, R6
.text:756F8790 00 10 A0 E3 MOV     R1, #0
.text:756F8794 D2 FF FF EA B       loc_756F86E4
.text:756F8798             ; ---------------------------------------------------------------------------
.text:756F8798
.text:756F8798             loc_756F8798                            ; CODE XREF: IIIIIIIllll(void)+130↑j
.text:756F8798 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F879C 0E 10 A0 E3 MOV     R1, #0xE                        ; int
.text:756F87A0 00 30 A0 E1 MOV     R3, R0                          ; int
.text:756F87A4 00 20 A0 E3 MOV     R2, #0                          ; char *
.text:756F87A8 DB 12 00 EB BL      _Z10IIIIIllIIliiPKci            ; IIIIIllIIl(int,int,char const*,int)
.text:756F87AC 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F87B0 B1 F1 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F87B4 8A FF FF EA B       loc_756F85E4
.text:756F87B8             ; ---------------------------------------------------------------------------
.text:756F87B8
.text:756F87B8             loc_756F87B8                            ; CODE XREF: IIIIIIIllll(void)+B8↑j
.text:756F87B8 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F87BC AE F1 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F87C0 04 00 95 E5 LDR     R0, [R5,#(dword_757309F4 - 0x757309F0)]
.text:756F87C4 68 FF FF EA B       loc_756F856C
.text:756F87C8             ; ---------------------------------------------------------------------------
.text:756F87C8
.text:756F87C8             loc_756F87C8                            ; CODE XREF: IIIIIIIllll(void)+110↑j
.text:756F87C8 09 00 A0 E1 MOV     R0, R9                          ; int
.text:756F87CC 08 20 A0 E1 MOV     R2, R8                          ; char *
.text:756F87D0 0D 10 A0 E3 MOV     R1, #0xD                        ; int
.text:756F87D4 09 30 A0 E1 MOV     R3, R9                          ; int
.text:756F87D8 CF 12 00 EB BL      _Z10IIIIIllIIliiPKci            ; IIIIIllIIl(int,int,char const*,int)
.text:756F87DC 09 00 A0 E1 MOV     R0, R9                          ; int
.text:756F87E0 A5 F1 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F87E4 76 FF FF EA B       loc_756F85C4
.text:756F87E8             ; ---------------------------------------------------------------------------
.text:756F87E8
.text:756F87E8             loc_756F87E8                            ; CODE XREF: IIIIIIIllll(void)+21C↑j
.text:756F87E8 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F87EC 0E 10 A0 E3 MOV     R1, #0xE                        ; int
.text:756F87F0 00 30 A0 E1 MOV     R3, R0                          ; int
.text:756F87F4 00 20 A0 E3 MOV     R2, #0                          ; char *
.text:756F87F8 C7 12 00 EB BL      _Z10IIIIIllIIliiPKci            ; IIIIIllIIl(int,int,char const*,int)
.text:756F87FC 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F8800 9D F1 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F8804 B1 FF FF EA B       loc_756F86D0
.text:756F8808             ; ---------------------------------------------------------------------------
.text:756F8808
.text:756F8808             loc_756F8808                            ; CODE XREF: IIIIIIIllll(void)+1C0↑j
.text:756F8808 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F880C 9A F1 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F8810 08 30 95 E5 LDR     R3, [R5,#(dword_757309F8 - 0x757309F0)]
.text:756F8814 96 FF FF EA B       loc_756F8674
.text:756F8818             ; ---------------------------------------------------------------------------
.text:756F8818
.text:756F8818             loc_756F8818                            ; CODE XREF: IIIIIIIllll(void)+1FC↑j
.text:756F8818 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F881C 0D 10 A0 E3 MOV     R1, #0xD                        ; int
.text:756F8820 00 30 A0 E1 MOV     R3, R0                          ; int
.text:756F8824 00 20 A0 E3 MOV     R2, #0                          ; char *
.text:756F8828 BB 12 00 EB BL      _Z10IIIIIllIIliiPKci            ; IIIIIllIIl(int,int,char const*,int)
.text:756F882C 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F8830 91 F1 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F8834 9D FF FF EA B       loc_756F86B0
.text:756F8838             ; ---------------------------------------------------------------------------
.text:756F8838
.text:756F8838             loc_756F8838                            ; CODE XREF: IIIIIIIllll(void)+2B4↑j
.text:756F8838 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F883C 0E 10 A0 E3 MOV     R1, #0xE                        ; int
.text:756F8840 00 30 A0 E1 MOV     R3, R0                          ; int
.text:756F8844 00 20 A0 E3 MOV     R2, #0                          ; char *
.text:756F8848 B3 12 00 EB BL      _Z10IIIIIllIIliiPKci            ; IIIIIllIIl(int,int,char const*,int)
.text:756F884C 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F8850 89 F1 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F8854 C3 FF FF EA B       loc_756F8768
.text:756F8858             ; ---------------------------------------------------------------------------
.text:756F8858
.text:756F8858             loc_756F8858                            ; CODE XREF: IIIIIIIllll(void)+294↑j
.text:756F8858 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F885C 0D 10 A0 E3 MOV     R1, #0xD                        ; int
.text:756F8860 00 30 A0 E1 MOV     R3, R0                          ; int
.text:756F8864 00 20 A0 E3 MOV     R2, #0                          ; char *
.text:756F8868 AB 12 00 EB BL      _Z10IIIIIllIIliiPKci            ; IIIIIllIIl(int,int,char const*,int)
.text:756F886C 01 00 A0 E3 MOV     R0, #1                          ; int
.text:756F8870 81 F1 FF EB BL      _Z10llIIlIIIlli                 ; llIIlIIIll(int)
.text:756F8874 B3 FF FF EA B       loc_756F8748
2.反反调试过3进程互相调试我是通过hook ptrace直接让它返回0,多线程循环读取进程状态判断是否有调试器,我是通过hook open 函数过虑掉,还有就是直接让SDK版本小于0XD,或者直接NOP掉函数。
[Asm] 纯文本查看 复制代码
int new_ptrace(int request, int pid, int addr, int data){
        //LOGD("new_ptrace..");
        return 0;
}
int new_open(char *pathname, int oflag, mode_t mode)
{
        char* anit  = "stat";
        char* tmp = "";
        if (NULL == pathname)
        {
                goto exitret;
        }
        //LOGD("new_open..%s", pathname);
        if(strstr(pathname, anit) != NULL)
        {
                return -1;
        }
exitret:
        return old_open(pathname, oflag, mode);

}
三: compatible.so注册jni函数分析
1.获取动态jni注册函数
通过在dvmUseJNIBridge函数下好断点,来获取注册的jni函数地址,最后注册完后对照表:
注册类名com/inca/security/Core/AppGuardEngine
/data/app-lib/com.digitalsky.girlsfrontline.cn-1/libcompatible.so        757C8000        0005F000
Number                内存地址        函数名            文件偏移         签名   
第1个函数   .text:757D9AF8  IiiiIIiIii (文件偏移 11AF8)         ()I
第2个函数   .text:757DA058  iIiIIIiIiI (文件偏移 12058)         ([BI)[B
第3个函数   .text:757DC268  IiIiiIiIiI (文件偏移 14268)         (Landroid/content/Context;)V
第4个函数   .text:757D9914  IIiIiIIIiI (文件偏移 11914)         (I)V
第5个函数   .text:757D8A28  IIIIiIIIiI (文件偏移 10A28)         (J)V
2. jni函数功能分析
当JNI_OnLoad函数执行完后第一个执行的jni函数是上面注册的第3个函数, 反射获取包名与签名等。
第2个jni函数就是解密libengine.sox与libstub.sox,(assets\appguard\armeabi\)先在上面java层分析时AES解密后数据传入的就是这个函数 (文件偏移 12058)。
[Asm] 纯文本查看 复制代码
.text:757DA058             ; __unwind {
.text:757DA058 F0 43 2D E9 STMFD   SP!, {R4-R9,LR}
.text:757DA05C 02 70 A0 E1 MOV     R7, R2
.text:757DA060 00 20 90 E5 LDR     R2, [R0]
.text:757DA064 00 40 A0 E1 MOV     R4, R0
.text:757DA068 0C D0 4D E2 SUB     SP, SP, #0xC
.text:757DA06C 07 10 A0 E1 MOV     R1, R7
.text:757DA070 AC 22 92 E5 LDR     R2, [R2,#0x2AC]
.text:757DA074 03 50 A0 E1 MOV     R5, R3
.text:757DA078 32 FF 2F E1 BLX     R2
.text:757DA07C 00 30 94 E5 LDR     R3, [R4]
.text:757DA080 07 10 A0 E1 MOV     R1, R7
.text:757DA084 00 90 A0 E1 MOV     R9, R0
.text:757DA088 E0 32 93 E5 LDR     R3, [R3,#0x2E0]
.text:757DA08C 00 20 A0 E3 MOV     R2, #0
.text:757DA090 04 00 A0 E1 MOV     R0, R4
.text:757DA094 33 FF 2F E1 BLX     R3
.text:757DA098 00 80 A0 E1 MOV     R8, R0
.text:757DA09C 05 00 A0 E1 MOV     R0, R5                          ; unsigned int
.text:757DA0A0 27 1E 00 EB BL      malloc_0                        ; 分配存放空间存放解密后so数据
.text:757DA0A4 00 60 A0 E1 MOV     R6, R0
.text:757DA0A8 09 10 A0 E1 MOV     R1, R9
.text:757DA0AC 08 00 A0 E1 MOV     R0, R8
.text:757DA0B0 06 20 A0 E1 MOV     R2, R6
.text:757DA0B4 05 30 A0 E1 MOV     R3, R5
.text:757DA0B8 BA FF FF EB BL      Dec_sodata                      ; 解密so
.text:757DA0BC 00 30 94 E5 LDR     R3, [R4]
.text:757DA0C0 08 20 A0 E1 MOV     R2, R8
.text:757DA0C4 00 C3 93 E5 LDR     R12, [R3,#0x300]
.text:757DA0C8 07 10 A0 E1 MOV     R1, R7
.text:757DA0CC 04 00 A0 E1 MOV     R0, R4
.text:757DA0D0 02 30 A0 E3 MOV     R3, #2
.text:757DA0D4 3C FF 2F E1 BLX     R12
.text:757DA0D8 00 30 94 E5 LDR     R3, [R4]
.text:757DA0DC 05 10 A0 E1 MOV     R1, R5
.text:757DA0E0 04 00 A0 E1 MOV     R0, R4
.text:757DA0E4 C0 32 93 E5 LDR     R3, [R3,#0x2C0]
.text:757DA0E8 33 FF 2F E1 BLX     R3
.text:757DA0EC 00 70 A0 E1 MOV     R7, R0
.text:757DA0F0 00 20 94 E5 LDR     R2, [R4]
.text:757DA0F4 00 60 8D E5 STR     R6, [SP,#0x28+var_28]
.text:757DA0F8 05 30 A0 E1 MOV     R3, R5
.text:757DA0FC 40 C3 92 E5 LDR     R12, [R2,#0x340]
.text:757DA100 04 00 A0 E1 MOV     R0, R4
.text:757DA104 07 10 A0 E1 MOV     R1, R7
.text:757DA108 00 20 A0 E3 MOV     R2, #0
.text:757DA10C 3C FF 2F E1 BLX     R12
.text:757DA110 06 00 A0 E1 MOV     R0, R6                          ; ptr
.text:757DA114 DD F6 FF EB BL      free
.text:757DA118 07 00 A0 E1 MOV     R0, R7
.text:757DA11C 0C D0 8D E2 ADD     SP, SP, #0xC
.text:757DA120 F0 83 BD E8 LDMFD   SP!, {R4-R9,PC}

解密完后R5是大小,R6基址,将其dump出来,如下图所示:

8

8

[Asm] 纯文本查看 复制代码
static main(void)
    {
        auto fp, begin, end, dexbyte;
        fp = fopen("d:\\libstub.so", "wb"); //打开或创建一个文件
        begin =  R6;              //so基址
        end = begin + R5;            //so基址 + so文件大小
        for ( dexbyte = begin; dexbyte < end;dexbyte ++ )
        {
            fputc(Byte(dexbyte), fp);     //按字节将其dump到本地文件中
        }
    } 

libstub.sox解密后将最终的明文写到/data/data/包名/files/libstub.so目录下,后然加载,接下来分析libstub.so。
四: stub.so反调试与反反调试
1.反调试在JNI_onLoad中读取进程状态,前面通过hook open函数己过了反调试。
五: stub.so注册jni函数分析
1.注册jni
通过在dvmUseJNIBridge函数下好断点,来获取注册的jni函数地址,最后注册完后对照表:
注册类名com/inca/security/Core/UnsafeDexLoader
Number                内存地址        函数名            文件偏移         签名   
第1个函数   .text:75C80704  IlIIIIIIII (文件偏移 12704)         (Ljava/lang/String;Ljava/lang/String;I)I
第2个函数   .text:75C808C4  IIIIIIIIIl (文件偏移 128C4)         ([B)I
第3个函数   .text:75C80A7C  IIIIIIIIlI (文件偏移 12A7C)         (Ljava/lang/String;Ljava/lang/ClassLoader;I)Ljava/lang/Class;
第4个函数   .text:75C80C3C  IIIIIIIIll (文件偏移 12C3C)         (I)[Ljava/lang/String;
第5个函数   .text:75C80DF4  IIIIIIIlII (文件偏移 12DF4)         (I)V


//
注册类名com/inca/security/Core/AppGuardEngine
Number                内存地址        函数名            文件偏移         签名   
第1个函数   .text:75C81168  IlIIIIIIII (文件偏移 13168)         (Landroid/content/Context;Ljava/lang/String;[B)I
第2个函数   .text:75C814AC  IIIIIIIllI (文件偏移 134AC)         ()V
第3个函数   .text:75C81618  IIIIIIIlll (文件偏移 13618)         (I[B[B)I
第4个函数   .text:75C81724  IIIIIIlIII (文件偏移 13724)         (I[B[B)I
第5个函数   .text:75C817CC  IIIIIIIlII (文件偏移 137CC)         (I[B[B)I
第6个函数   .text:75C8186C  IllIIIlIII (文件偏移 1386C)         (I)I
第7个函数   .text:75C818AC  IIIIIIlIlI (文件偏移 138AC)         (I)I
第8个函数   .text:75C81810  llIIIIlIIl (文件偏移 13810)         (I[B)I
第9个函数   .text:75C81844  IlIIIIlllI (文件偏移 13844)         (Z)V
第10个函数   .text:75C81D10  lllIIIlllI (文件偏移 13D10)         (Landroid/content/Context;)V

注册类名com/inca/security/AppGuard/TestCase
第1个函数   .text:75C82608  IIIIIIlIll (文件偏移 14608)         (Landroid/content/Context;Z)Z
第2个函数   .text:75C8267C  IIIIIIllII (文件偏移 1467C)         (Landroid/content/Context;)Z
第3个函数   .text:75C826F0  IIIIIIllIl (文件偏移 146F0)         (Landroid/content/Context;)Z
第4个函数   .text:75C82764  IIIIIIlllI (文件偏移 14764)         (Landroid/content/Context;)Z
2.在com/inca/security/Core/AppGuardEngine类中第10个函数jni函数中hook mono函数 (文件偏移 18D04)
[Asm] 纯文本查看 复制代码
.text:75C86D04             EXPORT hook_mono_func
.text:75C86D04             hook_mono_func                          ; CODE XREF: Hook_Thread+4↑p
.text:75C86D04
.text:75C86D04             var_280= -0x280
.text:75C86D04             var_27C= -0x27C
.text:75C86D04             var_278= -0x278
.text:75C86D04             format= -0x274
.text:75C86D04             var_26C= -0x26C
.text:75C86D04             var_24C= -0x24C
.text:75C86D04             s= -0x22C
.text:75C86D04             var_12C= -0x12C
.text:75C86D04             var_2C= -0x2C
.text:75C86D04
.text:75C86D04             ; __unwind { // 75C9B220
.text:75C86D04 F0 4F 2D E9 STMFD   SP!, {R4-R11,LR}
.text:75C86D08 08 56 9F E5 LDR     R5, =(_GLOBAL_OFFSET_TABLE_ - 0x75C86D1C)
.text:75C86D0C 08 36 9F E5 LDR     R3, =(__stack_chk_guard_ptr - 0x75CBEEC0)
.text:75C86D10 97 DF 4D E2 SUB     SP, SP, #0x25C
.text:75C86D14 05 50 8F E0 ADD     R5, PC, R5                      ; _GLOBAL_OFFSET_TABLE_
.text:75C86D18 03 A0 95 E7 LDR     R10, [R5,R3]
.text:75C86D1C 54 80 8D E2 ADD     R8, SP, #0x280+s
.text:75C86D20 00 10 A0 E3 MOV     R1, #0                          ; c
.text:75C86D24 00 30 9A E5 LDR     R3, [R10]
.text:75C86D28 FF 20 A0 E3 MOV     R2, #0xFF                       ; n
.text:75C86D2C 08 00 A0 E1 MOV     R0, R8                          ; s
.text:75C86D30 54 32 8D E5 STR     R3, [SP,#0x280+var_2C]
.text:75C86D34 29 D7 FF EB BL      memset
.text:75C86D38 E0 15 9F E5 LDR     R1, =(unk_75CB8B70 - 0x75C86D4C)
.text:75C86D3C 34 40 8D E2 ADD     R4, SP, #0x280+var_24C
.text:75C86D40 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86D44 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CB8B70
.text:75C86D48 F0 10 81 E2 ADD     R1, R1, #0xF0                   ; char *
.text:75C86D4C 83 F8 FF EB BL      DecString
.text:75C86D50 04 00 A0 E1 MOV     R0, R4
.text:75C86D54 67 F7 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C86D58 00 10 A0 E3 MOV     R1, #0                          ; mode
.text:75C86D5C 13 D7 FF EB BL      dlopen
.text:75C86D60 00 60 A0 E1 MOV     R6, R0
.text:75C86D64 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86D68 40 F7 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C86D6C B0 15 9F E5 LDR     R1, =(unk_75CB8B70 - 0x75C86D80)
.text:75C86D70 00 00 56 E3 CMP     R6, #0
.text:75C86D74 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86D78 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CB8B70
.text:75C86D7C 05 1D 81 E2 ADD     R1, R1, #0x140                  ; char *
.text:75C86D80 00 60 E0 03 MOVEQ   R6, #0xFFFFFFFF
.text:75C86D84 75 F8 FF EB BL      DecString
.text:75C86D88 04 00 A0 E1 MOV     R0, R4
.text:75C86D8C 59 F7 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C86D90 00 10 A0 E1 MOV     R1, R0                          ; name
.text:75C86D94 06 00 A0 E1 MOV     R0, R6                          ; handle
.text:75C86D98 F8 D6 FF EB BL      dlsym
.text:75C86D9C 00 60 A0 E1 MOV     R6, R0
.text:75C86DA0 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86DA4 31 F7 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C86DA8 00 00 56 E3 CMP     R6, #0
.text:75C86DAC 01 00 00 0A BEQ     loc_75C86DB8
.text:75C86DB0 36 FF 2F E1 BLX     R6
.text:75C86DB4 00 60 A0 E1 MOV     R6, R0
.text:75C86DB8
.text:75C86DB8             loc_75C86DB8                            ; CODE XREF: hook_mono_func+A8↑j
.text:75C86DB8 06 00 A0 E1 MOV     R0, R6                          ; unsigned int
.text:75C86DBC 58 09 00 EB BL      _Z11llllIIlllIlj                ; libil2cpp.so没有
.text:75C86DC0 60 15 9F E5 LDR     R1, =(unk_75CB8B70 - 0x75C86DD4)
.text:75C86DC4 14 70 8D E2 ADD     R7, SP, #0x280+var_26C
.text:75C86DC8 07 00 A0 E1 MOV     R0, R7                          ; this
.text:75C86DCC 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CB8B70
.text:75C86DD0 19 1E 81 E2 ADD     R1, R1, #0x190                  ; char *
.text:75C86DD4 61 F8 FF EB BL      DecString
.text:75C86DD8 07 00 A0 E1 MOV     R0, R7
.text:75C86DDC 45 F7 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C86DE0 44 15 9F E5 LDR     R1, =(unk_75CB8B70 - 0x75C86DF0)
.text:75C86DE4 00 90 A0 E1 MOV     R9, R0
.text:75C86DE8 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CB8B70
.text:75C86DEC 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86DF0 1E 1E 81 E2 ADD     R1, R1, #0x1E0                  ; char *
.text:75C86DF4 59 F8 FF EB BL      DecString
.text:75C86DF8 04 00 A0 E1 MOV     R0, R4
.text:75C86DFC 3D F7 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C86E00 28 25 9F E5 LDR     R2, =(_ZN6Global10llIllllIlIE_ptr - 0x75CBEEC0)
.text:75C86E04 00 30 A0 E1 MOV     R3, R0
.text:75C86E08 02 20 95 E7 LDR     R2, [R5,R2]
.text:75C86E0C 09 10 A0 E1 MOV     R1, R9                          ; format
.text:75C86E10 08 00 A0 E1 MOV     R0, R8                          ; s
.text:75C86E14 00 20 8D E5 STR     R2, [SP,#0x280+var_280]
.text:75C86E18 F9 D6 FF EB BL      sprintf
.text:75C86E1C 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86E20 12 F7 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C86E24 07 00 A0 E1 MOV     R0, R7                          ; this
.text:75C86E28 10 F7 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C86E2C 08 00 A0 E1 MOV     R0, R8                          ; file
.text:75C86E30 00 10 A0 E3 MOV     R1, #0                          ; mode
.text:75C86E34 DD D6 FF EB BL      dlopen                          ; 打开libmono.so
.text:75C86E38 00 90 50 E2 SUBS    R9, R0, #0
.text:75C86E3C 5B 00 00 0A BEQ     loc_75C86FB0
.text:75C86E40 EC 14 9F E5 LDR     R1, =(unk_75CB8B70 - 0x75C86E50)
.text:75C86E44 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86E48 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CB8B70
.text:75C86E4C 23 1E 81 E2 ADD     R1, R1, #0x230                  ; char *
.text:75C86E50 42 F8 FF EB BL      DecString
.text:75C86E54 04 00 A0 E1 MOV     R0, R4
.text:75C86E58 26 F7 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C86E5C 00 10 A0 E1 MOV     R1, R0                          ; name
.text:75C86E60 09 00 A0 E1 MOV     R0, R9                          ; handle
.text:75C86E64 C5 D6 FF EB BL      dlsym                           ; 获取mono_assembly_load_from_full地址
.text:75C86E68 C8 34 9F E5 LDR     R3, =(IIlIlIIllll_ptr - 0x75CBEEC0)
.text:75C86E6C C8 24 9F E5 LDR     R2, =(dword_75CC0068 - 0x75C86E7C)
.text:75C86E70 03 30 95 E7 LDR     R3, [R5,R3]
.text:75C86E74 02 20 8F E0 ADD     R2, PC, R2                      ; dword_75CC0068
.text:75C86E78 10 20 82 E2 ADD     R2, R2, #0x10                   ; void **
.text:75C86E7C 03 10 A0 E1 MOV     R1, R3                          ; void *
.text:75C86E80 08 30 8D E5 STR     R3, [SP,#0x280+var_278]
.text:75C86E84 75 F8 FF EB BL      hook                            ; hook mono_assembly_load_from_full
.text:75C86E88 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86E8C F7 F6 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C86E90 A8 14 9F E5 LDR     R1, =(unk_75CB8B70 - 0x75C86EA0)
.text:75C86E94 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86E98 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CB8B70
.text:75C86E9C 0A 1D 81 E2 ADD     R1, R1, #0x280                  ; char *
.text:75C86EA0 2E F8 FF EB BL      DecString
.text:75C86EA4 04 00 A0 E1 MOV     R0, R4
.text:75C86EA8 12 F7 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C86EAC 00 10 A0 E1 MOV     R1, R0                          ; name
.text:75C86EB0 09 00 A0 E1 MOV     R0, R9                          ; handle
.text:75C86EB4 B1 D6 FF EB BL      dlsym                           ; 获取mono_image_open_from_data_with_name地址
.text:75C86EB8 84 34 9F E5 LDR     R3, =(lIlIllIllIl_ptr - 0x75CBEEC0)
.text:75C86EBC 84 24 9F E5 LDR     R2, =(dword_75CC0068 - 0x75C86ECC)
.text:75C86EC0 03 30 95 E7 LDR     R3, [R5,R3]
.text:75C86EC4 02 20 8F E0 ADD     R2, PC, R2                      ; dword_75CC0068
.text:75C86EC8 08 20 82 E2 ADD     R2, R2, #8                      ; void **
.text:75C86ECC 03 10 A0 E1 MOV     R1, R3                          ; void *
.text:75C86ED0 04 30 8D E5 STR     R3, [SP,#0x280+var_27C]
.text:75C86ED4 61 F8 FF EB BL      hook                            ; hook mono_image_open_from_data_with_name
.text:75C86ED8 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86EDC E3 F6 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C86EE0 64 34 9F E5 LDR     R3, =(dword_75CC0068 - 0x75C86EEC)
.text:75C86EE4 03 30 8F E0 ADD     R3, PC, R3                      ; dword_75CC0068
.text:75C86EE8 10 20 93 E5 LDR     R2, [R3,#(dword_75CC0078 - 0x75CC0068)]
.text:75C86EEC 00 00 52 E3 CMP     R2, #0
.text:75C86EF0 34 00 00 0A BEQ     loc_75C86FC8
.text:75C86EF4 08 30 93 E5 LDR     R3, [R3,#(dword_75CC0070 - 0x75CC0068)]
.text:75C86EF8 00 00 53 E3 CMP     R3, #0
.text:75C86EFC 31 00 00 0A BEQ     loc_75C86FC8
.text:75C86F00
.text:75C86F00             loc_75C86F00                            ; CODE XREF: hook_mono_func+364↓j
.text:75C86F00                                                     ; hook_mono_func+38C↓j ...
.text:75C86F00 17 00 56 E3 CMP     R6, #0x17
.text:75C86F04 04 00 00 9A BLS     loc_75C86F1C
.text:75C86F08 40 34 9F E5 LDR     R3, =(_ZN6Global10lIlllIIllIE_ptr - 0x75CBEEC0)
.text:75C86F0C 03 30 95 E7 LDR     R3, [R5,R3]
.text:75C86F10 00 30 93 E5 LDR     R3, [R3]                        ; Global::lIlllIIllI
.text:75C86F14 17 00 53 E3 CMP     R3, #0x17
.text:75C86F18 6E 00 00 CA BGT     loc_75C870D8
.text:75C86F1C
.text:75C86F1C             loc_75C86F1C                            ; CODE XREF: hook_mono_func+200↑j
.text:75C86F1C 30 14 9F E5 LDR     R1, =(unk_75CB8B70 - 0x75C86F2C)
.text:75C86F20 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86F24 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CB8B70
.text:75C86F28 32 1E 81 E2 ADD     R1, R1, #0x320                  ; char *
.text:75C86F2C 0B F8 FF EB BL      DecString
.text:75C86F30 04 00 A0 E1 MOV     R0, R4
.text:75C86F34 EF F6 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C86F38 18 34 9F E5 LDR     R3, =(dword_75CC0068 - 0x75C86F4C)
.text:75C86F3C 18 24 9F E5 LDR     R2, =(lIIIlIIlII_ptr - 0x75CBEEC0)
.text:75C86F40 00 10 A0 E1 MOV     R1, R0                          ; char *
.text:75C86F44 03 30 8F E0 ADD     R3, PC, R3                      ; dword_75CC0068
.text:75C86F48 02 20 95 E7 LDR     R2, [R5,R2]                     ; void *
.text:75C86F4C 04 30 83 E2 ADD     R3, R3, #4                      ; void **
.text:75C86F50 09 00 A0 E1 MOV     R0, R9                          ; void *
.text:75C86F54 99 F8 FF EB BL      IAT_HOOK                        ; hook memcpy
.text:75C86F58 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86F5C C3 F6 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C86F60 F8 13 9F E5 LDR     R1, =(unk_75CB8B70 - 0x75C86F70)
.text:75C86F64 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86F68 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CB8B70
.text:75C86F6C 37 1E 81 E2 ADD     R1, R1, #0x370                  ; char *
.text:75C86F70 FA F7 FF EB BL      DecString
.text:75C86F74 04 00 A0 E1 MOV     R0, R4
.text:75C86F78 DE F6 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C86F7C E0 33 9F E5 LDR     R3, =(IlIIIlIIlI_ptr - 0x75CBEEC0)
.text:75C86F80 00 10 A0 E1 MOV     R1, R0                          ; char *
.text:75C86F84 03 20 95 E7 LDR     R2, [R5,R3]                     ; void *
.text:75C86F88 D8 33 9F E5 LDR     R3, =(dword_75CC0068 - 0x75C86F98)
.text:75C86F8C 09 00 A0 E1 MOV     R0, R9                          ; void *
.text:75C86F90 03 30 8F E0 ADD     R3, PC, R3                      ; dword_75CC0068 ; void **
.text:75C86F94 89 F8 FF EB BL      IAT_HOOK                        ; hook mmap
.text:75C86F98
.text:75C86F98             loc_75C86F98                            ; CODE XREF: hook_mono_func+4C0↓j
.text:75C86F98 04 00 A0 E1 MOV     R0, R4                          ; this
.text:75C86F9C B3 F6 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C86FA0
.text:75C86FA0             loc_75C86FA0                            ; CODE XREF: hook_mono_func+484↓j
.text:75C86FA0 01 20 A0 E3 MOV     R2, #1
.text:75C86FA4 C0 33 9F E5 LDR     R3, =(_ZN6Global10lllllllIIIE_ptr - 0x75CBEEC0)
.text:75C86FA8 03 30 95 E7 LDR     R3, [R5,R3]
.text:75C86FAC 00 20 C3 E5 STRB    R2, [R3]                        ; Global::lllllllIII
.text:75C86FB0
.text:75C86FB0             loc_75C86FB0                            ; CODE XREF: hook_mono_func+138↑j
.text:75C86FB0 54 22 9D E5 LDR     R2, [SP,#0x280+var_2C]
.text:75C86FB4 00 30 9A E5 LDR     R3, [R10]
.text:75C86FB8 03 00 52 E1 CMP     R2, R3
.text:75C86FBC A4 00 00 1A BNE     loc_75C87254
.text:75C86FC0 97 DF 8D E2 ADD     SP, SP, #0x25C
.text:75C86FC4 F0 8F BD E8 LDMFD   SP!, {R4-R11,PC}

六: Assembly-CSharp.dll解密分析
1. 在mono的hook函数中解密Assembly-CSharp.dll,代码如下:
[Asm] 纯文本查看 复制代码
.text:75C7A138             EXPORT hook_mono_image_open_from_data_with_name
.text:75C7A138             hook_mono_image_open_from_data_with_name
.text:75C7A138                                                     ; DATA XREF: .got:lIlIllIllIl_ptr↓o
.text:75C7A138
.text:75C7A138             var_4F0= -0x4F0
.text:75C7A138             var_4EC= -0x4EC
.text:75C7A138             var_4E8= -0x4E8
.text:75C7A138             var_4E4= -0x4E4
.text:75C7A138             var_4DC= -0x4DC
.text:75C7A138             var_4D8= -0x4D8
.text:75C7A138             var_4D4= -0x4D4
.text:75C7A138             var_4D0= -0x4D0
.text:75C7A138             var_4CC= -0x4CC
.text:75C7A138             var_4C8= -0x4C8
.text:75C7A138             var_4C4= -0x4C4
.text:75C7A138             var_60= -0x60
.text:75C7A138             var_54= -0x54
.text:75C7A138             var_50= -0x50
.text:75C7A138             var_4C= -0x4C
.text:75C7A138             var_48= -0x48
.text:75C7A138             var_44= -0x44
.text:75C7A138             var_43= -0x43
.text:75C7A138             var_42= -0x42
.text:75C7A138             var_41= -0x41
.text:75C7A138             var_40= -0x40
.text:75C7A138             var_3F= -0x3F
.text:75C7A138             var_3E= -0x3E
.text:75C7A138             var_3D= -0x3D
.text:75C7A138             var_2C= -0x2C
.text:75C7A138             arg_0=  0
.text:75C7A138             arg_4=  4
.text:75C7A138
.text:75C7A138             ; __unwind { // 75C8F220
.text:75C7A138 F0 4F 2D E9 STMFD   SP!, {R4-R11,LR}
.text:75C7A13C 13 DD 4D E2 SUB     SP, SP, #0x4C0
.text:75C7A140 0C D0 4D E2 SUB     SP, SP, #0xC
.text:75C7A144 F4 74 9D E5 LDR     R7, [SP,#0x4F0+arg_4]
.text:75C7A148 54 84 9F E5 LDR     R8, =(_GLOBAL_OFFSET_TABLE_ - 0x75C7A168)
.text:75C7A14C 54 C4 9F E5 LDR     R12, =(__stack_chk_guard_ptr - 0x75CB2EC0)
.text:75C7A150 00 60 97 E2 MOVS    R6, R7
.text:75C7A154 01 60 A0 13 MOVNE   R6, #1
.text:75C7A158 00 00 57 E3 CMP     R7, #0
.text:75C7A15C FF 00 51 13 CMPNE   R1, #0xFF
.text:75C7A160 08 80 8F E0 ADD     R8, PC, R8                      ; _GLOBAL_OFFSET_TABLE_
.text:75C7A164 0C C0 98 E7 LDR     R12, [R8,R12]
.text:75C7A168 01 50 A0 E1 MOV     R5, R1
.text:75C7A16C 08 C0 8D E5 STR     R12, [SP,#0x4F0+var_4E8]
.text:75C7A170 00 C0 9C E5 LDR     R12, [R12]
.text:75C7A174 00 40 A0 E1 MOV     R4, R0
.text:75C7A178 0C 20 8D E5 STR     R2, [SP,#0x4F0+var_4E4]
.text:75C7A17C C4 C4 8D E5 STR     R12, [SP,#0x4F0+var_2C]
.text:75C7A180 DE 00 00 9A BLS     loc_75C7A500
.text:75C7A184 20 14 9F E5 LDR     R1, =(unk_75CACB70 - 0x75C7A198)
.text:75C7A188 2C 60 8D E2 ADD     R6, SP, #0x4F0+var_4C4
.text:75C7A18C 06 00 A0 E1 MOV     R0, R6                          ; this
.text:75C7A190 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CACB70 ; char *
.text:75C7A194 03 90 A0 E1 MOV     R9, R3
.text:75C7A198 70 FB FF EB BL      DecString
.text:75C7A19C 06 00 A0 E1 MOV     R0, R6
.text:75C7A1A0 54 FA FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C7A1A4 00 10 A0 E1 MOV     R1, R0                          ; needle
.text:75C7A1A8 07 00 A0 E1 MOV     R0, R7                          ; haystack
.text:75C7A1AC 29 DA FF EB BL      strstr                          ; 判断是否加载Assembly-CSharp.dll
.text:75C7A1B0 00 A0 A0 E1 MOV     R10, R0
.text:75C7A1B4 06 00 A0 E1 MOV     R0, R6                          ; this
.text:75C7A1B8 2C FA FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C7A1BC 00 00 5A E3 CMP     R10, #0
.text:75C7A1C0 A5 00 00 0A BEQ     loc_75C7A45C
.text:75C7A1C4 E4 A3 9F E5 LDR     R10, =unk_49F54EEB              ; 准备解密
.text:75C7A1C8 E4 E3 9F E5 LDR     LR, =0x8B3BE89F
.text:75C7A1CC E4 C3 9F E5 LDR     R12, =0xC6EF3720
.text:75C7A1D0 0A 30 A0 E1 MOV     R3, R10
.text:75C7A1D4
.text:75C7A1D4             loc_75C7A1D4                            ; CODE XREF: hook_mono_image_open_from_data_with_name+104↓j
.text:75C7A1D4 E0 13 9F E5 LDR     R1, =0x815AA0CD
.text:75C7A1D8 E0 23 9F E5 LDR     R2, =0xA1C489F7
.text:75C7A1DC 03 B2 A0 E1 MOV     R11, R3,LSL#4
.text:75C7A1E0 A3 02 A0 E1 MOV     R0, R3,LSR#5
.text:75C7A1E4 01 10 8B E0 ADD     R1, R11, R1
.text:75C7A1E8 02 20 80 E0 ADD     R2, R0, R2
.text:75C7A1EC 03 30 8C E0 ADD     R3, R12, R3
.text:75C7A1F0 01 20 22 E0 EOR     R2, R2, R1
.text:75C7A1F4 03 20 22 E0 EOR     R2, R2, R3
.text:75C7A1F8 C4 13 9F E5 LDR     R1, =0x95A8882C
.text:75C7A1FC C4 33 9F E5 LDR     R3, =0x9D2CC113
.text:75C7A200 0E E0 62 E0 RSB     LR, R2, LR
.text:75C7A204 0C 20 8E E0 ADD     R2, LR, R12
.text:75C7A208 0E B2 A0 E1 MOV     R11, LR,LSL#4
.text:75C7A20C AE 02 A0 E1 MOV     R0, LR,LSR#5
.text:75C7A210 61 C4 8C E2 ADD     R12, R12, #0x61000000
.text:75C7A214 01 10 8B E0 ADD     R1, R11, R1
.text:75C7A218 03 30 80 E0 ADD     R3, R0, R3
.text:75C7A21C 32 C7 8C E2 ADD     R12, R12, #0xC80000
.text:75C7A220 01 30 23 E0 EOR     R3, R3, R1
.text:75C7A224 86 CC 8C E2 ADD     R12, R12, #0x8600
.text:75C7A228 02 30 23 E0 EOR     R3, R3, R2
.text:75C7A22C 47 C0 8C E2 ADD     R12, R12, #0x47
.text:75C7A230 0A 30 63 E0 RSB     R3, R3, R10
.text:75C7A234 00 00 5C E3 CMP     R12, #0
.text:75C7A238 03 A0 A0 E1 MOV     R10, R3
.text:75C7A23C E4 FF FF 1A BNE     loc_75C7A1D4
.text:75C7A240 00 10 D4 E5 LDRB    R1, [R4]
.text:75C7A244 FF 20 03 E2 AND     R2, R3, #0xFF
.text:75C7A248 28 E0 8D E5 STR     LR, [SP,#0x4F0+var_4C8]
.text:75C7A24C 02 00 51 E1 CMP     R1, R2
.text:75C7A250 24 30 8D E5 STR     R3, [SP,#0x4F0+var_4CC]
.text:75C7A254 80 00 00 1A BNE     loc_75C7A45C
.text:75C7A258 01 20 D4 E5 LDRB    R2, [R4,#1]
.text:75C7A25C 25 30 DD E5 LDRB    R3, [SP,#0x4F0+var_4CC+1]
.text:75C7A260 03 00 52 E1 CMP     R2, R3
.text:75C7A264 7C 00 00 1A BNE     loc_75C7A45C
.text:75C7A268 02 20 D4 E5 LDRB    R2, [R4,#2]
.text:75C7A26C 26 30 DD E5 LDRB    R3, [SP,#0x4F0+var_4CC+2]
.text:75C7A270 03 00 52 E1 CMP     R2, R3
.text:75C7A274 78 00 00 1A BNE     loc_75C7A45C
.text:75C7A278 03 20 D4 E5 LDRB    R2, [R4,#3]
.text:75C7A27C 27 30 DD E5 LDRB    R3, [SP,#0x4F0+var_4CC+3]
.text:75C7A280 03 00 52 E1 CMP     R2, R3
.text:75C7A284 74 00 00 1A BNE     loc_75C7A45C
.text:75C7A288 04 20 D4 E5 LDRB    R2, [R4,#4]
.text:75C7A28C 28 30 DD E5 LDRB    R3, [SP,#0x4F0+var_4C8]
.text:75C7A290 03 00 52 E1 CMP     R2, R3
.text:75C7A294 70 00 00 1A BNE     loc_75C7A45C
.text:75C7A298 2C 33 9F E5 LDR     R3, =(_ZN6Global10IIlllllllIE_ptr - 0x75CB2EC0)
.text:75C7A29C 9C C4 8D E5 STR     R12, [SP,#0x4F0+var_54]
.text:75C7A2A0 A0 C4 8D E5 STR     R12, [SP,#0x4F0+var_50]
.text:75C7A2A4 03 30 98 E7 LDR     R3, [R8,R3]
.text:75C7A2A8 00 30 D3 E5 LDRB    R3, [R3]                        ; Global::IIlllllllI
.text:75C7A2AC 00 00 53 E3 CMP     R3, #0
.text:75C7A2B0 A7 00 00 0A BEQ     loc_75C7A554
.text:75C7A2B4 14 33 9F E5 LDR     R3, =(_ZN6Global10IllIlIIllIE_ptr - 0x75CB2EC0)
.text:75C7A2B8 03 30 98 E7 LDR     R3, [R8,R3]
.text:75C7A2BC 00 30 93 E5 LDR     R3, [R3]                        ; Global::IllIlIIllI
.text:75C7A2C0 00 A0 D3 E5 LDRB    R10, [R3]
.text:75C7A2C4 01 80 D3 E5 LDRB    R8, [R3,#1]
.text:75C7A2C8 02 E0 D3 E5 LDRB    LR, [R3,#2]
.text:75C7A2CC 03 C0 D3 E5 LDRB    R12, [R3,#3]
.text:75C7A2D0 04 00 D3 E5 LDRB    R0, [R3,#4]
.text:75C7A2D4 05 10 D3 E5 LDRB    R1, [R3,#5]
.text:75C7A2D8 06 20 D3 E5 LDRB    R2, [R3,#6]
.text:75C7A2DC 07 30 D3 E5 LDRB    R3, [R3,#7]
.text:75C7A2E0 9C A4 CD E5 STRB    R10, [SP,#0x4F0+var_54]
.text:75C7A2E4 9D 84 CD E5 STRB    R8, [SP,#0x4F0+var_54+1]
.text:75C7A2E8 9E E4 CD E5 STRB    LR, [SP,#0x4F0+var_54+2]
.text:75C7A2EC 9F C4 CD E5 STRB    R12, [SP,#0x4F0+var_54+3]
.text:75C7A2F0 A0 04 CD E5 STRB    R0, [SP,#0x4F0+var_50]
.text:75C7A2F4 A1 14 CD E5 STRB    R1, [SP,#0x4F0+var_50+1]
.text:75C7A2F8 A2 24 CD E5 STRB    R2, [SP,#0x4F0+var_50+2]
.text:75C7A2FC A3 34 CD E5 STRB    R3, [SP,#0x4F0+var_50+3]
.text:75C7A300
.text:75C7A300             loc_75C7A300                            ; CODE XREF: hook_mono_image_open_from_data_with_name+440↓j
.text:75C7A300 06 00 A0 E1 MOV     R0, R6                          ; this
.text:75C7A304 2E F1 FF EB BL      _ZN10llIlIlIlllC2Ev             ; llIlIlIlll::llIlIlIlll(void)
.text:75C7A308 10 30 A0 E3 MOV     R3, #0x10                       ; int
.text:75C7A30C 05 C0 D4 E5 LDRB    R12, [R4,#5]
.text:75C7A310 9C E4 9D E5 LDR     LR, [SP,#0x4F0+var_54]
.text:75C7A314 08 10 D4 E5 LDRB    R1, [R4,#8]
.text:75C7A318 09 20 D4 E5 LDRB    R2, [R4,#9]
.text:75C7A31C 07 00 D4 E5 LDRB    R0, [R4,#7]
.text:75C7A320 06 A0 D4 E5 LDRB    R10, [R4,#6]
.text:75C7A324 00 30 8D E5 STR     R3, [SP,#0x4F0+var_4F0]         ; int
.text:75C7A328 A0 B4 9D E5 LDR     R11, [SP,#0x4F0+var_50]
.text:75C7A32C A4 E4 8D E5 STR     LR, [SP,#0x4F0+var_4C]
.text:75C7A330 0A 80 D4 E5 LDRB    R8, [R4,#0xA]
.text:75C7A334 0B E0 D4 E5 LDRB    LR, [R4,#0xB]
.text:75C7A338 AC C4 CD E5 STRB    R12, [SP,#0x4F0+var_44]
.text:75C7A33C 0C C0 D4 E5 LDRB    R12, [R4,#0xC]
.text:75C7A340 AF 14 CD E5 STRB    R1, [SP,#0x4F0+var_41]
.text:75C7A344 B0 24 CD E5 STRB    R2, [SP,#0x4F0+var_40]
.text:75C7A348 4A 1E 8D E2 ADD     R1, SP, #0x4F0+var_50
.text:75C7A34C 4B 2E 8D E2 ADD     R2, SP, #0x4F0+var_40
.text:75C7A350 AE 04 CD E5 STRB    R0, [SP,#0x4F0+var_42]
.text:75C7A354 04 10 81 E2 ADD     R1, R1, #4                      ; char *
.text:75C7A358 06 00 A0 E1 MOV     R0, R6                          ; this
.text:75C7A35C 04 20 82 E2 ADD     R2, R2, #4                      ; char *
.text:75C7A360 A8 B4 8D E5 STR     R11, [SP,#0x4F0+var_48]
.text:75C7A364 AD A4 CD E5 STRB    R10, [SP,#0x4F0+var_43]
.text:75C7A368 B1 84 CD E5 STRB    R8, [SP,#0x4F0+var_3F]
.text:75C7A36C B2 E4 CD E5 STRB    LR, [SP,#0x4F0+var_3E]
.text:75C7A370 B3 C4 CD E5 STRB    R12, [SP,#0x4F0+var_3D]
.text:75C7A374 16 F1 FF EB BL      _ZN10llIlIlIlll10lIIIIlIlIIEPKcS1_ii ; llIlIlIlll::lIIIIlIlII(char const*,char const*,int,int)
.text:75C7A378 0F 20 D4 E5 LDRB    R2, [R4,#0xF]
.text:75C7A37C 10 30 D4 E5 LDRB    R3, [R4,#0x10]
.text:75C7A380 0D 00 D4 E5 LDRB    R0, [R4,#0xD]
.text:75C7A384 0E 10 D4 E5 LDRB    R1, [R4,#0xE]
.text:75C7A388 16 20 CD E5 STRB    R2, [SP,#0x4F0+var_4DC+2]
.text:75C7A38C 17 30 CD E5 STRB    R3, [SP,#0x4F0+var_4DC+3]
.text:75C7A390 11 20 D4 E5 LDRB    R2, [R4,#0x11]
.text:75C7A394 12 30 D4 E5 LDRB    R3, [R4,#0x12]
.text:75C7A398 14 00 CD E5 STRB    R0, [SP,#0x4F0+var_4DC]
.text:75C7A39C 15 10 CD E5 STRB    R1, [SP,#0x4F0+var_4DC+1]
.text:75C7A3A0 14 A0 9D E5 LDR     R10, [SP,#0x4F0+var_4DC]
.text:75C7A3A4 13 80 D4 E5 LDRB    R8, [R4,#0x13]
.text:75C7A3A8 14 E0 D4 E5 LDRB    LR, [R4,#0x14]
.text:75C7A3AC 15 C0 D4 E5 LDRB    R12, [R4,#0x15]
.text:75C7A3B0 16 10 D4 E5 LDRB    R1, [R4,#0x16]
.text:75C7A3B4 18 20 CD E5 STRB    R2, [SP,#0x4F0+var_4D8]
.text:75C7A3B8 19 30 CD E5 STRB    R3, [SP,#0x4F0+var_4D8+1]
.text:75C7A3BC 17 20 D4 E5 LDRB    R2, [R4,#0x17]
.text:75C7A3C0 18 30 D4 E5 LDRB    R3, [R4,#0x18]
.text:75C7A3C4 0A 00 A0 E1 MOV     R0, R10                         ; unsigned int
.text:75C7A3C8 1A 80 CD E5 STRB    R8, [SP,#0x4F0+var_4D8+2]
.text:75C7A3CC 1B E0 CD E5 STRB    LR, [SP,#0x4F0+var_4D8+3]
.text:75C7A3D0 1C C0 CD E5 STRB    R12, [SP,#0x4F0+var_4D4]
.text:75C7A3D4 1D 10 CD E5 STRB    R1, [SP,#0x4F0+var_4D4+1]
.text:75C7A3D8 1E 20 CD E5 STRB    R2, [SP,#0x4F0+var_4D4+2]
.text:75C7A3DC 1F 30 CD E5 STRB    R3, [SP,#0x4F0+var_4D4+3]
.text:75C7A3E0 9C E0 FF EB BL      malloc_0
.text:75C7A3E4 00 10 A0 E3 MOV     R1, #0
.text:75C7A3E8 00 80 A0 E1 MOV     R8, R0
.text:75C7A3EC 00 20 A0 E1 MOV     R2, R0                          ; char *
.text:75C7A3F0 00 10 8D E5 STR     R1, [SP,#0x4F0+var_4F0]         ; int
.text:75C7A3F4 0A 30 A0 E1 MOV     R3, R10                         ; unsigned int
.text:75C7A3F8 06 00 A0 E1 MOV     R0, R6                          ; this
.text:75C7A3FC 19 10 84 E2 ADD     R1, R4, #0x19                   ; char *
.text:75C7A400 12 F9 FF EB BL      _ZN10llIlIlIlll10lllIIIllIIEPKcPcji ; llIlIlIlll::lllIIIllII(char const*,char *,uint,int)
.text:75C7A404 1C B0 9D E5 LDR     R11, [SP,#0x4F0+var_4D4]
.text:75C7A408 0B 00 A0 E1 MOV     R0, R11                         ; unsigned int
.text:75C7A40C 91 E0 FF EB BL      malloc_0                        ; 分配内存放解密后数据
.text:75C7A410 00 C0 A0 E3 MOV     R12, #0
.text:75C7A414 20 30 8D E2 ADD     R3, SP, #0x4F0+var_4D0
.text:75C7A418 00 A0 A0 E1 MOV     R10, R0
.text:75C7A41C 04 30 8D E5 STR     R3, [SP,#0x4F0+var_4EC]
.text:75C7A420 18 20 9D E5 LDR     R2, [SP,#0x4F0+var_4D8]
.text:75C7A424 00 30 A0 E1 MOV     R3, R0
.text:75C7A428 00 B0 8D E5 STR     R11, [SP,#0x4F0+var_4F0]
.text:75C7A42C 01 00 A0 E3 MOV     R0, #1
.text:75C7A430 08 10 A0 E1 MOV     R1, R8
.text:75C7A434 20 C0 8D E5 STR     R12, [SP,#0x4F0+var_4D0]
.text:75C7A438 21 1E 00 EB BL      _Z10IlllIIIIll10IIlIlIlllIPKhjPhjPj ; 解密出明文dll
.text:75C7A43C 00 00 50 E3 CMP     R0, #0
.text:75C7A440 3A 00 00 0A BEQ     loc_75C7A530
.text:75C7A444
.text:75C7A444             loc_75C7A444                            ; CODE XREF: hook_mono_image_open_from_data_with_name+418↓j
.text:75C7A444 0A 00 A0 E1 MOV     R0, R10                         ; void *
.text:75C7A448 90 E0 FF EB BL      _Z10IIIIIllIIlPv                ; IIIIIllIIl(void *)
.text:75C7A44C 08 00 A0 E1 MOV     R0, R8                          ; void *
.text:75C7A450 8E E0 FF EB BL      _Z10IIIIIllIIlPv                ; IIIIIllIIl(void *)
.text:75C7A454 06 00 A0 E1 MOV     R0, R6                          ; this
.text:75C7A458 DC F0 FF EB BL      _ZN10llIlIlIlllD2Ev             ; llIlIlIlll::~llIlIlIlll()
.text:75C7A45C
.text:75C7A45C             loc_75C7A45C                            ; CODE XREF: hook_mono_image_open_from_data_with_name+88↑j
.text:75C7A45C                                                     ; hook_mono_image_open_from_data_with_name+11C↑j ...
.text:75C7A45C F0 34 9D E5 LDR     R3, [SP,#0x4F0+arg_0]
.text:75C7A460 6C 11 9F E5 LDR     R1, =(dword_75CB4068 - 0x75C7A474)
.text:75C7A464 04 70 8D E5 STR     R7, [SP,#0x4F0+var_4EC]
.text:75C7A468 00 30 8D E5 STR     R3, [SP,#0x4F0+var_4F0]
.text:75C7A46C 01 10 8F E0 ADD     R1, PC, R1                      ; dword_75CB4068
.text:75C7A470 08 C0 91 E5 LDR     R12, [R1,#(dword_75CB4070 - 0x75CB4068)]
.text:75C7A474 0C 20 9D E5 LDR     R2, [SP,#0x4F0+var_4E4]
.text:75C7A478 09 30 A0 E1 MOV     R3, R9
.text:75C7A47C 04 00 A0 E1 MOV     R0, R4
.text:75C7A480 05 10 A0 E1 MOV     R1, R5
.text:75C7A484 3C FF 2F E1 BLX     R12
.text:75C7A488 00 80 A0 E1 MOV     R8, R0
.text:75C7A48C
.text:75C7A48C             loc_75C7A48C                            ; CODE XREF: hook_mono_image_open_from_data_with_name+3F4↓j
.text:75C7A48C 44 11 9F E5 LDR     R1, =(unk_75CACB70 - 0x75C7A49C)
.text:75C7A490 06 00 A0 E1 MOV     R0, R6                          ; this
.text:75C7A494 01 10 8F E0 ADD     R1, PC, R1                      ; unk_75CACB70 ; char *
.text:75C7A498 B0 FA FF EB BL      DecString
.text:75C7A49C 06 00 A0 E1 MOV     R0, R6
.text:75C7A4A0 94 F9 FF EB BL      _ZN10lIIIlIlIIlcvPcEv           ; lIIIlIlIIl::operator char *(void)
.text:75C7A4A4 00 10 A0 E1 MOV     R1, R0                          ; needle
.text:75C7A4A8 07 00 A0 E1 MOV     R0, R7                          ; haystack
.text:75C7A4AC 69 D9 FF EB BL      strstr
.text:75C7A4B0 00 70 A0 E1 MOV     R7, R0
.text:75C7A4B4 06 00 A0 E1 MOV     R0, R6                          ; this
.text:75C7A4B8 6C F9 FF EB BL      _ZN10lIIIlIlIIlD2Ev             ; lIIIlIlIIl::~lIIIlIlIIl()
.text:75C7A4BC 00 00 57 E3 CMP     R7, #0
.text:75C7A4C0 00 00 55 13 CMPNE   R5, #0
.text:75C7A4C4 04 00 00 0A BEQ     loc_75C7A4DC
.text:75C7A4C8 00 30 A0 E3 MOV     R3, #0
.text:75C7A4CC 05 50 84 E0 ADD     R5, R4, R5
.text:75C7A4D0
.text:75C7A4D0             loc_75C7A4D0                            ; CODE XREF: hook_mono_image_open_from_data_with_name+3A0↓j
.text:75C7A4D0 01 30 C4 E4 STRB    R3, [R4],#1
.text:75C7A4D4 05 00 54 E1 CMP     R4, R5
.text:75C7A4D8 FC FF FF 1A BNE     loc_75C7A4D0
.text:75C7A4DC
.text:75C7A4DC             loc_75C7A4DC                            ; CODE XREF: hook_mono_image_open_from_data_with_name+38C↑j
.text:75C7A4DC                                                     ; hook_mono_image_open_from_data_with_name+3EC↓j
.text:75C7A4DC 08 30 9D E5 LDR     R3, [SP,#0x4F0+var_4E8]
.text:75C7A4E0 C4 24 9D E5 LDR     R2, [SP,#0x4F0+var_2C]
.text:75C7A4E4 08 00 A0 E1 MOV     R0, R8
.text:75C7A4E8 00 30 93 E5 LDR     R3, [R3]
.text:75C7A4EC 03 00 52 E1 CMP     R2, R3
.text:75C7A4F0 24 00 00 1A BNE     loc_75C7A588
.text:75C7A4F4 13 DD 8D E2 ADD     SP, SP, #0x4C0
.text:75C7A4F8 0C D0 8D E2 ADD     SP, SP, #0xC
.text:75C7A4FC F0 8F BD E8 LDMFD   SP!, {R4-R11,PC}
解密后 dump dll R10是基址,R11是大小,如下图:

9

9

[Asm] 纯文本查看 复制代码
static main(void)
    {
        auto fp, begin, end, dexbyte;
        fp = fopen("d:\\dump.dll", "wb"); //打开或创建一个文件
        begin =  R10;              //dll基址
        end = begin + R11;            //dll基址 + dll文件大小
        for ( dexbyte = begin; dexbyte < end;dexbyte ++ )
        {
            fputc(Byte(dexbyte), fp);     //按字节将其dump到本地文件中
        }
    }
将dump出来的dll反编后如下图:

10

10

3.在hook_mono_assembly_load_from_full主要是计算将解密dll的PE头清楚后的计算crc值。七: libengine模块分析1. 在com/inca/security/Core/AppGuardEngine类中注册的第一个Native函数中通过dlopen、dlsym调用libengine.sox解密的soJNI比函数   .text:75C81168  IlIIIIIIII (文件偏移 13168)         (Landroid/content/Context;Ljava/lang/String;[B)I2.通过dlopen、dlsym获取下面3个函数。
以下这几个函数被调用
Initialize         (文件偏移27144)
CreateObject        (文件偏移2A2F4)
Clazz::IlIllllIIl (文件偏移2B1B0)3. Initialize函数
[Asm] 纯文本查看 复制代码
//反调试 
.text:7CEAE17A             loc_7CEAE17A                            ; CODE XREF: Initialize+32↑j
.text:7CEAE17A CC 4B       LDR     R3, =(_ZN10lllllIIIll11IIlIlIIIlllE_ptr - 0x7CF87D44)
.text:7CEAE17C EB 58       LDR     R3, [R5,R3]
.text:7CEAE17E 1E 60       STR     R6, [R3]                        ; lllllIIIll::IIlIlIIIlll
.text:7CEAE180 19 F0 B6 FD BL      Anit_Dbg                        ; 反调试(读进程状态)
.text:7CEAE184 B8 42       CMP     R0, R7
.text:7CEAE186 00 D0       BEQ     loc_7CEAE18A
.text:7CEAE188 D4 E1       B       loc_7CEAE534

//动态获取函数
.text:7CEAE33A             loc_7CEAE33A                            ; CODE XREF: Initialize+1F2↑j
.text:7CEAE33A 1A 60       STR     R2, [R3]                        ; Global::llIlIllllI
.text:7CEAE33C 1E F0 DA FC BL      GetlibcFunc
.text:7CEAE340 1F F0 76 FD BL      GetlibdvmFunc
.text:7CEAE344 00 28       CMP     R0, #0
.text:7CEAE346 04 D0       BEQ     loc_7CEAE352
.text:7CEAE348 67 4B       LDR     R3, =(_ZN6Global11llllIIlIlIIE_ptr - 0x7CF87D44)
.text:7CEAE34A EB 58       LDR     R3, [R5,R3]
.text:7CEAE34C 04 93       STR     R3, [SP,#0x1A8+var_198]
.text:7CEAE34E 01 23       MOVS    R3, #1
.text:7CEAE350 1E E0       B       loc_7CEAE390

4. CreateObject函数
计算libengine.sox解密后的函数crc (文件偏移 2A1F6)
[Asm] 纯文本查看 复制代码
.text:7CFA41F6             loc_7CFA41F6                            ; CODE XREF: IlllIIIlll::IlllIIIlll(_JNIEnv *,void *)+324↓j
.text:7CFA41F6 39 4B       LDR     R3, =(_ZN6Global11lIIIIIIIIIIE_ptr - 0x7D07AD44)
.text:7CFA41F8 07 9A       LDR     R2, [SP,#0xF8+var_DC]
.text:7CFA41FA F3 58       LDR     R3, [R6,R3]
.text:7CFA41FC 10 1C       MOVS    R0, R2                          ; void *
.text:7CFA41FE 1A 60       STR     R2, [R3]                        ; Global::lIIIIIIIIII
.text:7CFA4200 34 F0 26 F8 BL      GetCrc32                        ; 计算libengine.sox解密后的函数crc
.text:7CFA4204 36 4B       LDR     R3, =(_ZN6Global11lIIlIlIIIlIE_ptr - 0x7D07AD44)

计算CRC函数代码如下:
[Asm] 纯文本查看 复制代码
.text:7CFD8250             EXPORT GetCrc32
.text:7CFD8250             GetCrc32                                ; CODE XREF: IlllIIIlll::IlllIIIlll(_JNIEnv *,void *)+2E4↑p
.text:7CFD8250                                                     ; IlllIllIll::lIIIllIlIll(lIIIllIlllII *,int,IIlIllIlllll *,bool *,char *,bool)+88↑p ...
.text:7CFD8250             ; __unwind {
.text:7CFD8250 F8 B5       PUSH    {R3-R7,LR}
.text:7CFD8252 22 4B       LDR     R3, =(_ZN6Global10lIIllIllIlE_ptr - 0x7CFD825A)
.text:7CFD8254 00 25       MOVS    R5, #0
.text:7CFD8256 7B 44       ADD     R3, PC                          ; _ZN6Global10lIIllIllIlE_ptr
.text:7CFD8258 1B 68       LDR     R3, [R3]                        ; Global::lIIllIllIl
.text:7CFD825A 1B 68       LDR     R3, [R3]                        ; Global::lIIllIllIl
.text:7CFD825C 17 2B       CMP     R3, #0x17
.text:7CFD825E 3B DC       BGT     loc_7CFD82D8
.text:7CFD8260 04 1C       MOVS    R4, R0
.text:7CFD8262 17 2B       CMP     R3, #0x17
.text:7CFD8264 08 D1       BNE     loc_7CFD8278
.text:7CFD8266 1E 48       LDR     R0, =(_ZN6Global11IlIIIIlllllE_ptr - 0x7CFD826E)
.text:7CFD8268 1E 49       LDR     R1, =(aN - 0x7CFD8272)
.text:7CFD826A 78 44       ADD     R0, PC                          ; _ZN6Global11IlIIIIlllllE_ptr
.text:7CFD826C 00 68       LDR     R0, [R0]                        ; Global::IlIIIIlllll
.text:7CFD826E 79 44       ADD     R1, PC                          ; "N"
.text:7CFD8270 48 F0 BE FB BL      j_strcmp
.text:7CFD8274 A8 42       CMP     R0, R5
.text:7CFD8276 2F D0       BEQ     loc_7CFD82D8
.text:7CFD8278
.text:7CFD8278             loc_7CFD8278                            ; CODE XREF: GetCrc32+14↑j
.text:7CFD8278 00 26       MOVS    R6, #0
.text:7CFD827A 23 1C       MOVS    R3, R4
.text:7CFD827C 30 1C       MOVS    R0, R6                          ; this
.text:7CFD827E B0 33       ADDS    R3, #0xB0
.text:7CFD8280 1F 68       LDR     R7, [R3]
.text:7CFD8282
.text:7CFD8282             loc_7CFD8282                            ; CODE XREF: GetCrc32+84↓j
.text:7CFD8282 23 1C       MOVS    R3, R4
.text:7CFD8284 B4 33       ADDS    R3, #0xB4
.text:7CFD8286 1B 68       LDR     R3, [R3]
.text:7CFD8288 9E 42       CMP     R6, R3                          ; 判断是否结束
.text:7CFD828A 24 D2       BCS     loc_7CFD82D6
.text:7CFD828C 23 1C       MOVS    R3, R4
.text:7CFD828E BC 33       ADDS    R3, #0xBC
.text:7CFD8290 1B 68       LDR     R3, [R3]
.text:7CFD8292 B2 00       LSLS    R2, R6, #2
.text:7CFD8294 D5 58       LDR     R5, [R2,R3]
.text:7CFD8296
.text:7CFD8296             loc_7CFD8296                            ; CODE XREF: GetCrc32+80↓j
.text:7CFD8296 00 2D       CMP     R5, #0
.text:7CFD8298 1B D0       BEQ     loc_7CFD82D2
.text:7CFD829A 2B 01       LSLS    R3, R5, #4
.text:7CFD829C FB 18       ADDS    R3, R7, R3                      ; unsigned int
.text:7CFD829E 19 7B       LDRB    R1, [R3,#0xC]
.text:7CFD82A0 0A 11       ASRS    R2, R1, #4
.text:7CFD82A2 01 3A       SUBS    R2, #1
.text:7CFD82A4 01 2A       CMP     R2, #1
.text:7CFD82A6 0E D8       BHI     loc_7CFD82C6
.text:7CFD82A8 DA 89       LDRH    R2, [R3,#0xE]
.text:7CFD82AA 00 2A       CMP     R2, #0
.text:7CFD82AC 0B D0       BEQ     loc_7CFD82C6
.text:7CFD82AE 0F 22       MOVS    R2, #0xF
.text:7CFD82B0 0A 40       ANDS    R2, R1
.text:7CFD82B2 02 2A       CMP     R2, #2
.text:7CFD82B4 07 D1       BNE     loc_7CFD82C6
.text:7CFD82B6 22 1C       MOVS    R2, R4
.text:7CFD82B8 8C 32       ADDS    R2, #0x8C
.text:7CFD82BA 11 68       LDR     R1, [R2]
.text:7CFD82BC 5A 68       LDR     R2, [R3,#4]
.text:7CFD82BE 51 18       ADDS    R1, R2, R1                      ; unsigned int
.text:7CFD82C0 9A 68       LDR     R2, [R3,#8]                     ; unsigned __int8 *
.text:7CFD82C2 E5 F7 F1 FF BL      adler_adler32                   ; R1函数首地址,R2函数大小
.text:7CFD82C6
.text:7CFD82C6             loc_7CFD82C6                            ; CODE XREF: GetCrc32+56↑j
.text:7CFD82C6                                                     ; GetCrc32+5C↑j ...
.text:7CFD82C6 23 1C       MOVS    R3, R4
.text:7CFD82C8 C0 33       ADDS    R3, #0xC0
.text:7CFD82CA 1B 68       LDR     R3, [R3]
.text:7CFD82CC AD 00       LSLS    R5, R5, #2
.text:7CFD82CE 5D 59       LDR     R5, [R3,R5]
.text:7CFD82D0 E1 E7       B       loc_7CFD8296
.text:7CFD82D2             ; ---------------------------------------------------------------------------
.text:7CFD82D2
.text:7CFD82D2             loc_7CFD82D2                            ; CODE XREF: GetCrc32+48↑j
.text:7CFD82D2 01 36       ADDS    R6, #1
.text:7CFD82D4 D5 E7       B       loc_7CFD8282
.text:7CFD82D6             ; ---------------------------------------------------------------------------
.text:7CFD82D6
.text:7CFD82D6             loc_7CFD82D6                            ; CODE XREF: GetCrc32+3A↑j
.text:7CFD82D6 05 1C       ADDS    R5, R0, #0
.text:7CFD82D8
.text:7CFD82D8             loc_7CFD82D8                            ; CODE XREF: GetCrc32+E↑j
.text:7CFD82D8                                                     ; GetCrc32+26↑j
.text:7CFD82D8 28 1C       MOVS    R0, R5
.text:7CFD82DA F8 BD       POP     {R3-R7,PC}

5. IlIllllIIl 函数
计算libc.so代码节的crc值 与.text节的CRC(文件偏移398AE)
[Asm] 纯文本查看 复制代码
.text:7779C8AE 59 68       LDR     R1, [R3,#4]
.text:7779C8B0 33 69       LDR     R3, [R6,#0x10]                  ; unsigned int
.text:7779C8B2 C9 18       ADDS    R1, R1, R3                      ; unsigned int
.text:7779C8B4 0A F0 F8 FC BL      _ZN5adler7adler32EmPKhj         ; 计算libc.so代码节的crc值 AA4AC826

6.计算libcompatible.so函数的Crc与.text节的CRC
[Asm] 纯文本查看 复制代码
.text:7C88BAB2
.text:7C88BAB2             ; IlllIIIIlIl(IlIIlIIIll *)
.text:7C88BAB2             EXPORT _Z11IlllIIIIlIlP10IlIIlIIIll
.text:7C88BAB2             _Z11IlllIIIIlIlP10IlIIlIIIll            ; CODE XREF: IlllIllIll::IlIllIllll(lIIIllIlllII *,int,IIlIllIlllll *,bool *,char *,bool)+196↑p
.text:7C88BAB2                                                     ; IlllIllIll::IlllIllIll(_jobject *,int,long long,long long,uint,char **,char **,char **,char **,char **)+80C↑p
.text:7C88BAB2             ; __unwind {
.text:7C88BAB2 F8 B5       PUSH    {R3-R7,LR}
.text:7C88BAB4 00 26       MOVS    R6, #0
.text:7C88BAB6 FC 30       ADDS    R0, #0xFC
.text:7C88BAB8 04 1C       MOVS    R4, R0
.text:7C88BABA 87 6C       LDR     R7, [R0,#0x48]
.text:7C88BABC 30 1C       ADDS    R0, R6, #0                      ; this
.text:7C88BABE
.text:7C88BABE             loc_7C88BABE                            ; CODE XREF: IlllIIIIlIl(IlIIlIIIll *)+4E↓j
.text:7C88BABE A3 6A       LDR     R3, [R4,#0x28]
.text:7C88BAC0 9E 42       CMP     R6, R3                          ; 判断函数个数是否结束
.text:7C88BAC2 1E D2       BCS     locret_7C88BB02
.text:7C88BAC4 22 6B       LDR     R2, [R4,#0x30]
.text:7C88BAC6 B3 00       LSLS    R3, R6, #2
.text:7C88BAC8 9D 58       LDR     R5, [R3,R2]
.text:7C88BACA
.text:7C88BACA             loc_7C88BACA                            ; CODE XREF: IlllIIIIlIl(IlIIlIIIll *)+4A↓j
.text:7C88BACA 00 2D       CMP     R5, #0
.text:7C88BACC 17 D0       BEQ     loc_7C88BAFE                    ; i++
.text:7C88BACE 2B 01       LSLS    R3, R5, #4
.text:7C88BAD0 FB 18       ADDS    R3, R7, R3                      ; unsigned int
.text:7C88BAD2 19 7B       LDRB    R1, [R3,#0xC]
.text:7C88BAD4 0A 11       ASRS    R2, R1, #4
.text:7C88BAD6 01 3A       SUBS    R2, #1
.text:7C88BAD8 01 2A       CMP     R2, #1
.text:7C88BADA 0C D8       BHI     loc_7C88BAF6
.text:7C88BADC DA 89       LDRH    R2, [R3,#0xE]
.text:7C88BADE 00 2A       CMP     R2, #0
.text:7C88BAE0 09 D0       BEQ     loc_7C88BAF6
.text:7C88BAE2 0F 22       MOVS    R2, #0xF
.text:7C88BAE4 0A 40       ANDS    R2, R1
.text:7C88BAE6 02 2A       CMP     R2, #2
.text:7C88BAE8 05 D1       BNE     loc_7C88BAF6
.text:7C88BAEA 5A 68       LDR     R2, [R3,#4]
.text:7C88BAEC 21 6A       LDR     R1, [R4,#0x20]
.text:7C88BAEE 51 18       ADDS    R1, R2, R1                      ; unsigned int
.text:7C88BAF0 9A 68       LDR     R2, [R3,#8]                     ; unsigned __int8 *
.text:7C88BAF2 E5 F7 D9 FB BL      adler_adler32                   ; 计算crc32
.text:7C88BAF6
.text:7C88BAF6             loc_7C88BAF6                            ; CODE XREF: IlllIIIIlIl(IlIIlIIIll *)+28↑j
.text:7C88BAF6                                                     ; IlllIIIIlIl(IlIIlIIIll *)+2E↑j ...
.text:7C88BAF6 63 6B       LDR     R3, [R4,#0x34]
.text:7C88BAF8 AD 00       LSLS    R5, R5, #2
.text:7C88BAFA 5D 59       LDR     R5, [R3,R5]
.text:7C88BAFC E5 E7       B       loc_7C88BACA
.text:7C88BAFE             ; ---------------------------------------------------------------------------
.text:7C88BAFE
.text:7C88BAFE             loc_7C88BAFE                            ; CODE XREF: IlllIIIIlIl(IlIIlIIIll *)+1A↑j
.text:7C88BAFE 01 36       ADDS    R6, #1                          ; i++
.text:7C88BB00 DD E7       B       loc_7C88BABE
.text:7C88BB02             ; ---------------------------------------------------------------------------
.text:7C88BB02
.text:7C88BB02             locret_7C88BB02                         ; CODE XREF: IlllIIIIlIl(IlIIlIIIll *)+10↑j
.text:7C88BB02 F8 BD       POP     {R3-R7,PC}

计算so的.text节代码的crc值 (文件偏移 39860)
[Asm] 纯文本查看 复制代码
text:7C866860                                                     ; IlllIllIll::IlllIllIll(_jobject *,int,long long,long long,uint,char **,char **,char **,char **,char **)+8E2↑j
.text:7C866860 00 23       MOVS    R3, #0
.text:7C866862 06 93       STR     R3, [SP,#0xB20+var_B08]
.text:7C866864 03 9B       LDR     R3, [SP,#0xB20+var_B14]
.text:7C866866 00 2B       CMP     R3, #0
.text:7C866868 2C D0       BEQ     loc_7C8668C4                    ; 结束
.text:7C86686A
.text:7C86686A             loc_7C86686A                            ; CODE XREF: IlllIllIll::IlllIllIll(_jobject *,int,long long,long long,uint,char **,char **,char **,char **,char **)+94A↓j
.text:7C86686A 06 9B       LDR     R3, [SP,#0xB20+var_B08]
.text:7C86686C 09 9A       LDR     R2, [SP,#0xB20+var_AFC]
.text:7C86686E 93 42       CMP     R3, R2                          ; 判断是否结束
.text:7C866870 28 D0       BEQ     loc_7C8668C4                    ; 结束
.text:7C866872 28 1C       MOVS    R0, R5                          ; this
.text:7C866874 06 99       LDR     R1, [SP,#0xB20+var_B08]         ; unsigned int
.text:7C866876 1C F0 46 FE BL      _ZN10lIIIIllIII10lIlIIlIIll10IlIIlIlIllEj ; lIIIIllIII::lIlIIlIIll::IlIIlIlIll(uint)
.text:7C86687A 03 9B       LDR     R3, [SP,#0xB20+var_B14]
.text:7C86687C 02 68       LDR     R2, [R0]
.text:7C86687E 06 1C       MOVS    R6, R0
.text:7C866880 98 18       ADDS    R0, R3, R2
.text:7C866882 2B 68       LDR     R3, [R5]
.text:7C866884 5A 68       LDR     R2, [R3,#4]
.text:7C866886 9B 68       LDR     R3, [R3,#8]
.text:7C866888 D3 18       ADDS    R3, R2, R3
.text:7C86688A 98 42       CMP     R0, R3
.text:7C86688C 1C D8       BHI     loc_7C8668C8
.text:7C86688E 53 49       LDR     R1, =(aText - 0x7C866896)
.text:7C866890 05 22       MOVS    R2, #5
.text:7C866892 79 44       ADD     R1, PC                          ; ".text"
.text:7C866894 6C F0 74 FE BL      j_strncmp                       ; 判断是否为.text
.text:7C866898 00 28       CMP     R0, #0
.text:7C86689A 0F D1       BNE     loc_7C8668BC
.text:7C86689C D7 23       MOVS    R3, #0xD7
.text:7C86689E 72 69       LDR     R2, [R6,#0x14]                  ; unsigned __int8 *
.text:7C8668A0 9B 00       LSLS    R3, R3, #2
.text:7C8668A2 FA 50       STR     R2, [R7,R3]
.text:7C8668A4 D8 23       MOVS    R3, #0xD8
.text:7C8668A6 31 69       LDR     R1, [R6,#0x10]
.text:7C8668A8 9B 00       LSLS    R3, R3, #2
.text:7C8668AA F9 50       STR     R1, [R7,R3]
.text:7C8668AC 2B 68       LDR     R3, [R5]
.text:7C8668AE 59 68       LDR     R1, [R3,#4]
.text:7C8668B0 33 69       LDR     R3, [R6,#0x10]                  ; unsigned int
.text:7C8668B2 C9 18       ADDS    R1, R1, R3                      ; unsigned int
.text:7C8668B4 0A F0 F8 FC BL      adler_adler32                   ; 计算libc.so代码节的crc值
.text:7C8668B8 0A 9B       LDR     R3, [SP,#0xB20+var_AF8]
.text:7C8668BA F8 50       STR     R0, [R7,R3]
.text:7C8668BC
.text:7C8668BC             loc_7C8668BC                            ; CODE XREF: IlllIllIll::IlllIllIll(_jobject *,int,long long,long long,uint,char **,char **,char **,char **,char **)+922↑j
.text:7C8668BC 06 9B       LDR     R3, [SP,#0xB20+var_B08]
.text:7C8668BE 01 33       ADDS    R3, #1

7.判断是否有种破解工具与是否在模拟器中运行,创建线程检测比较CRC值。
检测是否有的非法工具部分字符串如下:
[Asm] 纯文本查看 复制代码
LuckyPatcher v4.1.9(幸运破解器)
LuckyPatcher v5.8.9
gamehacker (烧饼游戏修改器)
com.cih.game_cih:*(金手指)
(com.huluxia.gametools)葫芦侠
Cheat Engine修改器 
tcpdump
GenyMotion(模拟器)
Windroy
BlueStacks
org.sbtools.gamespeed燒餅修改器
org.game.master 游戏修改大师

在线程中比较CRC值。
[Asm] 纯文本查看 复制代码
.text:7D34674C             Cmp_Crc32                               ; CODE XREF: IlllIllIll::IIIlllIlllII(lIIIllIlllII *,IIlIllIlllll *)+40A↓p
.text:7D34674C                                                     ; IlllIllIll::lIllllllIlII(lIIIllIlllII *,IIlIllIlllll *)+4EA↓p ...
.text:7D34674C
.text:7D34674C             var_20          = -0x20
.text:7D34674C             var_1C          = -0x1C
.text:7D34674C             arg_0           =  0
.text:7D34674C             arg_8           =  8
.text:7D34674C
.text:7D34674C             ; __unwind {
.text:7D34674C F7 B5                       PUSH    {R0-R2,R4-R7,LR}
.text:7D34674E 0A AC                       ADD     R4, SP, #0x20+arg_8
.text:7D346750 24 78                       LDRB    R4, [R4]
.text:7D346752 00 94                       STR     R4, [SP,#0x20+var_20]
.text:7D346754 00 29                       CMP     R1, #0
.text:7D346756 05 D0                       BEQ     loc_7D346764
.text:7D346758 09 25                       MOVS    R5, #9
.text:7D34675A D4 00                       LSLS    R4, R2, #3
.text:7D34675C 0C 19                       ADDS    R4, R1, R4
.text:7D34675E 65 60                       STR     R5, [R4,#4]
.text:7D346760 00 25                       MOVS    R5, #0
.text:7D346762 A5 60                       STR     R5, [R4,#8]
.text:7D346764
.text:7D346764             loc_7D346764                            ; CODE XREF: Cmp_Crc32+A↑j
.text:7D346764 00 9C                       LDR     R4, [SP,#0x20+var_20]
.text:7D346766 00 2C                       CMP     R4, #0
.text:7D346768 07 D1                       BNE     loc_7D34677A
.text:7D34676A 8C 24 E4 00                 MOVS    R4, #0x460
.text:7D34676E 04 19                       ADDS    R4, R0, R4
.text:7D346770 24 68                       LDR     R4, [R4]
.text:7D346772 A4 05                       LSLS    R4, R4, #0x16
.text:7D346774 01 D5                       BPL     loc_7D34677A
.text:7D346776
.text:7D346776             loc_7D346776                            ; CODE XREF: Cmp_Crc32+38↓j
.text:7D346776                                                     ; Cmp_Crc32+58↓j
.text:7D346776 00 20                       MOVS    R0, #0
.text:7D346778 46 E0                       B       locret_7D346808
.text:7D34677A             ; ---------------------------------------------------------------------------
.text:7D34677A
.text:7D34677A             loc_7D34677A                            ; CODE XREF: Cmp_Crc32+1C↑j
.text:7D34677A                                                     ; Cmp_Crc32+28↑j
.text:7D34677A 24 4C                       LDR     R4, =(_ZN6Global10llIIIlIlIIE_ptr - 0x7D346780)
.text:7D34677C 7C 44                       ADD     R4, PC          ; _ZN6Global10llIIIlIlIIE_ptr
.text:7D34677E 24 68                       LDR     R4, [R4]        ; Global::llIIIlIlII
.text:7D346780 26 78                       LDRB    R6, [R4]        ; Global::llIIIlIlII
.text:7D346782 00 2E                       CMP     R6, #0
.text:7D346784 F7 D1                       BNE     loc_7D346776
.text:7D346786 1D 1C                       MOVS    R5, R3
.text:7D346788 21 4B                       LDR     R3, =(_ZN6Global11lIIIIIIIIIIE_ptr - 0x7D346790)
.text:7D34678A 04 1C                       MOVS    R4, R0
.text:7D34678C 7B 44                       ADD     R3, PC          ; _ZN6Global11lIIIIIIIIIIE_ptr
.text:7D34678E 1B 68                       LDR     R3, [R3]        ; Global::lIIIIIIIIII
.text:7D346790 01 92                       STR     R2, [SP,#0x20+var_1C]
.text:7D346792 0F 1C                       MOVS    R7, R1
.text:7D346794 18 68                       LDR     R0, [R3]        ; void *
.text:7D346796 29 F0 5B FD                 BL      GetCrc32
.text:7D34679A 1E 4B                       LDR     R3, =(_ZN6Global11lIIlIlIIIlIE_ptr - 0x7D3467A0)
.text:7D34679C 7B 44                       ADD     R3, PC          ; _ZN6Global11lIIlIlIIIlIE_ptr
.text:7D34679E 1B 68                       LDR     R3, [R3]        ; Crc32Dword_E13E1FA9
.text:7D3467A0 1B 68                       LDR     R3, [R3]
.text:7D3467A2 98 42                       CMP     R0, R3          ; 比较crc32值
.text:7D3467A4 E7 D0                       BEQ     loc_7D346776
.text:7D3467A6 1C 4A                       LDR     R2, =(_ZN10IlllIllIll11llllIllIIIlE - 0x7D3467AC)
.text:7D3467A8 7A 44                       ADD     R2, PC          ; IlllIllIll::llllIllIIIl
.text:7D3467AA 13 68                       LDR     R3, [R2]        ; IlllIllIll::llllIllIIIl
.text:7D3467AC 01 33                       ADDS    R3, #1
.text:7D3467AE 13 60                       STR     R3, [R2]        ; IlllIllIll::llllIllIIIl
.text:7D3467B0 00 2D                       CMP     R5, #0
.text:7D3467B2 1D D0                       BEQ     loc_7D3467F0
.text:7D3467B4 02 21                       MOVS    R1, #2
.text:7D3467B6 2A 68                       LDR     R2, [R5]
.text:7D3467B8 13 01                       LSLS    R3, R2, #4
.text:7D3467BA EB 18                       ADDS    R3, R5, R3
.text:7D3467BC 59 60                       STR     R1, [R3,#4]
.text:7D3467BE 0A 21                       MOVS    R1, #0xA
.text:7D3467C0 DE 60                       STR     R6, [R3,#0xC]
.text:7D3467C2 99 60                       STR     R1, [R3,#8]
.text:7D3467C4 1E 61                       STR     R6, [R3,#0x10]
.text:7D3467C6 08 9B                       LDR     R3, [SP,#0x20+arg_0]
.text:7D3467C8 01 32                       ADDS    R2, #1
.text:7D3467CA 2A 60                       STR     R2, [R5]
.text:7D3467CC 00 2B                       CMP     R3, #0
.text:7D3467CE 02 D0                       BEQ     loc_7D3467D6
.text:7D3467D0 01 23                       MOVS    R3, #1
.text:7D3467D2 08 9A                       LDR     R2, [SP,#0x20+arg_0]
.text:7D3467D4 13 70                       STRB    R3, [R2]
.text:7D3467D6
.text:7D3467D6             loc_7D3467D6                            ; CODE XREF: Cmp_Crc32+82↑j
.text:7D3467D6 00 9B                       LDR     R3, [SP,#0x20+var_20]
.text:7D3467D8 00 2B                       CMP     R3, #0
.text:7D3467DA 09 D1                       BNE     loc_7D3467F0
.text:7D3467DC 8D 23 DB 00                 MOVS    R3, #0x468
.text:7D3467E0 E3 18                       ADDS    R3, R4, R3
.text:7D3467E2 1B 68                       LDR     R3, [R3]
.text:7D3467E4 9B 05                       LSLS    R3, R3, #0x16
.text:7D3467E6 03 D4                       BMI     loc_7D3467F0
.text:7D3467E8 0C 4A                       LDR     R2, =0x49C
.text:7D3467EA A3 58                       LDR     R3, [R4,R2]
.text:7D3467EC 01 33                       ADDS    R3, #1
.text:7D3467EE A3 50                       STR     R3, [R4,R2]
.text:7D3467F0
.text:7D3467F0             loc_7D3467F0                            ; CODE XREF: Cmp_Crc32+66↑j
.text:7D3467F0                                                     ; Cmp_Crc32+8E↑j ...
.text:7D3467F0 00 2F                       CMP     R7, #0
.text:7D3467F2 04 D0                       BEQ     loc_7D3467FE
.text:7D3467F4 01 9B                       LDR     R3, [SP,#0x20+var_1C]
.text:7D3467F6 DA 00                       LSLS    R2, R3, #3
.text:7D3467F8 AA 23                       MOVS    R3, #0xAA
.text:7D3467FA BA 18                       ADDS    R2, R7, R2
.text:7D3467FC 93 60                       STR     R3, [R2,#8]
.text:7D3467FE
.text:7D3467FE             loc_7D3467FE                            ; CODE XREF: Cmp_Crc32+A6↑j
.text:7D3467FE 01 20                       MOVS    R0, #1
.text:7D346800 07 4B                       LDR     R3, =(_ZN6Global10lIlIIllIIlE_ptr - 0x7D346806)
.text:7D346802 7B 44                       ADD     R3, PC          ; _ZN6Global10lIlIIllIIlE_ptr
.text:7D346804 1B 68                       LDR     R3, [R3]        ; Global::lIlIIllIIl
.text:7D346806 58 72                       STRB    R0, [R3,#(byte_7D413581 - 0x7D413578)]
.text:7D346808
.text:7D346808             locret_7D346808                         ; CODE XREF: Cmp_Crc32+2C↑j
.text:7D346808 FE BD                       POP     {R1-R7,PC}

截图监控
[Asm] 纯文本查看 复制代码
.text:7D34B944 2A 49                       LDR     R1, =(unk_7D3E51F8 - 0x7D34B94E)
.text:7D34B946 3D 59                       LDR     R5, [R7,R4]
.text:7D34B948 7F AC                       ADD     R4, SP, #0xB20+var_924
.text:7D34B94A 79 44                       ADD     R1, PC          ; unk_7D3E51F8
.text:7D34B94C 20 1C                       MOVS    R0, R4          ; this
.text:7D34B94E 4C 31                       ADDS    R1, #0x4C ; 'L' ; char *
.text:7D34B950 0A F0 62 F8                 BL      DecString
.text:7D34B954 20 1C                       MOVS    R0, R4
.text:7D34B956 09 F0 77 FF                 BL      _ZN10IIllIIlIIIcvPcEv ; IIllIIlIII::operator char *(void)
.text:7D34B95A 01 1C                       MOVS    R1, R0
.text:7D34B95C 04 22                       MOVS    R2, #4
.text:7D34B95E 28 1C                       MOVS    R0, R5
.text:7D34B960 6D F0 9E F8                 BL      j_inotify_add_watch ; 截图监控
.text:7D34B964 E0 25 AD 00                 MOVS    R5, #0x380
.text:7D34B968 78 51                       STR     R0, [R7,R5]
.text:7D34B96A 20 1C                       MOVS    R0, R4          ; this
.text:7D34B96C 09 F0 42 FF                 BL      _ZN10IIllIIlIIID2Ev ; IIllIIlIII::~IIllIIlIII()
.text:7D34B970 7B 59                       LDR     R3, [R7,R5]
.text:7D34B972 00 2B                       CMP     R3, #0
.text:7D34B974 10 DA                       BGE     loc_7D34B998
.text:7D34B976 00 23                       MOVS    R3, #0
.text:7D34B978 1E 4A                       LDR     R2, =(a5eddcc418cda8d - 0x7D34B988)

八:总结
1.该反外挂系统主要有字符串加密保护,客户端完整性检查(CRC+签
名),函数及变量、反调试保护,系统so文件校验, 自身so文件校验,U3D防护,画面截屏保护,内存防修改保护,但是so本身只做了函数名混淆与字符串加密,代码没有做保护处理,逆向起来还是比较容易。
某手游反外挂分析.zip (1 MB, 下载次数: 117)
样本:: https://pan.baidu.com/s/1dFPbyLj 密码: 7h2r

免费评分

参与人数 86吾爱币 +83 热心值 +79 收起 理由
RoB1n_Ho0d + 1 热心回复!
gezigezao + 1 + 1 我很赞同!
zzzlucas + 1 + 1 谢谢@Thanks!
vince991 + 1 + 1 我很赞同!
挥洒灵魂 + 1 谢谢@Thanks!
xiaoxi2011 + 1 + 1 谢谢@Thanks!
linzi0713 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
我在乎你 + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
大毛孩 + 1 + 1 我很赞同!
村上村夫 + 2 + 2 我很赞同!
zpj881218 + 1 + 1 用心讨论,共获提升!
xiaochong2018 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
Mouse + 1 + 1 谢谢@Thanks!
违规昵称85 + 1 + 1 用心讨论,共获提升!
fu90 + 1 + 1 已答复!
葡萄demo + 1 + 1 谢谢@Thanks!
ZFHCYL + 1 + 1 用心讨论,共获提升!
liphily + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
LLLTheone + 1 + 1 我很赞同!
CaryLee + 1 + 1 我很赞同!
siuhoapdou + 1 + 1 谢谢@Thanks!
Elements + 1 用心讨论,共获提升!
ttxian + 1 + 1 我很赞同!
jiexia + 1 + 1 我很赞同!
异度猪仔 + 1 + 1 热心回复!
peter_king + 1 谢谢@Thanks!
jpex + 1 + 1 龟龟 这也太真实了吧
njtclzg + 1 好厉害,
ganyilu + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
账号 + 1 + 1 用心讨论,共获提升!
q110 + 1 + 1 用心讨论,共获提升!
ykz5151927 + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
鸡儿在学习 + 1 + 1 热心回复!
sblc159 + 1 + 1 太可怕了
梦儿小虐 + 1 + 1 用心讨论,共获提升!
懒癌萌妹子 + 1 + 1 热心回复!
zamliage + 1 + 1 这确实是大神啊!
jianmingyou + 1 + 1 用心讨论,共获提升!
小_Ta + 1 + 1 用心讨论,共获提升!
qq623954006 + 1 用心讨论,共获提升!
z79097397 + 1 + 1 热心回复!
d_apple + 1 + 1 谢谢@Thanks!看起来一点都不容易啦大佬
绝迹浪雨 + 1 + 1 用心讨论,共获提升!
至尊舞帝 + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
a君莫笑 + 1 + 1 热心回复!
krdn + 1 + 1 谢谢@Thanks!
水雨争枫 + 1 + 1 用心讨论,共获提升!
sunnylds7 + 1 + 1 谢谢@Thanks!
快乐交友 + 1 + 1 谢谢@Thanks!
昵_称 + 1 + 1 我很赞同!
至尊灬骉哥 + 1 看着脑袋都疼,真厉害大神
XhyEax + 1 + 1 我很赞同!
cyj1236786 + 1 + 1 用心讨论,共获提升!
yuyingjie0108 + 1 + 1 我很赞同!
lejunyang + 1 + 1 热心回复!
MJxj2004 + 1 + 1 鼓励转贴优秀软件安全工具和文档!
qwez007 + 1 + 1 真的大神
alccc + 1 + 1 用心讨论,共获提升!
回到52像回家 + 1 + 1 看懂看不懂无所谓,知道LZ是大牛就对了。膜拜
黄俊熙 + 1 + 1 热心回复!
sermy + 1 + 1 虽然看不懂,但感觉还是很牛逼的样子
zhou1758818844 + 1 我很赞同!
大师兄啊 + 1 + 1 已答复!
xiaoleilll + 1 + 1 谢谢@Thanks!
海底总动员 + 1 我很赞同!
策士 + 1 + 1 鼓励转贴优秀软件安全工具和文档!
a435751757 + 1 + 1 牛逼,有点大神的样子
a5606495 + 1 + 1 用心讨论,共获提升!
hyruur + 1 用心讨论,共获提升!
zhoudada + 1 + 1 用心讨论,共获提升!
dryzh + 2 三哥威武!三哥霸气!
snccwt + 1 热心回复!
i52088 + 1 用心讨论,共获提升!
qaz003 + 1 + 1 谢谢@Thanks!
chenjingyes + 1 + 1 热心回复!
zhh4827 + 1 + 1 谢谢@Thanks!
qw123456qw + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
demon_lin + 1 + 1 谢谢@Thanks!
kilkilo502 + 1 用心讨论,共获提升!
qq06314488 + 1 + 1 谢谢@Thanks!
hentai22 + 1 + 1 我很赞同!
Faithful丶o + 1 + 1 大牛你的ID有点,,,
Tim-52Pojie + 1 + 1 我很赞同!
h080294 + 1 + 1 我很赞同!
另类飞翔 + 2 + 1 用心讨论,共获提升!
空城^ + 1 + 1 用心讨论,共获提升!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

头像被屏蔽
求订制个封包 发表于 2017-11-1 14:47 来自手机
提示: 该帖被管理员或版主屏蔽
lcbnooo 发表于 2017-11-1 14:35
Rember、 发表于 2017-11-1 14:58
viply 发表于 2017-11-1 15:40
楼主发的帖子都是精华啊。。
破碎ぃ 发表于 2017-11-1 17:01
哇  这个 不发则以一发入魂阿- -顶楼主
jian847787411 发表于 2017-11-1 17:13
绝壁精品 留个爪 学习了
anhkgg 发表于 2017-11-1 17:22
先m再看,学习!
樂℡ 发表于 2017-11-1 17:33
膜拜大神!!!
Shutd0wn 发表于 2017-11-1 18:17
谢谢三哥
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-15 13:21

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表