Skip to content
Back to skills

Ios Macho Re

ASecurity

End-to-end iOS IPA and Mach-O reverse engineering workflow for authorized security testing. Use when analyzing iOS apps with IDA Pro/Ghidra/radare2/Frida/LLDB MCPs, checking FairPlay cryptid encryption, writing Frida 17 Objective-C and Swift hooks, calculating LLDB ASLR slides, or diagnosing NSURLSession SSL pinning.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 1, 2026
developmentjavascriptpythonrustjavaswiftbashtestingdebuggingapisecurity

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add muyang520/awesome-mobile-re-mcp-skills --skill ios-macho-re --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ios Macho Re?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ios Macho Re
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/muyang520-ios-macho-re/badge)](https://www.skillsdirectory.com/skills/muyang520-ios-macho-re)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ios-macho-re
description: >-
  End-to-end iOS IPA and Mach-O reverse engineering workflow for authorized security testing.
  Use when analyzing iOS apps with IDA Pro/Ghidra/radare2/Frida/LLDB MCPs, checking FairPlay cryptid encryption,
  writing Frida 17 Objective-C and Swift hooks, calculating LLDB ASLR slides, or diagnosing NSURLSession SSL pinning.
---

# iOS IPA & Mach-O Reverse Engineering SOP

Never start static decompilation on an iOS App Store binary without checking FairPlay encryption (`cryptid`) first, and always respect ARM64 calling conventions (`objc_msgSend`) and Frida 17 API changes when instrumenting iOS targets.

---

## Step 1: Mandatory FairPlay Encryption Gate (`cryptid` Check)

App Store binaries encrypt `__TEXT,__text` with FairPlay DRM. Decompiling an encrypted Mach-O in IDA Pro or Ghidra produces meaningless random instructions.

Run the bundled cross-platform IPA/Mach-O scanner first (works on **Windows, Linux, and macOS** without needing Xcode `otool`):
```bash
python skills/ios-macho-re/scripts/macho_ipa_triage.py Target.ipa --json
```
- **Bundled Helper**: [macho_ipa_triage.py](./scripts/macho_ipa_triage.py)

1. **Verify `cryptid` First**:
   ```bash
   otool -l Payload/TargetApp.app/TargetApp | grep -A 4 LC_ENCRYPTION_INFO
   # Or via radare2 / rabin2:
   rabin2 -I Payload/TargetApp.app/TargetApp | grep crypto
   ```
   - `cryptid 0` -> **Decrypted** (safe to load into `ida-pro-mcp`, `GhidraMCP`, `radare2-mcp`, or `class-dump` / `ipsw`).
   - `cryptid 1` -> **Encrypted! STOP static decompilation.** Decrypt in memory on an authorized jailbroken/TrollStore device first (`frida-ios-dump`, `bagbak`, or `TrollDecrypt`) and re-verify `cryptid == 0` on both the main executable **and** embedded `Frameworks/*.framework`!

---

## Step 2: Static Symbol & Metadata Triage (ObjC vs Swift)

Even stripped iOS binaries retain rich Objective-C runtime metadata:

1. **Objective-C Classes & Selectors**:
   - Inspect `__DATA,__objc_classlist`, `__RODATA,__objc_methname`, and `__DATA,__objc_selrefs`.
   - ARM64 `objc_msgSend` ABI:
     - `X0` = `self` (`id` receiver object or `Class` meta-object)
     - `X1` = `_cmd` (`SEL` C-string selector, e.g. `"signRequestWithParams:timestamp:"`)
     - `X2 .. X7` = explicit method arguments `arg1 .. arg6`
2. **Swift Targets**:
   - Check `swift*` sections (`__TEXT,__swift5_types`, `__swift5_fieldmd`, `__swift5_proto`).
   - Demangle symbols (`xcrun swift-demangle` or IDA/Ghidra Swift demangler). Note that pure Swift structs and `final` methods use **direct static dispatch** (not `objc_msgSend`), requiring native `Interceptor.attach(mod.base.add(offset))` rather than `ObjC.classes`!

---

## Step 3: Frida 17 Safe Objective-C & Native Hooking

In Frida 17+, `Memory.readUtf8String` is removed (`ptr.readUtf8String()` required), and in custom bundled scripts `import ObjC from "frida-objc-bridge"` is needed if `ObjC` isn't globally injected by CLI/MCP.

### Universal Objective-C Method Tracer (Args + Return Value)
```javascript
if (ObjC.available) {
  const clsName = "TargetNetworkManager";
  const selName = "- signWithDictionary:secretKey:";
  const Cls = ObjC.classes[clsName];

  if (!Cls || !Cls[selName]) {
    console.log(`[!] ${clsName}[${selName}] not found`);
  } else {
    Interceptor.attach(Cls[selName].implementation, {
      onEnter(args) {
        // args[0] = self, args[1] = _cmd (SEL), args[2+] = method parameters
        const receiver = new ObjC.Object(args[0]);
        const sel = ObjC.selectorAsString(args[1]);
        const param1 = args[2].isNull() ? "nil" : new ObjC.Object(args[2]).toString();
        const param2 = args[3].isNull() ? "nil" : new ObjC.Object(args[3]).toString();
        console.log(`\n[+] ${receiver.$className} ${sel}\n    arg0: ${param1}\n    arg1: ${param2}`);
      },
      onLeave(retval) {
        const ret = retval.isNull() ? "nil" : new ObjC.Object(retval).toString();
        console.log(`    => return: ${ret}`);
      }
    });
  }
}
```

---

## Step 4: iOS Network Capture & SSL Pinning Triage

When iOS HTTPS traffic fails under MITM (`mitmproxy` / `Charles` / `Reqable` with trusted root profile enabled in *Settings -> General -> About -> Certificate Trust Settings*):

1. **System `NSURLSession` / `AFNetworking` / `Alamofire` Delegate Pinning**:
   - Locate implementations of `- URLSession:didReceiveChallenge:completionHandler:` or `SecTrustEvaluateWithError` (`Security.framework`).
   - Low-level Apple TLS C-API checkpoint (`libsystem_network.dylib` / `Network.framework`): `nw_tls_create_peer_trust` and `sec_trust_evaluate`.
2. **Cross-Platform Engines inside `Frameworks/`**:
   - Check `Payload/App.app/Frameworks/` for `Flutter.framework` (switch to `flutter-https-capture` skill), `libcronet.framework` / `TTNet` (BoringSSL custom verify), or Unity `il2cpp` (`Metadata/global-metadata.dat`).

---

## Step 5: LLDB (`lldb-mcp`) ASLR Slide Formula

When debugging live with `debugserver` + `lldb` (`stass/lldb-mcp` or `FYTJ/lldb-mcp-server`):
1. Run `image list -o -f` in LLDB to obtain the runtime ASLR slide of the main binary or framework:
   - `[  0] 0x0000000004a1c000 /private/var/containers/Bundle/Application/.../TargetApp` -> `slide = 0x4a1c000`
2. Convert IDA/Ghidra static address (`0x1000284ac`, where `__PAGEZERO` base is `0x100000000`) to runtime address:
   - `runtime_addr = static_addr + slide` -> `br s -a 0x104a444ac`
3. Inspect ObjC registers at breakpoint: `po $x0` (self), `x/s $x1` (selector), `po $x2` (first argument).

Files in this skill

  • SKILL.md5.4 KB
  • scripts/macho_ipa_triage.py10.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.