当前位置: 首页 > 技术干货 > 【flutter对抗】blutter使用+ACTF习题

【flutter对抗】blutter使用+ACTF习题

发表于:2023-12-12 10:23 作者: Ba0 阅读数(2831人)

最新的能很好反编译flutter程序的项目

1、安装

git clone https://github.com/worawit/blutter --depth=1

image

然后我直接将对应的两个压缩包下载下来(通过浏览器手动下载)

不再通过python的代码来下载,之前一直卡在这个地方。

如果读者可以正常运行init_env_win.py,手动这一步可以省略。

cd .\blutter\
python .\scripts\init_env_win.py

image

再次运行就可以安装成功

image

2、blutter反编译使用

image

运行该工具,进入目标文件夹

提供libapp.so 和 libflutter.so 的目录

image

image

python blutter.py C:\Users\Le\Desktop\flutter\chall\lib\armeabi-v7a .\output

然后报错。。。

image

但是问题不大,好像是我们的架构不支持,我们换一个

image

再次运行,发现正在下载对应Dart版本的信息

image

全程代理!

image

要不然还会报错

正常情况下:

image

安装完成后,再次运行命令:

image

报错:0x22说明权限不够,使用管理员模式运行即可

image

反编译成功

查看文件目录:

image

到此,blutter模块反编译flutter成功!

3、IDA恢复libapp.so符号

image

拖进IDA64

发现符号全无,不利于我们分析,此时blutter工具的用法就体现出来了

image

运行生成的脚本:

image

见证奇迹的时刻到了

image

4、分析

image

flutter中:onTap函数是按钮点击响应函数,CTF中以此作为入口进行分析

进入1DE500函数

image

进入分析发现一堆代码

image

目前不知道什么加密,因为“面目全非”(有256,%符号)

image

使用blutter生成的frida脚本,对该函数进行hook,观察其返回结果

frida -U -f com.example.flutter_application_1 -l blutter_frida.js

image

image

hook目标函数

image

然后发现没有触发

image

猜测flag长度有限制,后面知道了原来是模拟器有bug,我换了真机才可以

image

得到了比较的数组,也就是密文

Unhandle class id: 46, TypeArguments
GrowableList@750038d0f1 = [
 188698,
 0,
{
   "key": "Unhandle class id: 46, TypeArguments"
},
 34,
{
   "key": [
     184,
     132,
     137,
     215,
     146,
     65,
     86,
     157,
     123,
     100,
     179,
     131,
     112,
     170,
     97,
     210,
     163,
     179,
     17,
     171,
     245,
     30,
     194,
     144,
     37,
     41,
     235,
     121,
     146,
     210,
     174,
     92,
     204,
     22
  ]
},
 0,
 0,
 0
]

接下来使用IDA进行so的一个动调

image

image

选择same

image

找到module

image

运行程序

image

读者可以使用高级语言来看,为了理解更深刻,我这里采用了汇编来看

image

可以看到比较256次

RC4的经典特征

image

image

image

在异或出添加输出断点:

image

搜索指令

  EOR             X5, X3, X2

image

import idc
print(idc.get_reg_value("X2"),",",end="")

image

image

拿到异或的所有值

xor = [14, 14, 68, 80, 29, 201, 241, 46, 197, 208, 123, 79, 187, 55, 234, 104, 40, 117, 133, 12, 67, 137, 91, 31, 136,
      177, 64, 234, 24, 27, 26, 214, 122, 217]

然后还有密文

这里使用了oacia师傅的脚本

final = [184, 132, 137, 215, 146, 65, 86, 157, 123, 100, 179, 131, 112, 170, 97, 210, 163, 179, 17, 171, 245, 30, 194,
        144, 37, 41, 235, 121, 146, 210, 174, 92, 204, 22]
xor = [14, 14, 68, 80, 29, 201, 241, 46, 197, 208, 123, 79, 187, 55, 234, 104, 40, 117, 133, 12, 67, 137, 91, 31, 136,
      177, 64, 234, 24, 27, 26, 214, 122, 217]

flag = [chr(xor[i]^final[i]^0xff) for i in range(len(final))]
print(''.join(flag))

感谢oacia师傅的分享

‍