首页
社区
课程
招聘
[原创]一条命令完成iOS应用砸壳
2018-1-31 12:33 24120

[原创]一条命令完成iOS应用砸壳

2018-1-31 12:33
24120

背景

最早的砸壳工具是stefanesser写的dumpdecrypted,通过手动注入然后启动应用程序在内存进行dump解密后的内存实现砸壳,这种砸壳只能砸主App可执行文件。

 

对于应用程序里面存在framework的情况可以使用conradev的dumpdecrypted,通过_dyld_register_func_for_add_image注册回调对每个模块进行dump解密。

 

但是这种还是需要拷贝dumpdecrypted.dylib,然后找路径什么的,还是挺麻烦的。所以笔者干脆放到MonkeyDev模板变成一个tweak的形式dumpdecrypted,这样填写目标bundle id然后看日志把文件拷贝出来就可以了。

 

但是还是很麻烦,需要拷贝文件自己还原ipa,然后有了KJCracks的Clutch通过posix_spawnp创建进程然后dump直接生成ipa包在设备,可以说是很方便了。这个是工具在使用的时候大部分应用会出报错,此外生成的包还需要自己拷贝。

 

###一键dump

 

人都是想偷懒的,于是便有了本文将要介绍的frida-ios-dump,该工具基于frida提供的强大功能通过注入js实现内存dump然后通过python自动拷贝到电脑生成ipa文件,通过以下方式配置完成之后真的就是一条命令砸壳。

 

环境配置
首先上面也说了该工具基于frida,所以首先要在手机和mac电脑上面安装frida,安装方式参数官网的文档:https://www.frida.re/docs/home/

 

如果mac端报如下错:

Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.

使用如下命令安装即可:

sudo pip install frida –upgrade –ignore-installed six

然后将越狱设备通过USB连上电脑进行端口映射:

iproxy 2222 22

到此环境就配置好了,接下来就可以一键砸壳了! (另当前python基于2.x的语法,先切换到python 2.x的环境

一键砸壳

最简单的方式直接使用./dump + 应用显示的名字即可,如下:

➜  frida-ios-dump ./dump.py 微信
open target app......
Waiting for the application to open......
start dump target app......
start dump /var/containers/Bundle/Application/6665AA28-68CC-4845-8610-7010E96061C6/WeChat.app/WeChat
WeChat                                        100%   68MB  11.4MB/s   00:05
start dump /private/var/containers/Bundle/Application/6665AA28-68CC-4845-8610-7010E96061C6/WeChat.app/Frameworks/WCDB.framework/WCDB
WCDB                                          100% 2555KB  11.0MB/s   00:00
start dump /private/var/containers/Bundle/Application/6665AA28-68CC-4845-8610-7010E96061C6/WeChat.app/Frameworks/MMCommon.framework/MMCommon
MMCommon                                      100%  979KB  10.6MB/s   00:00
start dump /private/var/containers/Bundle/Application/6665AA28-68CC-4845-8610-7010E96061C6/WeChat.app/Frameworks/MultiMedia.framework/MultiMedia
MultiMedia                                    100% 6801KB  11.1MB/s   00:00
start dump /private/var/containers/Bundle/Application/6665AA28-68CC-4845-8610-7010E96061C6/WeChat.app/Frameworks/mars.framework/mars
mars                                          100% 7462KB  11.1MB/s   00:00
AppIcon60x60@2x.png                           100% 2253   230.9KB/s   00:00
AppIcon60x60@3x.png                           100% 4334   834.8KB/s   00:00
AppIcon76x76@2x~ipad.png                      100% 2659   620.6KB/s   00:00
AppIcon76x76~ipad.png                         100% 1523   358.0KB/s   00:00
AppIcon83.5x83.5@2x~ipad.png                  100% 2725   568.9KB/s   00:00
Assets.car                                    100%   10MB  11.1MB/s   00:00
.......
AppIntentVocabulary.plist                     100%  197    52.9KB/s   00:00
AppIntentVocabulary.plist                     100%  167    43.9KB/s   00:00
AppIntentVocabulary.plist                     100%  187    50.2KB/s   00:00
InfoPlist.strings                             100% 1720   416.4KB/s   00:00
TipsPressTalk@2x.png                          100%   14KB   2.2MB/s   00:00
mm.strings                                    100%  404KB  10.2MB/s   00:00
network_setting.html                          100% 1695   450.4KB/s   00:00
InfoPlist.strings                             100% 1822   454.1KB/s   00:00
mm.strings                                    100%  409KB  10.2MB/s   00:00
network_setting.html                          100% 1819   477.5KB/s   00:00
InfoPlist.strings                             100% 1814   466.8KB/s   00:00
mm.strings                                    100%  409KB  10.3MB/s   00:00
network_setting.html                          100% 1819   404.9KB/s   00:00

如果存在应用名称重复了怎么办呢?没关系首先使用如下命令查看安装的应用的名字和bundle id:

➜  frida-ios-dump git:(master) ✗ ./dump.py -l
  PID  Name                       Identifier
-----  -------------------------  ----------------------------------------
 9661  App Store                  com.apple.AppStore
16977  Moment                     com.kevinholesh.Moment
 1311  Safari                     com.apple.mobilesafari
16586  信息                         com.apple.MobileSMS
 4147  微信                         com.tencent.xin
10048  相机                         com.apple.camera
 7567  设置                         com.apple.Preferences
    -  CrashReporter              crash-reporter
    -  Cydia                      com.saurik.Cydia
    -  通讯录                        com.apple.MobileAddressBook
    -  邮件                         com.apple.mobilemail
    -  音乐                         com.apple.Music
    ......

然后使用如下命令对指定的bundle id应用进行砸壳即可:

 frida-ios-dump git:(master) ✗ ./dump.py -b com.tencent.xin

等待自动砸壳传输完成之后便会到当前目录生成一个解密后的ipa文件,这个时候赶紧拖到MonkeyDev开始逆向之旅吧!


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

收藏
点赞1
打赏
分享
打赏 + 1.00雪花
打赏次数 1 雪花 + 1.00
 
赞赏  零零狗   +1.00 2018/02/01
最新回复 (9)
雪    币: 2
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
零零狗 2018-2-1 09:48
2
0
使用中  灰常方便
雪    币: 893
活跃值: (362)
能力值: ( LV13,RANK:600 )
在线值:
发帖
回帖
粉丝
dirge 14 2018-2-5 16:07
3
0
厉害厉害
雪    币: 2
活跃值: (14)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
刚入RE坑的菜 2018-3-22 11:14
4
0
庆总,我用您的工具砸壳,提示的信息如下:

CaicaideMacBook-Pro:frida-ios-dump-master  Caicai$  sudo  python  ./dump.py  微信
Password:
Start  the  target  app  微信
unexpected  error  while  probing  dyld  of  target  process
CaicaideMacBook-Pro:frida-ios-dump-master  Caicai$  sudo  python  ./dump.py  微信
Start  the  target  app  微信
Dumping  微信  to  /tmp
start  dump  /var/containers/Bundle/Application/31D8B150-C908-4653-85A4-2D3C6691493F/WeChat.app/WeChat
0.00B  [00:00,  ?B/s]chmod:  /tmp/Payload/WeChat.fid:  No  such  file  or  directory
Command  '('chmod',  '655',  u'/tmp/Payload/WeChat.fid')'  returned  non-zero  exit  status  1

start  dump  /private/var/containers/Bundle/Application/31D8B150-C908-4653-85A4-2D3C6691493F/WeChat.app/Frameworks/WCDB.framework/WCDB
0.00B  [00:00,  ?B/s]chmod:  /tmp/Payload/WCDB.fid:  No  such  file  or  directory
Command  '('chmod',  '655',  u'/tmp/Payload/WCDB.fid')'  returned  non-zero  exit  status  1



意思我没权限对微信进行操作?现在没有什么好的思路,还请庆哥帮忙
雪    币: 2
活跃值: (14)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
刚入RE坑的菜 2018-3-22 17:56
5
0
大神,生成的.ipa文件在哪个目录下面,找了好久也没找到
雪    币: 628
活跃值: (338)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
AloneMonkey 2 2018-3-26 16:29
6
0
刚入RE坑的菜 大神,生成的.ipa文件在哪个目录下面,找了好久也没找到
没指定  -o    就是运行脚本的目录
雪    币: 628
活跃值: (338)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
AloneMonkey 2 2018-3-26 16:31
7
0
刚入RE坑的菜 庆总,我用您的工具砸壳,提示的信息如下: CaicaideMacBook-Pro:frida-ios-dump-master Caicai$ sudo python ./dump.py 微信 ...
issues里面也有一个是终端字符集的问题,我没遇到,https://github.com/AloneMonkey/frida-ios-dump/issues/15
雪    币: 2719
活跃值: (1502)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
Vn小帆 2018-4-25 20:52
8
0
这个端口映射怎么弄的    大哥
雪    币: 628
活跃值: (338)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
AloneMonkey 2 2018-5-17 15:01
9
0
Vn小帆 这个端口映射怎么弄的 大哥
brew  install  libimobiledevice     
iproxy  xxxx  xx
雪    币: 19
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
JackNehc 2019-3-15 13:09
10
0
sudo pip install --upgrade frida --ignore-installed six
游客
登录 | 注册 方可回帖
返回