dumpdecrypted 砸壳

本次砸壳的系统依然是 iOS10.3.x , 工具使用 dumpdecrypted , 砸壳的对象是 WeChat 这个App.

准备工作

[if !supportLists]·       [endif]MacOS PC

[if !supportLists]·       [endif]越狱手机一台(我用的是iPhone6SPlus 10.3.1)

[if !supportLists]·       [endif]dumpdecrypted

[if !supportLists]·       [endif]class-dump

[if !supportLists]·       [endif]在 Cydia 中安装 cycript, 可以先不用管 cycript 是什么, 下载安装即可.

[if !supportLists]·       [endif]iFunBox 或者其他助手工具

编译dumpdecrypted

Github下载 dumpdecrypted 源码, 源码就一个 C 源文件.

下载 zip 包之后, 解压, 如图:

[if !vml]

[endif]

dumpdecrypted 砸壳_第1张图片

在当前目录, 执行 make 即可完成编译, 如图所示:

[if !vml]

[endif]

dumpdecrypted 砸壳_第2张图片

编译成功后生成 dumpdecrypted.dylib 文件.

这里有个小插曲, 编译 dumpdecrypted 的时候报错了, 错误信息如下:

xcrun: error: SDK "iphoneos"cannot be located

xcrun: error: unableto lookup item 'Path'inSDK 'iphoneos'

clang: warning: nosuch sysroot directory: '-F/System/Library/Frameworks' [-Wmissing-sysroot]

dumpdecrypted.c:27:10:fatal error: 'stdio.h' file not found

无法找到对应的 SDK 和 stdio.h 文件, 这种问题大多数是 Xcode 路径造成的.

使用下面的命令看一下系统指向的 Xcode 路径:

xcode-select -p

控制台输出:

/Library/Developer/CommandLineTools

显然不是 Xcode 的路径, 那只能重新切换一下其路径即指向正确的 Xcode 路径即可.

命令如下:

sudo xcode-select --switch/Applications/Xcode.app

再次编译 dumpdecrypted 即可成功完成.

dumpecrypted.dylib 签名

如果不对该文件进行签名, 后续砸壳的操作会失败.

先找到已经在电脑上面安装的苹果开发者证书, 操作如下:

## 列出可签名证书, 找到 mac 上面已经安装的证书

securityfind-identity -v -p codesigning

为 dumpecrypted.dylib 签名, 命令如下:

codesign --force--verify --verbose--sign"iPhone Developer: xxx xxxx(xxxxxxxxxx)" dumpdecrypted.dylib

其中, "iPhone

Developer: xxx xxxx (xxxxxxxxxx)" 为你自己本机安装的开发者证书名称.

SSH 连接手机

使用 OpenSSH 让 Mac 和手机连接起来 这样可以很方便的在 Mac 终端使用 shell 命令来操作手机的目录了.

关于 OpenSSH 的使用请参考我之前的博文iOS 逆向: 越狱使用 SSH.

查找目标 App 所在进程

[if !supportLists]·       [endif]双击 Home 按键后, 手动杀掉 iPhone 上面所有在后台的App.

[if !supportLists]·       [endif]Home 到手机桌面.

[if !supportLists]·       [endif]打开目标 App 即WeChat, 这里称之为TargetApp.

[if !supportLists]·       [endif]Home 到手机桌面.

[if !supportLists]·       [endif]查看当前运行的所有进程, 命令如下:

ps-e

看到这个货:

[if !vml]

[endif]

在如下目录:

/var/containers/Bundle/Application/2837EC87-7C28-45C5-9309-24FACD3A97C9/WeChat.app/WeChat

WeChat.app 就是我们要找的TargetApp.

连接 SSH 成功后, 在 MacOS 终端 ls 一下该目录, 可以发现 WeChat.app 躺在那里.

[if !vml]

[endif]

砸壳

1. 查找 Documents 目录

WeChat 为当前的进程目标执行文件名称, 从上面的图可以看出, 其对应的进程 id 是 18983.

在命令行中通过 cycript 执行如下操作:

cycript-p 18983

再执行 OC 的方法, 如下:

[[NSFileManagerdefaultManager] URLsForDirectory:NSDocumentDirectoryinDomains:NSUserDomainMask][0]

可以看到对应的输出, 如下图所示, 这就是对应的 Documents 目录.

[if !vml]

[endif]

注意: 执行过程中, 在 iPhone 上面打开运行一下 App, 不然上面的执行一直卡在那里不动.

找到目录如下:

/var/mobile/Containers/Data/Application/2EFA08B6-DD7B-41A6-92C9-C6115CA6DDA1/Documents/

同理, 你也可以使用 iFunBox 查看该目录.

2. 拷贝dumpdecrypted.dylib.

拷贝 dumpdecrypted.dylib 这个之前编译签名好的文件到iPhone 上面该 APP 的 Documents 目录有两种方法.

第一种方法, 直接在 mac 上面拖拽 dumpdecrypted.dylib 到 iFunBox 显示的这个目录中, 这种方法比较简单且快.

第二种方法, 使用 scp 命令进行操作.

scp ~/[email protected]:/var/mobile/Containers/Data/Application/2EFA08B6-DD7B-41A6-92C9-C6115CA6DDA1/Documents/

192.168.99.231 是 iPhone 设备的 ip 地址.

3. 退出 cycript, 回到命令行模式

ctrl+ d

4. cd Documents 目录

cd /var/mobile/Containers/Data/Application/2EFA08B6-DD7B-41A6-92C9-C6115CA6DDA1/Documents/

5. 砸壳

终端在 Documents 目录下面, 执行下面命令即可:

DYLD_INSERT_LIBRARIES=dumpdecrypted.dylib/var/containers/Bundle/Application/2837EC87-7C28-45C5-9309-24FACD3A97C9/WeChat.app/WeChat

执行过程显示如下:

[if !vml]

[endif]

dumpdecrypted 砸壳_第3张图片

最后生成了 WeChat.decrypted 文件, 如下:

-rw-r--r--  1root   mobile74513728Jun  7 15:20WeChat.decrypted

drwxr-xr-x14mobilemobile     448Jun  7 15:20 .

-rw-r--r--  1root   mobile   207760Jun  7 15:15dumpdecrypted.dylib

-rw-r--r--  1mobilemobile        8Jun  7 13:22db.globalconfig

-rw-r--r--  1mobilemobile       15Jun  7 11:35SafeMode.dat

drwxr-xr-x26mobilemobile     832Jun  7 11:35MMappedKV

drwxr-xr-x  3mobilemobile       96Jun  7 11:35CrashReport

-rw-r--r--  1mobilemobile     1011Jun  7 11:35LocalInfo.lst

drwxr-xr-x  5mobilemobile      160Jun  7 11:35MemoryStat

drwxr-xr-x  6mobilemobile      192Jun  7 11:35 00000000000000000000000000000000

drwxr-xr-x15mobilemobile     480Jun  5 13:43MMResourceMgr

-rw-r--r--  1mobilemobile      592Jun  5 13:43heavy_user_id_mapping.dat

drwxr-xr-x  2mobilemobile       64Jun  5 10:07OpenImResource

使用 iFunBox 或者 scp 命令将 WeChat.decrypted 文件导出到 mac 的任意目录。

���u��+�w�h�

你可能感兴趣的:(dumpdecrypted 砸壳)