首页
社区
课程
招聘
flutter抓包绕过
2024-1-19 16:36 14594

flutter抓包绕过

2024-1-19 16:36
14594

flutter的证书校验

起因:

最近工作上让做个app的复测,把apk发我后,开始尝试挂代理抓包,结果发现抓不到
图片描述
图片描述
以为是证书没弄好,想着前几天不是刚导入了吗(雾)。又重新导入了下还是不行。然后各种lsp模块,objection都不行,r0capture也没数据。
然后jadx看了下,全是flutter字样,才想起来和flutter有关。
图片描述

开始百度(:

然后就开始各种找。https://bbs.kanxue.com/thread-261941.htm
根据上面文章找到关键函数handshake.cc386行
图片描述
session_verify_cert_chain函数在第356行的ssl_x509.cc中被定义
图片描述
然后根据https://bbs.kanxue.com/thread-261941.htm 这篇文章特征找,但是这个是32位的,所以在app安装的时候指定32位安装

1
adb install --abi armeabi-v7a <path to apk>

接下来就是找
图片描述
图片描述
往上翻找
图片描述

写脚本绕过

32位

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function hook_ssl_verify_result(address) {
Interceptor.attach(address, {
        onEnter: function(args) {
            console.log("Disabling SSL validation")
        },
        onLeave: function(retval) {
            console.log("Retval: " + retval);
            retval.replace(0x1);
        }
    });
}
function hookFlutter() {
    var m = Process.findModuleByName("libflutter.so");
    var pattern = "2D E9 F0 4F 85 B0 06 46 50 20 10 70";
    var res = Memory.scan(m.base, m.size, pattern, {
        onMatch: function(address, size){
            console.log('[+] ssl_verify_result found at: ' + address.toString());
        // Add 0x01 because it's a THUMB function
        // Otherwise, we would get 'Error: unable to intercept function at 0x9906f8ac; please file a bug'
            hook_ssl_verify_result(address.add(0x01));
        },
        onError: function(reason){
            console.log('[!] There was an error scanning memory');
        },
        onComplete: function() {
            console.log("All done")
        }
    });
}

然后启动就可以抓包了
图片描述

64位

搜索ssl_client
图片描述
图片描述
照例往上找
图片描述
然后就找到了这些

1
2
3
4
5
6
7
8
9
.text:0000000000596870 FF C3 01 D1                 SUB             SP, SP, #0x70
.text:0000000000596874 FD 7B 01 A9                 STP             X29, X30, [SP,#0x70+var_60]
.text:0000000000596878 FC 6F 02 A9                 STP             X28, X27, [SP,#0x70+var_50]
.text:000000000059687C FA 67 03 A9                 STP             X26, X25, [SP,#0x70+var_40]
.text:0000000000596880 F8 5F 04 A9                 STP             X24, X23, [SP,#0x70+var_30]
.text:0000000000596884 F6 57 05 A9                 STP             X22, X21, [SP,#0x70+var_20]
.text:0000000000596888 F4 4F 06 A9                 STP             X20, X19, [SP,#0x70+var_10]
.text:000000000059688C 08 0A 80 52                 MOV             W8, #0x50
.text:0000000000596890 48 00 00 39                 STRB            W8, [X2]

然后写脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function hook_ssl_verify_result(address) {
Interceptor.attach(address, {
        onEnter: function(args) {
            console.log("Disabling SSL validation")
        },
        onLeave: function(retval) {
            console.log("Retval: " + retval);
            retval.replace(0x1);
        }
    });
}
function hookFlutter() {
    var m = Process.findModuleByName("libflutter.so");
    var pattern = "FF C3 01 D1 FD 7B 01 A9 FC 6F 02 A9FA 67 03 A9 F8 5F 04 A9 F6 57 05 A9 F4 4F 06 A9 08 0A 80 52 48 00 00 39";
    var res = Memory.scan(m.base, m.size, pattern, {
        onMatch: function(address, size){
            console.log('[+] ssl_verify_result found at: ' + address.toString());
        // Add 0x01 because it's a THUMB function
        // Otherwise, we would get 'Error: unable to intercept function at 0x9906f8ac; please file a bug'
            hook_ssl_verify_result(address.add(0x01));
        },
        onError: function(reason){
            console.log('[!] There was an error scanning memory');
        },
        onComplete: function() {
            console.log("All done")
        }
    });
}

然后发现报错了
图片描述
把hook_ssl_verify_result(address.add(0x01))改为hook_ssl_verify_result(address)就可以正常使用了
图片描述

参考:

https://www.jianshu.com/p/ada10d2976f2
https://mp.weixin.qq.com/s/pXpfXK-Ez0n70f3bqFuuFg
https://bbs.kanxue.com/thread-261941.htm
https://blog.nviso.eu/2019/08/13/intercepting-traffic-from-android-flutter-applications/
以上四篇文章均是和flutter证书校验相关


[CTF入门培训]顶尖高校博士及硕士团队亲授《30小时教你玩转CTF》,视频+靶场+题目!助力进入CTF世界

收藏
点赞11
打赏
分享
最新回复 (13)
雪    币: 6368
活跃值: (2254)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
shuyangzjg 2024-1-19 16:59
2
0
向大佬学习
雪    币: 1162
活跃值: (1065)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
erichyx 2024-1-19 21:57
3
0
直接用VPN抓包不就行了
雪    币: 19461
活跃值: (29125)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
秋狝 2024-1-20 21:43
4
1
感谢分享
雪    币: 237
活跃值: (238)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
puppet_w 2024-1-22 08:36
5
0

 -

最后于 2024-1-22 08:37 被puppet_w编辑 ,原因:
雪    币: 237
活跃值: (238)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
puppet_w 2024-1-22 08:36
6
0
erichyx 直接用VPN抓包不就行了
VPN不行的
雪    币: 212
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
mb_ezphxtar 2024-1-22 11:53
7
0
求个样本
雪    币: 237
活跃值: (238)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
puppet_w 2024-1-22 16:45
8
0
mb_ezphxtar 求个样本
样本哇,好像是工作项目中的,不太能分享,不好意思哈
雪    币: 212
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
mb_ezphxtar 2024-1-22 22:22
9
0
puppet_w 样本哇,好像是工作项目中的,不太能分享,不好意思哈
好的感谢~
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
mb_ekitlujo 2024-1-25 10:11
10
0
大佬666
雪    币: 295
活跃值: (213427)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
shinratensei 1 2024-1-25 13:11
11
0
tql
雪    币: 710
活跃值: (1415)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
司徒废人 2024-1-29 10:02
12
0
sockets转发+external proxy也可以抓包的
雪    币: 27
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
axyzyz 2024-3-6 22:47
13
0
一开代理系统就提示退出
雪    币: 1046
活跃值: (78)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
mb_plkucays 2024-3-16 04:12
14
0
大神能帮忙解决风控的问题吗
游客
登录 | 注册 方可回帖
返回