首页
社区
课程
招聘
[原创]某手游完整性校验分析
发表于: 2023-11-2 23:16 17485

[原创]某手游完整性校验分析

2023-11-2 23:16
17485

只是普通的单机手游,广告比较多,所以分析处理了下,校验流程蛮有意思的,所以就分享出来了

样本进行了加固,对其dump出dex后重打包出现崩溃

ida分析地址发现为jni函数引起



利用Xposed直接替换该函数,崩溃问题解决

但是出现了新的问题,游戏卡在了加载页面



对该类的其他jni函数进行分析,发现supportVulkan很明显进行了签名读取,对其去除签名校验。

此处参考项目:ApkSignatureKillerEx

去除完签名校验后,游戏能正常进入主页面,但是点击游戏地图没有任何反应。

在对原包进行多次测试发现,在首次启动游戏时,如果断网也会出现无法正常进入地图的问题,怀疑是游戏首次启动进行了网络请求进行数据校验

经过抓包对比定位到可疑数据包

利用Frida的算法通杀脚本没有定位到相关内容,怀疑是so层进行了请求

通过调用栈可以很清晰看到请求是从unity引擎相关的so中发出的。

查阅资料,在unity中,网络请求主要通过UnityWebRequest 类来执行网络请求,利用frida-il2cpp-bridge对UnityWebRequest进行trace,打印调用栈得

在IDA中进行交叉引用分析定位到UnitySDKManager类

增加UnitySDKManager类重新对其trace(因为出现报错,把参数输出关了)

通过调用栈可以初步对校验流程进行了解,主要通过ServerVerifyApk函数进行校验,经过一系列字符串加解密,最后进行网络请求

对关键函数进行hook分析

发现之前抓包获得的请求体相对应,其中,appFileList还是密文,继续分析

与dump.cs中的函数进行对照发现v14 由字符串转hex转base64获得

hook HexStringToHex 函数获得参数

IDA继续查找调用发现其中字符串由GetFileInfoList函数获得

很明显,调用了libUnitySDK.so中的GetFileInfoList函数获得

FileInfoListStr在writeFileJson函数中被赋值,而writeFileJson则是由java函数上文中的IsHDR_DisplayBoot调用(该函数首个参数为base.apk路径)

很明显,ll11l1l1ll函数 对之前的明文字符串进行了加密,frida hook打印参数

其中 HashList 中文件对应的值为文件的 crc
至此,除了具体的字符串加密算法,游戏的校验流程已经很清晰

对该校验去除的思路:

ps.仅限于学习交流,切勿用于商业用途,若造成侵权,请联系作者处理。
样本链接:https://pan.baidu.com/s/1awWYCF2nT50qPRj8_CRt-A?pwd=d8wn

XposedHelpers.findAndHookMethod("com.unity3d.player.UnityPlayerActivity", classLoader, "IsHDR_DisplayBoot", java.lang.String.class, java.lang.String.class, new XC_MethodReplacement() {
    @Override
    protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
        return null;
    }
});
XposedHelpers.findAndHookMethod("com.unity3d.player.UnityPlayerActivity", classLoader, "IsHDR_DisplayBoot", java.lang.String.class, java.lang.String.class, new XC_MethodReplacement() {
    @Override
    protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
        return null;
    }
});
0x0247db9c ┌─UnityEngine.Networking.UnityWebRequest::.ctor(this = UnityEngine.Networking.UnityWebRequest, url = "http://106.54.194.167:8077/CheckUpdate", method = "POST")
0x0247db00 │ ┌─UnityEngine.Networking.UnityWebRequest::set_url(this = UnityEngine.Networking.UnityWebRequest, value = "http://106.54.194.167:8077/CheckUpdate")
0x0247ef38 │ │ ┌─UnityEngine.Networking.UnityWebRequest::InternalSetUrl(this = UnityEngine.Networking.UnityWebRequest, url = "http://106.54.194.167:8077/CheckUpdate")
0x0247ef38 │ │ └─UnityEngine.Networking.UnityWebRequest::InternalSetUrl
0x0247db00 │ └─UnityEngine.Networking.UnityWebRequest::set_url
0x0247dc1c │ ┌─UnityEngine.Networking.UnityWebRequest::set_method(this = UnityEngine.Networking.UnityWebRequest, value = "POST")
0x0247e4e0 │ │ ┌─UnityEngine.Networking.UnityWebRequest::InternalSetMethod(this = UnityEngine.Networking.UnityWebRequest, methodType = Post)
0x0247e4e0 │ │ └─UnityEngine.Networking.UnityWebRequest::InternalSetMethod
0x0247dc1c │ └─UnityEngine.Networking.UnityWebRequest::set_method
0x0247db9c └─UnityEngine.Networking.UnityWebRequest::.ctor
0x0247db9c ┌─UnityEngine.Networking.UnityWebRequest::.ctor(this = UnityEngine.Networking.UnityWebRequest, url = "http://106.54.194.167:8077/CheckUpdate", method = "POST")
0x0247db00 │ ┌─UnityEngine.Networking.UnityWebRequest::set_url(this = UnityEngine.Networking.UnityWebRequest, value = "http://106.54.194.167:8077/CheckUpdate")
0x0247ef38 │ │ ┌─UnityEngine.Networking.UnityWebRequest::InternalSetUrl(this = UnityEngine.Networking.UnityWebRequest, url = "http://106.54.194.167:8077/CheckUpdate")
0x0247ef38 │ │ └─UnityEngine.Networking.UnityWebRequest::InternalSetUrl
0x0247db00 │ └─UnityEngine.Networking.UnityWebRequest::set_url
0x0247dc1c │ ┌─UnityEngine.Networking.UnityWebRequest::set_method(this = UnityEngine.Networking.UnityWebRequest, value = "POST")
0x0247e4e0 │ │ ┌─UnityEngine.Networking.UnityWebRequest::InternalSetMethod(this = UnityEngine.Networking.UnityWebRequest, methodType = Post)
0x0247e4e0 │ │ └─UnityEngine.Networking.UnityWebRequest::InternalSetMethod
0x0247dc1c │ └─UnityEngine.Networking.UnityWebRequest::set_method
0x0247db9c └─UnityEngine.Networking.UnityWebRequest::.ctor
追踪调用定位到
class UnitySDK.UnitySDKManager.<PostData>d__25 : System.Object, System.Collections.Generic.IEnumerator<System.Object>, System.Collections.IEnumerator, System.IDisposable
    private Boolean MoveNext() { }
追踪调用定位到
class UnitySDK.UnitySDKManager.<PostData>d__25 : System.Object, System.Collections.Generic.IEnumerator<System.Object>, System.Collections.IEnumerator, System.IDisposable
    private Boolean MoveNext() { }
0x00b15b44 ┌─UnitySDK.UnitySDKManager::ServerVerifyApk
0x00b04b3c │ ┌─UnitySDK.UnitySDKManager::GetFileInfoList
0x00b04b3c │ └─UnitySDK.UnitySDKManager::GetFileInfoList
0x00b06ec0 │ ┌─UnitySDK.UnitySDKManager::GetGamePackageName
0x00b06ec0 │ └─UnitySDK.UnitySDKManager::GetGamePackageName
0x00b06204 │ ┌─UnitySDK.UnitySDKManager::GetSDKVersion
0x00b06204 │ └─UnitySDK.UnitySDKManager::GetSDKVersion
0x00b06278 │ ┌─UnitySDK.UnitySDKManager::HexStringToHex
0x00b06278 │ └─UnitySDK.UnitySDKManager::HexStringToHex
0x00b10fcc │ ┌─UnitySDK.UnitySDKManager::EncryptString
0x00b10fcc │ └─UnitySDK.UnitySDKManager::EncryptString
0x00b100a4 │ ┌─UnitySDK.UnitySDKManager::PostData
0x00a341fc │ │ ┌─UnitySDK.UnitySDKManager.<PostData>d__25::.ctor
0x00a341fc │ │ └─UnitySDK.UnitySDKManager.<PostData>d__25::.ctor
0x00b100a4 │ └─UnitySDK.UnitySDKManager::PostData
0x00a3422c │ ┌─UnitySDK.UnitySDKManager.<PostData>d__25::MoveNext
0x00b12be4 │ │ ┌─UnitySDK.UnitySDKManager::GetUrl
0x00b12be4 │ │ └─UnitySDK.UnitySDKManager::GetUrl
0x0247db9c │ │ ┌─UnityEngine.Networking.UnityWebRequest::.ctor
0x0247db00 │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::set_url
0x0247ef38 │ │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::InternalSetUrl
0x0247ef38 │ │ │ │ └─UnityEngine.Networking.UnityWebRequest::InternalSetUrl
0x0247db00 │ │ │ └─UnityEngine.Networking.UnityWebRequest::set_url
0x0247dc1c │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::set_method
0x0247e4e0 │ │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::InternalSetMethod
0x0247e4e0 │ │ │ │ └─UnityEngine.Networking.UnityWebRequest::InternalSetMethod
0x0247dc1c │ │ │ └─UnityEngine.Networking.UnityWebRequest::set_method
0x0247db9c │ │ └─UnityEngine.Networking.UnityWebRequest::.ctor
0x0247e0f4 │ │ ┌─UnityEngine.Networking.UnityWebRequest::set_uploadHandler
0x0247e0f4 │ │ └─UnityEngine.Networking.UnityWebRequest::set_uploadHandler
0x0247dfdc │ │ ┌─UnityEngine.Networking.UnityWebRequest::set_downloadHandler
0x0247dfdc │ │ └─UnityEngine.Networking.UnityWebRequest::set_downloadHandler
0x0247f66c │ │ ┌─UnityEngine.Networking.UnityWebRequest::SetRequestHeader
0x0247f66c │ │ └─UnityEngine.Networking.UnityWebRequest::SetRequestHeader
0x0247e42c │ │ ┌─UnityEngine.Networking.UnityWebRequest::Send
0x0247e430 │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::SendWebRequest
0x0247e42c │ │ │ └─UnityEngine.Networking.UnityWebRequest::Send
0x0247e430 │ │ └─UnityEngine.Networking.UnityWebRequest::SendWebRequest
0x00a3422c │ └─UnitySDK.UnitySDKManager.<PostData>d__25::MoveNext
0x00a34cd4 │ ┌─UnitySDK.UnitySDKManager.<PostData>d__25::System.Collections.IEnumerator.get_Current
0x00a34cd4 │ └─UnitySDK.UnitySDKManager.<PostData>d__25::System.Collections.IEnumerator.get_Current
0x00b15b44 └─UnitySDK.UnitySDKManager::ServerVerifyApk
0x00b15b44 ┌─UnitySDK.UnitySDKManager::ServerVerifyApk
0x00b04b3c │ ┌─UnitySDK.UnitySDKManager::GetFileInfoList
0x00b04b3c │ └─UnitySDK.UnitySDKManager::GetFileInfoList
0x00b06ec0 │ ┌─UnitySDK.UnitySDKManager::GetGamePackageName
0x00b06ec0 │ └─UnitySDK.UnitySDKManager::GetGamePackageName
0x00b06204 │ ┌─UnitySDK.UnitySDKManager::GetSDKVersion
0x00b06204 │ └─UnitySDK.UnitySDKManager::GetSDKVersion
0x00b06278 │ ┌─UnitySDK.UnitySDKManager::HexStringToHex
0x00b06278 │ └─UnitySDK.UnitySDKManager::HexStringToHex
0x00b10fcc │ ┌─UnitySDK.UnitySDKManager::EncryptString
0x00b10fcc │ └─UnitySDK.UnitySDKManager::EncryptString
0x00b100a4 │ ┌─UnitySDK.UnitySDKManager::PostData
0x00a341fc │ │ ┌─UnitySDK.UnitySDKManager.<PostData>d__25::.ctor
0x00a341fc │ │ └─UnitySDK.UnitySDKManager.<PostData>d__25::.ctor
0x00b100a4 │ └─UnitySDK.UnitySDKManager::PostData
0x00a3422c │ ┌─UnitySDK.UnitySDKManager.<PostData>d__25::MoveNext
0x00b12be4 │ │ ┌─UnitySDK.UnitySDKManager::GetUrl
0x00b12be4 │ │ └─UnitySDK.UnitySDKManager::GetUrl
0x0247db9c │ │ ┌─UnityEngine.Networking.UnityWebRequest::.ctor
0x0247db00 │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::set_url
0x0247ef38 │ │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::InternalSetUrl
0x0247ef38 │ │ │ │ └─UnityEngine.Networking.UnityWebRequest::InternalSetUrl
0x0247db00 │ │ │ └─UnityEngine.Networking.UnityWebRequest::set_url
0x0247dc1c │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::set_method
0x0247e4e0 │ │ │ │ ┌─UnityEngine.Networking.UnityWebRequest::InternalSetMethod
0x0247e4e0 │ │ │ │ └─UnityEngine.Networking.UnityWebRequest::InternalSetMethod
0x0247dc1c │ │ │ └─UnityEngine.Networking.UnityWebRequest::set_method
0x0247db9c │ │ └─UnityEngine.Networking.UnityWebRequest::.ctor
0x0247e0f4 │ │ ┌─UnityEngine.Networking.UnityWebRequest::set_uploadHandler

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

最后于 2023-11-2 23:33 被wx_嗨编辑 ,原因: 编辑标题
收藏
免费 17
支持
分享
最新回复 (17)
雪    币: 3004
活跃值: (30866)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
感谢分享
2023-11-3 09:26
2
雪    币: 1671
活跃值: (215822)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
3
tql
2023-11-3 10:36
1
雪    币: 187
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
4
感谢分享
2023-11-3 11:25
1
雪    币: 3841
活跃值: (3414)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
tql
2023-11-3 13:25
1
雪    币: 2334
活跃值: (10386)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
666
2023-11-9 09:08
1
雪    币: 886
活跃值: (2310)
能力值: ( LV4,RANK:52 )
在线值:
发帖
回帖
粉丝
7
请问楼主样本还能分享一下吗
2023-11-13 22:35
1
雪    币: 226
活跃值: (2308)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
8
夏男人 请问楼主样本还能分享一下吗
误删了,已补
2023-11-14 11:48
2
雪    币: 116
活跃值: (1012)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
支持一下
2023-11-17 16:19
1
雪    币: 435
活跃值: (2641)
能力值: ( LV2,RANK:15 )
在线值:
发帖
回帖
粉丝
10
感谢分享
2023-11-23 16:25
1
雪    币: 3836
活跃值: (4142)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
感谢分享
2023-12-2 11:07
1
雪    币: 10
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
12
wx_嗨 误删了,已补
楼主,样本链接失效了,请问可以传论坛不
2024-1-4 09:42
1
雪    币: 27
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
13
dddd
2024-1-4 16:53
1
雪    币: 226
活跃值: (2308)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
14
mb_ldbucrik 楼主,样本链接失效了,请问可以传论坛不
补了
2024-1-15 10:00
1
雪    币: 6418
活跃值: (4822)
能力值: ( LV5,RANK:70 )
在线值:
发帖
回帖
粉丝
15
这个案例很不错啊,值得学习
2024-1-15 11:41
1
雪    币: 10
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
16
wx_嗨 补了
谢谢楼主
2024-1-19 22:32
1
雪    币: 150
活跃值: (1105)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
17
学习,新手能补下dump 和 frida脚本吗?新手想照做锻炼下
2024-10-22 01:28
0
雪    币: 27
活跃值: (1638)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
18
支持学习了!!!
2024-10-28 00:11
0
游客
登录 | 注册 方可回帖
返回
//