LoginSignup
6
6

More than 5 years have passed since last update.

Dumps decrypted mach-o files for iOS Application

Last updated at Posted at 2015-12-20

この記事は iOS Jailbreaking Advent Calendar 2015 の11日目の記事です。

dumpdecryptedでの解析

アプリに対してのPatchを当てる際に、class-dumpをしてHeaderから攻める方法が簡単かとおもいますが、アプリ(IPA)は通常暗号化された状態でビルドされて提供されています。そのためclass-dumpしてヘッダファイルを取り出すだけでも簡単には出来ません。
そこで実行ファイルの解析を簡単にしてくれるツールが、dumpdecryptedです。
Jailbreakのアプリを作る上でよく利用されているリバースエンジニアリングツールの一つです。

DYLD_INSERT_LIBRARIES を利用して、プロセスにインジェクトし、実行ファイルの復号化してくれます。

DYLD_INSERT_LIBRARIES=dumpdecrypted.dylib /var/mobile/Containers/Bundle/Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Scan.app/Scan
DISCLAIMER: This tool is only meant for security research purposes, not for application crackers.

[+] Found encrypted data at address 00002000 of length 1826816 bytes - type 1.
[+] Opening /private/var/mobile/Applications/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Scan.app/Scan for reading.
[+] Reading header
[+] Detecting header type
[+] Executable is a FAT image - searching for right architecture
[+] Correct arch is at offset 2408224 in the file
[+] Opening Scan.decrypted for writing.
[-] Failed opening. Most probably a sandbox issue. Trying something different.
[+] Opening /private/var/mobile/Applications/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/tmp/Scan.decrypted for writing.
[+] Copying the not encrypted start of the file
[+] Dumping the decrypted data into the file
[+] Copying the not encrypted remainder of the file
[+] Closing original file
[+] Closing dump file

復号化がしたあとはclass-dumpできます。Swiftでは実行ファイルの構成が違うため、dumpdecryptedで復号化出来ません。別の手法で解析をする必要があります。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6