yaklang/hack-skills2 files

iOS Pentesting Tricks

>-

Specification
Skill ID
yaklang/hack-skills/ios-pentesting-tricks
Publisher
yaklang
Repository
hack-skills
Installs
0
Files
2
Synced
Sep 23, 2026
How to use it

Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.

yaklang/hack-skills/ios-pentesting-tricksInstalls these files
  • IOS_RUNTIME_TRICKS.md
  • SKILL.md

What this skill tells the agent

SKILL: iOS Pentesting Tricks — Expert Attack Playbook

AI LOAD INSTRUCTION: Expert iOS application security testing techniques. Covers jailbreak vs non-jailbreak methodology, keychain extraction, URL scheme/Universal Links abuse, Frida/Objection runtime hooks, binary protection checks, and data storage analysis. Base models miss protection class nuances and AASA misconfiguration patterns.

0. RELATED ROUTING

Before going deep, consider loading:

  • mobile-ssl-pinning-bypass for in-depth SSL pinning bypass (SecTrust hooks, SSL Kill Switch, framework-specific techniques)
  • android-pentesting-tricks when also testing the Android version of the same app
  • api-sec for backend API security testing once traffic is intercepted

Advanced Reference

Also load IOS_RUNTIME_TRICKS.md when you need:

  • Frida recipes for iOS-specific hooks (ObjC class enumeration, method swizzling)
  • Objection command reference for iOS
  • Runtime hooking patterns and bypass templates

1. JAILBREAK VS NON-JAILBREAK TESTING

CapabilityJailbrokenNon-Jailbroken
SSL pinning bypassFrida, SSL Kill Switch 2, ObjectionNetwork debugging proxy, MITM profiles (limited)
Keychain accesskeychain-dumper, Frida dumpOnly via backup extraction (limited)
Filesystem inspectionFull access to app sandboxOnly via ideviceinstaller + backup
Runtime manipulationFrida, Cycript, LLDB attachFrida on sideloaded apps (re-signed)
Binary analysisClass-dump, Hopper on-deviceDecrypt IPA on Mac, analyze offline
Method hookingFull Frida/Cycript capabilityLimited (needs re-signed app + Frida gadget)

Non-Jailbreak Testing Setup

# Extract IPA from device
ideviceinstaller -l                    # List installed apps
ios-deploy --id <UDID> --download --bundle_id com.target.app

# Or use frida-ios-dump for decrypted IPA (jailbroken)
python dump.py com.target.app

# Sideload with Frida gadget (non-jailbreak runtime hooking)
# 1. Extract IPA, 2. Insert FridaGadget.dylib into Frameworks/
# 3. Re-sign with valid profile, 4. Install via ios-deploy

2. KEYCHAIN EXTRACTION

2.1 Keychain Protection Classes

Protection ClassAvailabilityUse CaseRisk Level
kSecAttrAccessibleWhenUnlockedOnly when device unlockedPasswords, tokensMedium
kSecAttrAccessibleAfterFirstUnlockAfter first unlock until rebootBackground tokensHigh (persists across locks)
kSecAttrAccessibleAlwaysAlways (deprecated iOS 12+)Legacy appsCritical
kSecAttrAccessibleWhenPasscodeSetThisDeviceOnlyPasscode set + unlockedHigh-value secretsLow

2.2 Extraction Methods

# Jailbroken: keychain-dumper
/path/to/keychain-dumper -a              # Dump all accessible items
/path/to/keychain-dumper -g password     # Generic passwords only
/path/to/keychain-dumper -i              # Internet passwords

# Frida / Objection
objection -g com.target.app explore
> ios keychain dump
> ios keychain dump --json                # JSON output for parsing

# Frida script for keychain enumeration
frida -U -f com.target.app -l keychain_dump.js

2.3 What to Look For

Item TypeKeychain ClassTypical Content
kSecClassGenericPasswordgenpApp tokens, API keys, user credentials
kSecClassInternetPasswordinetHTTP auth credentials, OAuth tokens
kSecClassCertificatecertClient certificates
kSecClassIdentityidntCert + private key pair
kSecClassKeykeysEncryption keys

3. URL SCHEME HIJACKING

3.1 Custom URL Scheme Discovery

# From IPA/app bundle — check Info.plist
plutil -p /path/to/Payload/Target.app/Info.plist | grep -A 10 CFBundleURLTypes

# Example output:
# "CFBundleURLSchemes" => ["targetapp", "fb123456789"]

3.2 Hijacking Attack

Scenario: Target app registers "targetapp://" for OAuth callback

1. Attacker app also registers "targetapp://" URL scheme
2. User initiates OAuth login in target app
3. OAuth provider redirects to targetapp://callback?code=AUTH_CODE
4. iOS may open attacker's app instead (non-deterministic scheme resolution)
5. Attacker captures OAuth authorization code
Attack VectorTechniqueImpact
OAuth callback interceptionRegister same schemeSteal authorization codes
Deep link hijackingRegister same schemePhishing, data interception
Payment callback interceptionRegister payment schemeTransaction manipulation

3.3 URL Scheme vs Universal Links Security

FeatureCustom URL SchemeUniversal Links
RegistrationAny app can claim any schemeRequires AASA file on domain
UniquenessNot guaranteed (multiple apps)One app per domain path
ValidationNoneCryptographic (AASA signed)
Recommended forNon-sensitive navigationOAuth callbacks, sensitive actions
HijackableYes (duplicate registration)Only via AASA misconfiguration

4. UNIVERSAL LINKS EXPLOITATION

4.1 AASA (Apple-App-Site-Association) Misconfiguration

# Fetch AASA file
curl -s "https://target.com/.well-known/apple-app-site-association" | jq .
curl -s "https://target.com/apple-app-site-association" | jq .

# Check for wildcard patterns (overly broad)
# Bad: "paths": ["*"]     ← captures ALL URLs
# Bad: "paths": ["/NOT *"] ← poorly written exclusion
MisconfigurationRiskExploitation
Wildcard paths (*)App claims all URLs on domainRedirect chain may break UL → fallback to URL scheme
Missing AASA fileUniversal Links won't workApp falls back to less-secure URL scheme
AASA on wrong domainLinks not associatedScheme hijacking possible
AASA not served as application/jsonParsing failureLinks won't associate
CDN caching stale AASAOutdated associationsInconsistent behavior

4.2 Breaking Universal Links → URL Scheme Fallback

Technique: Force Universal Link to not open app, causing fallback to URL scheme

1. User long-presses link → "Open in Safari" (disables UL for that domain)
2. Redirect chain: domain A → domain B → target (UL breaks on redirect)
3. JavaScript redirect instead of 302 (UL only works on server-side redirects)
4. App not installed → URL scheme fallback → hijackable

5. RUNTIME MANIPULATION

5.1 Frida on iOS

# Connect to app on jailbroken device
frida -U -f com.target.app --no-pause

# Basic ObjC exploration
> ObjC.classes                                    # List all classes
> ObjC.classes.NSURLSession                       # Check if class exists
> ObjC.classes.AppDelegate.$methods               # List methods
> ObjC.classes.AppDelegate['- isLoggedIn'].implementation  # Read method

# Hook method and modify return value
Interceptor.attach(ObjC.classes.AuthManager['- isAuthenticated'].implementation, {
    onLeave: function(retval) {
        retval.replace(ptr(1));  // Force return TRUE
    }
});

5.2 Objection iOS Commands

objection -g com.target.app explore

# Keychain
> ios keychain dump

# Cookies
> ios cookies get

# Pasteboard
> ios pasteboard monitor

# Jailbreak detection bypass
> ios jailbreak disable

# SSL pinning bypass
> ios sslpinning disable

# Binary info
> ios info binary

# Hooking
> ios hooking watch class AppDelegate
> ios hooking watch method "-[AuthManager isAuthenticated]" --dump-args --dump-return
> ios hooking set return_value "-[AuthManager isJailbroken]" false

5.3 Cycript (Legacy but Useful)

// Attach to running app
cycript -p com.target.app

// Explore UI hierarchy
UIApp.keyWindow.recursiveDescription().toString()

// Find view controllers
[UIWindow.keyWindow().rootViewController _printHierarchy].toString()

Use this skill in a project

Open any RiverX project, search the Skills panel for yaklang/hack-skills/ios-pentesting-tricks, and install it in one click.

Use this skill