Methodology: iOS Crypto Testing
Hook Points
Load scripts/crypto_hooks.js (Frida) — it traces CommonCrypto (CCCrypt, CCCryptorCreate), SecKeyCreateEncryptedData, and AES.GCM Swift wrappers, logging key material and mode selections.
Weakness Checklist
- Hardcoded keys/IVs in binary strings (
strings App.app/App | grep -iE 'key|iv'). - ECB mode (CCCrypt option
kCCOptionECBMode). - Static IV across messages (observe via hook log).
- Insecure PRNG:
rand(),arc4random()vsSecRandomCopyBytes— prefer the latter for key material. - Deprecated primitives: MD5, SHA-1 (for MAC/signature), DES, RC4, 3DES.
- Missing authentication (CBC without HMAC → padding oracle).
- Key derivation with low iteration count (
PBKDF2< 100k iterations in 2026).
Verifying a Key-Storage Flow
- Hook the constructor / first use of the cipher.
- Capture the key's origin — from Keychain (good), NSUserDefaults (bad), hardcoded (critical).
- Confirm key length, mode, IV uniqueness.
Custom / Home-rolled Crypto
Flag any class that combines XOR, rolls its own AES, or claims "proprietary encryption". Document and recommend CryptoKit or platform APIs.
TLS Fingerprint
If the app uses a custom TLS stack (for DRM/anti-MITM), note mTLS client certs (identity in Keychain) and how they are provisioned — often a static PKCS#12 bundled in the IPA.