Skip to content

Commit 65d34bc

Browse files
committed
[README] Add README
1 parent 591ca57 commit 65d34bc

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## inject_decrypt
2+
3+
Decrypt Mach-O executables using injection.
4+
5+
iOS (and watchOS, and probably tvOS) binaries acquired through the App Store have an encrypted section. When a binary is loaded into memory, and is ready for execution, the section that's encypted on disk is decrypted in memory. This dynamic library can be injected into a process to dump the image with it's decrypted section to a new file on disk. The resulting file has an invalid code signature.
6+
The App Store typically only serves "thinned" binaries, however I've added support for "fat" (multiple architectures in one file) images just in case. In the case where an image on disk is fat, the entire file is copied, however only the slice loaded in memory is decrypted.
7+
8+
A binary must be decrypted before meaningful static analysis may be performed on it.
9+
10+
### Usage
11+
12+
```
13+
DYLD_INSERT_LIBRARIES=inject_decrypt.dylib <executable> [-avvv] <out_path>
14+
-a all images (out_path should be a non-existant directory)
15+
-v verbose mode, multiple increases verbosity
16+
```
17+
18+
### Compile
19+
20+
Using Xcode: `xcodebuild` should create `build/Release-iphoneos/libinject_decrypt.a`, an unsigned dynamic library. Sign with `ldid -S` or similar if needed.
21+
22+
Using Theos: `make DEBUG=0` should create `.theos/obj/inject_decrypt.dylib`, a pseudo-signed dynamic library.
23+
24+
Independent, macOS: `$(xcrun --sdk iphoneos --find clang) -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch armv7 -arch arm64 -Os -dynamiclib inject_decrypt/inject_decrypt.c -o inject_decrypt.dylib` should create `inject_decrypt.dylib`, an unsigned dynamic library. Sign with `ldid -S` or similar if needed.
25+
26+
Independent, other (substitute the path to your iOS SDK, and your C compiler, if needed): `$CC -isysroot IOS_SDK_PATH -arch armv7 -arch arm64 -Os -dynamiclib inject_decrypt/inject_decrypt.c -o inject_decrypt.dylib` should create `inject_decrypt.dylib`, an unsigned dynamic library. Sign with `ldid -S` or similar if needed.
27+
28+
### Known Similar Tools
29+
30+
- [dumpdecrypted](https://github.com/stefanesser/dumpdecrypted) uses injection, and only dumps the main image
31+
32+
- [decrypt](https://bitbucket.org/lordscotland/objctools/src/master/decrypt.c) uses injection, and dumps all loaded images
33+
34+
- [Clutch](https://github.com/KJCracks/Clutch) uses spawning, and supports dumping all images

0 commit comments

Comments
 (0)