FRIDA在iOS中的使用

翻译自官网文档:

https://www.frida.re/docs/ios/

Frida 支持两种操作模式,取决于你的iOS设备是否Jailbreak。

With Jailbreak(越狱

这是最强大的设置,因为它可以让你轻松地检测系统服务和应用程序。

在本教程中,我们将向你展示如何在iOS设备上执行功能跟踪(function tracing)。

Setting up your iOS device

Start Cydia and add Frida’s repository by going to Manage -> Sources -> Edit -> Add and enter https://build.frida.re. You should now be able to find and install the Frida package which lets Frida inject JavaScript into apps running on your iOS device. This happens over USB, so you will need to have your USB cable handy, though there’s no need to plug it in just yet.

A quick smoke-test

现在,回到Windows或macOS系统,是时候确保基础工作正常,运行:

$ frida-ps -U

使用Linux系统?

As of Frida 6.0.9 there's now usbmuxd integration, so -U works. For earlier Frida versions you can use WiFi and set up an SSH tunnel between localhost:27042 on both ends, and then use -R instead of -U.

 未插入设备应出现下面的信息:

Waiting for USB device to appear...

插入设备,然后应该看到一列进程列表:

 PID NAME
 488 Clock
 116 Facebook
 312 IRCCloud
1711 LinkedIn
 …

Great, we’re good to go then!

Tracing crypto calls in the Twitter app(跟踪Twitter应用程序中的加密调用

Alright, let’s have some fun. 在设备上启动Twitter,并确保Twitter始终在前台运行,设备不进入休眠状态,返回电脑桌面,运行:

$ frida-trace -U -i "CCCryptorCreate*" Twitter
Uploading data...
CCCryptorCreate: Auto-generated handler …/CCCryptorCreate.js
CCCryptorCreateFromData: Auto-generated handler …/CCCryptorCreateFromData.js
CCCryptorCreateWithMode: Auto-generated handler …/CCCryptorCreateWithMode.js
CCCryptorCreateFromDataWithMode: Auto-generated handler …/CCCryptorCreateFromDataWithMode.js
Started tracing 4 functions. Press Ctrl+C to stop.

Now, CCryptorCreate and friends are part of Apple’s libcommonCrypt.dylib, 并被很多应用程序用于负责加密,解密,散列(hashing)等。

重新加载您的Twitter Feed或以某种方式运行UI来产生网络流量,应该看到如下输出:

3979 ms	CCCryptorCreate()
3982 ms	CCCryptorCreateWithMode()
3983 ms	CCCryptorCreate()
3983 ms	CCCryptorCreateWithMode()

现在你可以在阅读man CCryptorCreate的同时,实时编辑上述的JavaScript文件,并开始深入了解你的iOS应用程序。

 

Without Jailbreak(没有越狱

In order to instrument an app with Frida you will need to make it load a .dylib that we’ll refer to as a “gadget”.

在这篇教程里我们会向你展示如何 change your Xcode build configuration,这样你可以用Frida给应用程序插桩(instrumenting your app)。 Note that it is also possible to perform this on an existing binary by using insert_dylib or a similar tool.

Customizing your Xcode project

Download the latest FridaGadget.dylib for iOS and sign it:

 

------tobecontinued------

你可能感兴趣的:(逆向,iOS,Frida)