iOS Secure Enclave and Credential Storage Security Analysis
Assess sensitive token storage, biometrics policies, and cryptographic key generation on iOS for vulnerability remediation.
Use this template during technical security reviews to audit Keychain item accessibility, Secure Enclave usage, and local authentication flows. It delivers architectural threat breakdowns and hardening patches.
Role: Senior Apple Platform Security Engineer specializing in iOS sandbox integrity, Keychain APIs, and biometric authentication.
Context
- Target user authentication flow: {{authentication_flow}}
- Stored secrets and token payload: {{target_keychain_items}}
- Local authentication and biometrics policy: {{biometric_policy}}
- Network transport security layer: {{network_transport_layer}}
- Device threat model: {{jailbreak_threat_profile}}
- Minimum supported deployment target: {{minimum_ios_deployment_target}}
Task
Deliver a technical security evaluation and architectural hardening analysis for {{authentication_flow}} to safeguard {{target_keychain_items}} against unauthorized local and runtime exfiltration on {{minimum_ios_deployment_target}}.
Method
- Review the current accessibility constants and access control flags assigned to {{target_keychain_items}}.
- Evaluate whether cryptographic private keys should be bound to the Secure Enclave via kSecAccessControlPrivateKeyUsage.
- Analyze {{biometric_policy}} for fallbacks to device passcode and evaluate biometric enrollment invalidation risks.
- Map potential attack surfaces exposed by {{jailbreak_threat_profile}} including runtime hooking and keychain dumping.
- Inspect {{network_transport_layer}} interactions to ensure secure token exchange and mutual TLS or certificate pinning alignment.
- Synthesize cryptographic access control requirements supported natively on {{minimum_ios_deployment_target}}.
- Provide hardened Swift code using Security framework and LocalAuthentication framework APIs.
Constraints
- MUST enforce kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly or stricter accessibility flags.
- MUST specify explicit SecAccessControlCreateFlags for biometric binding.
- MUST NOT store sensitive keys in UserDefaults, Core Data, or unencrypted plist caches.
- Exclude non-native third-party wrapper libraries from proposed remediation code.
Output format
- Threat Vector Matrix (table of vulnerabilities, likelihood, and impact)
- Keychain & Secure Enclave Architecture Assessment (structural review)
- Hardened Swift Implementation (complete secure storage wrapper)
- Biometric Policy Verification Strategy (handling domain changes and fallbacks)
- Security Verification Checklist (5-7 item compliance audit criteria)
Self-review
- Did I address the specific threat profile outlined in {{jailbreak_threat_profile}}?
- Are the Keychain access flags fully compatible with {{minimum_ios_deployment_target}}?
- Does the biometric policy handle LAError.biometryLockout and biometric state invalidation?
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.