Mobile Application Security Cheat Sheet
Mobile application development presents certain security challenges that are
unique compared to web applications and other forms of software. This cheat
sheet provides guidance on security considerations for mobile app development.
It is not a comprehensive guide by any means, but rather a starting point for
developers to consider security in their mobile app development.
Architecture & Design
1. Secure by Design
- Opt for a secure design at the beginning of development, not as an
afterthought.
- Keep in mind security principles like least privilege, defense in depth, and
separation of concerns.
- Follow industry standards and best practices, such as:
- National Institute of Standards and Technology (NIST)
- Internet Engineering Task Force (IETF)
For more information, see the
Secure Product Design Cheat Sheet.
2. Secure APIs
- Ensure that your mobile app communicates securely with backend services.
- Use OAuth2, JWT, or similar for secure authentication.
- Regularly update and rotate any used API keys or tokens.
3. Principle of Least Privilege
- Request only the permissions your app needs.
- This applies not only to device permissions granted by the user, but also to
permissions granted to the app by backend services.
- Avoid storing application files with overly permissive permissions.
- Secure by default: applications should have the most secure settings by default.
4. Supply Chain
Developing with third-party libraries and components introduces the possibility
of security unknowns.
- Ensure app signing.
- Use only trusted and validated third-party libraries and components.
- Establish security controls for app updates, patches, and releases.
- Monitor and detect security incidents of used third-party products.
See the Vulnerable Dependency Management Cheat Sheet for recommendations on managing third-party dependencies when vulnerabilities are discovered.
Authentication & Authorization
Authentication is a complex topic and there are many pitfalls. Authentication
logic must be written and tested with extreme care. The tips here are only a
starting point and barely scratch the surface. For more information, see the
Authentication Cheat Sheet and
M1: Insecure Authentication/Authorization
from the OWASP Mobile Top 10.
1. Don't Trust the Client
- Perform authentication/authorization server-side and only load data on
the device after successful authentication.
- If storing data locally, encrypt it using a key derived from the user's
login credentials.
- Do not store user passwords on the device; use device-specific tokens
that can be revoked.
- Avoid using spoofable values like device identifiers for authentication.
- Assume all client-side controls can be bypassed and perform them
server-side as well.
- Include client side code to detect code/binary tampering.
2. Credential Handling
- Do not hardcode credentials in the mobile app.
- Encrypt credentials in transmission.
- Do not store user credentials on the device. Consider using
secure, revocable access tokens.
3. Passwords and PIN Policy
- Require password complexity.
- Do not allow short PINs such as 4 digits.
- Use platform specific secure storage mechanisms, such as
Keychain (iOS) or Keystore (Android).
4. Biometric Authentication
- Use platform-supported methods for biometric authentication.
- Always provide a fallback, such as a PIN.
5. Session Management
- Sessions should timeout after inactivity.
- Offer a remote logout feature.
- Use randomly generated session tokens.
- Secure session data, both client and server side.
6. Token Storage
- Store authentication tokens securely.
- Handle token expiration gracefully.
7. Sensitive Operations
- Require users to re-authenticate for sensitive operations like changing
passwords or updating payment information.
- Consider requiring re-authentication before displaying highly sensitive
information as well.
- Require authorization checks on any backend functionality.
Data Storage & Privacy
1. Data Encryption
- Encrypt sensitive data both at rest and in transit.
- Store private data on the device's internal storage.
- Use platform APIs for encryption. Do not attempt to implement your own
encryption algorithms.
- Leverage hardware-based security features when available (e.g., Secure Enclave on iOS,
Strongbox on Android) for key storage and cryptographic operations
whenever available.
2. Data Leakage
- Beware of caching, logging, and background snapshots. Ensure that sensitive
data is not leaked through these mechanisms.
See the Logging Cheat Sheet for
examples of data that should not be logged.
3. Use HTTPS
- Always use HTTPS for network communications.
4. Third-Party Libraries
- Ensure all third-party libraries are secure and up to date.
5. Personally Identifiable Information (PII)
- Minimize any PII to necessity.
- Attempt to replace PII with less critical information if possible.
- Reduce PII, e.g. less frequent location updates.
- Implement automatic expiration and deletion of PII to minimize retention.
- Ask for user consent before collecting or using PII.
Network Communication
1. Don't Trust the Network
- Assume that all network communication is insecure and can be intercepted.
2. Use Secure Protocols
- Use HTTPS for all network communication.
- Do not override SSL certificate validation to allow self-signed or invalid
certificates.
- Avoid mixed version SSL sessions.
- Encrypt data even if sent over SSL, in case of future SSL vulnerabilities.
- Use strong, industry standard cipher suites, with appropriate key lengths.
- Use certificates signed by a trusted CA provider
- Avoid sending sensitive data via SMS.
3. Certificate Pinning
- Consider certificate pinning. See the Pinning Cheat Sheet
for pros and cons of this approach.
User Interface
1. UI Data Masking
- Mask sensitive information on UI fields to prevent shoulder surfing.
2. User Notifications
- Inform the user about security-related activities, such as logins from new
devices.
3. Input Validation
- Validate and sanitize user input. See the
Input Validation Cheat Sheet for more
information.
4. Output Validation
- Validate and sanitize output to prevent injection and execution attacks.
Code Quality
1. Static Analysis
- Use static analysis tools to identify vulnerabilities.
2. Code Reviews
- Make security a focal point during code reviews.
3. Update Libraries
- Keep all your libraries up to date to patch known vulnerabilities.
Application Integrity
- Disable debugging.
- Include code to validate integrity of application code.
- Obfuscate the app binary.
- Implement runtime anti-tampering controls:
- Check for signs of debugging, hooking, or code injection.
- Detect if the app is running in an emulator or rooted/jailbroken device.
- Verify app signatures at runtime.
- Apply appropriate responses to detected tampering (e.g., limiting functionality).
Testing
1. Penetration Testing
- Perform ethical hacking to identify vulnerabilities.
- Example tests:
- Cryptographic vulnerability assessment.
- Attempt to execute backend server functionality anonymously by removing any
session tokens from POST/GET requests.
2. Automated Tests
- Leverage automated tests to ensure that security features are working as
expected and that access controls are enforced.
3. Usability Testing
- Ensure that security features do not harm usability, which could cause users
to bypass security features.
Post-Deployment
1. Incident Response
- Have a clear incident response plan in place.
2. Updates
Plan for regular updates and patches. In the case of mobile apps, this is
especially important due to the delay between when a patch is released and
when users actually receive the updated version due to app store review
processes and the time it takes for users to update their apps.
Use a mechanism to force users to update their app version when necessary.
3. Monitoring and Analytics
- Use real-time monitoring to detect and respond to threats.
Platform-Specific Guidance
Android
Use Android's ProGuard for code obfuscation.
Avoid storing sensitive data in SharedPreferences. See the
Android docs
on working with data securely for more details.
Disable backup mode to prevent sensitive data being stored in backups.
Use Android Keystore with hardware backing (TEE or StrongBox) to securely store
cryptographic keys.
- How: Generate keys with hardware backing by specifying
.setIsStrongBoxBacked(true) in KeyGenParameterSpec.Builder when available (Android 9+).
- Verify hardware-backed storage via
KeyInfo.isInsideSecureHardware().
- Fall back to regular hardware-backed keystore if Strongbox isn't available.
- Configure key usage restrictions with
.setUserAuthenticationRequired(true)
for sensitive operations.
- See Hardware-backed Keystore documentation.
Implement Google's Play Integrity API for device and app integrity checks.
- How: Obtain an integrity verdict from the device, validate server-side,
and take action if integrity checks fail.
- The SafetyNet Attestation API was fully turned down in January 2025. All
developers must migrate to Play Integrity API.
- See Play Integrity API documentation.
iOS and iPadOS
Shortcuts Permissions
iOS/iPadOS Shortcuts allow for automation of app functions, which may
enable sensitive actions even when the device is locked.
There are several scenarios in which a user can execute a Shortcut
while the device is locked:
- If a Shortcut is added as a widget to Today View, it can be accessed
and executed while the device is locked.
2. If a Shortcut is assigned to the Action Button (on iPhone 15 Pro and
iPhone 16 Pro models), it can be executed by pressing the Action Button
while the device is locked.
3. If a Shortcut is assigned to the Control Center (on iOS/iPadOS 18+),
it can be executed by pulling up the Control Center and pressing the
Shortcut button while the device is locked.
4. A Shortcut can be invoked via Siri while the device is locked.
5. If a Shortcut is added to the user's Home Screen (on iOS/iPadOS 18+),
it can be directly executed by tapping the Shortcut button on the user's
lock screen while the device is locked.
6. If a Shortcut is set to run at a specific interval or a specific time,
it can execute even if the device is locked.
Sensitive app functionalities triggered via Shortcuts should always
require device unlock before execution.
How: Store secure tokens in Keychain that the app validates before
executing sensitive shortcuts. Implement checks with
UIApplication.shared.isProtectedDataAvailable to restrict execution
of sensitive actions when the device is locked.
Siri Permissions
- Siri can access app functionalities through voice or Type to Siri
commands, which is by default accessible even when the device is locked
potentially enabling unauthorized actions.
- How: Configure
requiresUserAuthentication to true on intents that expose
sensitive information or functionality. Additionally, set
INIntent.userConfirmationRequired = true for operations requiring explicit
user confirmation. These settings ensure proper authentication
(e.g., Face ID or PIN) and explicit approval before Siri can
execute sensitive commands. (For more information, see Apple Developer's
SiriKit documentation.)
Deep Link Security
- Deep links offer direct access to specific app screens, which could
potentially bypass authentication if not secured, allowing unauthorized
users access to secure sections of the app.
- An example of this on Microsoft Authenticator for iOS (which was
remediated in July 2024) allowed users to bypass App Lock by simply
navigating to
msauth://microsoft.aad.brokerplugin/?, which would
open Authenticator and dismiss the Face ID/Touch ID/passcode prompt.
- How: Implement authentication checks on any view controllers
or endpoints accessed via deep links. Configure and validate Universal
Links using apple-app-site-association files for secure deep linking.
Sanitize and validate all parameters received through deep links to
prevent injection attacks. Ensure unauthorized users are redirected
to the login screen, preventing direct access to sensitive parts of
the app without proper authentication. (See Apple Developer's
Supporting universal links in your app
documentation for more information.)
WidgetKit Security
- Widgets on the lock screen may display sensitive data, potentially
exposing it without the device being unlocked.
- How: For iOS/iPadOS versions 17 and higher, use
WidgetInfo.isLocked
to detect lock screen state. For earlier iOS versions, implement custom
logic based on available widget states since widgetFamily alone doesn't
directly provide lock screen information. Apply conditional logic to mask
or restrict sensitive widget content when appropriate security conditions
aren't met. (See Apple's WidgetKit security
for more information.)
Additional Security Considerations
Configure appropriate background refresh policies to prevent sensitive data
updates while the device is locked.
Implement proper privacy-related configurations in Info.plist for
features requiring user permissions.
Use App Groups with appropriate security configurations when sharing data
between app and widgets.
Use ATS (App Transport Security) to enforce strong security policies for
network communication.
Do not store sensitive data in plist files.
Use Apple's Secure Enclave for secure cryptographic key storage and
sensitive operations.
- How: Create keys using
SecKeyCreateRandomKey with kSecAttrTokenID
set to kSecAttrTokenIDSecureEnclave.
- Keys created in the Secure Enclave never leave the secure hardware -
only the operations using those keys are performed there.
- For biometric operations, use
LAContext with evaluatePolicy to
perform authentication directly through the Secure Enclave without
exposing biometric data to your application.
- Consider access control options like
kSecAccessControlBiometryAny or
kSecAccessControlUserPresence to require user authentication before
key usage.
- See Secure Enclave documentation.
Use Apple's App Attest API (iOS 14+) to validate app integrity.
- How: Generate attestation keys and assertions with
DCAppAttestService
and verify assertions server-side.
- Complement with Apple's DeviceCheck API for persistent device state tracking.
- See App Attest documentation.
Advanced Hardware Security & Monitoring
- Modern devices typically provide Trusted Execution Environments (TEE) or
secure hardware modules. Leverage these through standard OS APIs.
- Consider additional runtime security measures (behavioral anomaly
detection, runtime monitoring) to complement built-in OS protections
in higher-risk scenarios.
For further reading, visit the
OWASP Mobile Top 10 Project.
For a more detailed framework for mobile security, see the
OWASP Mobile Application Security Project.
1---2name: mobile-application-security-cheat-sheet3description: Mobile Application Security Cheat Sheet4---5# Mobile Application Security Cheat Sheet67Mobile application development presents certain security challenges that are8unique compared to web applications and other forms of software. This cheat9sheet provides guidance on security considerations for mobile app development.10It is not a comprehensive guide by any means, but rather a starting point for11developers to consider security in their mobile app development.1213## Architecture & Design1415### 1. Secure by Design1617- Opt for a secure design at the beginning of development, not as an18 afterthought.19- Keep in mind security principles like least privilege, defense in depth, and20 separation of concerns.21- Follow industry standards and best practices, such as:22 - National Institute of Standards and Technology (NIST)23 - Internet Engineering Task Force (IETF)2425For more information, see the26[Secure Product Design Cheat Sheet](Secure_Product_Design_Cheat_Sheet.md).2728### 2. Secure APIs2930- Ensure that your mobile app communicates securely with backend services.31- Use OAuth2, JWT, or similar for secure authentication.32- Regularly update and rotate any used API keys or tokens.3334### 3. Principle of Least Privilege3536- Request only the permissions your app needs.37- This applies not only to device permissions granted by the user, but also to38 permissions granted to the app by backend services.39- Avoid storing application files with overly permissive permissions.40- Secure by default: applications should have the most secure settings by default.4142### 4. Supply Chain4344Developing with third-party libraries and components introduces the possibility45of security unknowns.4647- Ensure app signing.48- Use only trusted and validated third-party libraries and components.49- Establish security controls for app updates, patches, and releases.50- Monitor and detect security incidents of used third-party products.5152See the [Vulnerable Dependency Management Cheat Sheet](Vulnerable_Dependency_Management_Cheat_Sheet.md) for recommendations on managing third-party dependencies when vulnerabilities are discovered.5354## Authentication & Authorization5556Authentication is a complex topic and there are many pitfalls. Authentication57logic must be written and tested with extreme care. The tips here are only a58starting point and barely scratch the surface. For more information, see the59[Authentication Cheat Sheet](Authentication_Cheat_Sheet.md) and60[M1: Insecure Authentication/Authorization](61https://owasp.org/www-project-mobile-top-10/2023-risks/m1-insecure-authentication-authorization.html)62from the OWASP Mobile Top 10.6364### 1. Don't Trust the Client6566- Perform authentication/authorization server-side and only load data on67the device after successful authentication.68- If storing data locally, encrypt it using a key derived from the user's69login credentials.70- Do not store user passwords on the device; use device-specific tokens71that can be revoked.72- Avoid using spoofable values like device identifiers for authentication.73- Assume all client-side controls can be bypassed and perform them74server-side as well.75- Include client side code to detect code/binary tampering.7677### 2. Credential Handling7879- Do not hardcode credentials in the mobile app.80- Encrypt credentials in transmission.81- Do not store user credentials on the device. Consider using82secure, revocable access tokens.8384### 3. Passwords and PIN Policy8586- Require password complexity.87- Do not allow short PINs such as 4 digits.88- Use platform specific secure storage mechanisms, such as89Keychain (iOS) or Keystore (Android).9091### 4. Biometric Authentication9293- Use platform-supported methods for biometric authentication.94- Always provide a fallback, such as a PIN.9596### 5. Session Management9798- Sessions should timeout after inactivity.99- Offer a remote logout feature.100- Use randomly generated session tokens.101- Secure session data, both client and server side.102103### 6. Token Storage104105- Store authentication tokens securely.106- Handle token expiration gracefully.107108### 7. Sensitive Operations109110- Require users to re-authenticate for sensitive operations like changing111 passwords or updating payment information.112- Consider requiring re-authentication before displaying highly sensitive113 information as well.114- Require authorization checks on any backend functionality.115116## Data Storage & Privacy117118### 1. Data Encryption119120- Encrypt sensitive data both at rest and in transit.121- Store private data on the device's internal storage.122- Use platform APIs for encryption. Do not attempt to implement your own123 encryption algorithms.124- Leverage hardware-based security features when available (e.g., Secure Enclave on iOS,125 Strongbox on Android) for key storage and cryptographic operations126 whenever available.127128### 2. Data Leakage129130- Beware of caching, logging, and background snapshots. Ensure that sensitive131 data is not leaked through these mechanisms.132133See the [Logging Cheat Sheet](Logging_Cheat_Sheet.md#data-to-exclude) for134examples of data that should not be logged.135136### 3. Use HTTPS137138- Always use HTTPS for network communications.139140### 4. Third-Party Libraries141142- Ensure all third-party libraries are secure and up to date.143144### 5. Personally Identifiable Information (PII)145146- Minimize any PII to necessity.147- Attempt to replace PII with less critical information if possible.148- Reduce PII, e.g. less frequent location updates.149- Implement automatic expiration and deletion of PII to minimize retention.150- Ask for user consent before collecting or using PII.151152## Network Communication153154### 1. Don't Trust the Network155156- Assume that all network communication is insecure and can be intercepted.157158### 2. Use Secure Protocols159160- Use HTTPS for all network communication.161- Do not override SSL certificate validation to allow self-signed or invalid162 certificates.163- Avoid mixed version SSL sessions.164- Encrypt data even if sent over SSL, in case of future SSL vulnerabilities.165- Use strong, industry standard cipher suites, with appropriate key lengths.166- Use certificates signed by a trusted CA provider167- Avoid sending sensitive data via SMS.168169### 3. Certificate Pinning170171- Consider certificate pinning. See the [Pinning Cheat Sheet](Pinning_Cheat_Sheet.md)172 for pros and cons of this approach.173174## User Interface175176### 1. UI Data Masking177178- Mask sensitive information on UI fields to prevent shoulder surfing.179180### 2. User Notifications181182- Inform the user about security-related activities, such as logins from new183 devices.184185### 3. Input Validation186187- Validate and sanitize user input. See the188 [Input Validation Cheat Sheet](Input_Validation_Cheat_Sheet.md) for more189 information.190191### 4. Output Validation192193- Validate and sanitize output to prevent injection and execution attacks.194195## Code Quality196197### 1. Static Analysis198199- Use static analysis tools to identify vulnerabilities.200201### 2. Code Reviews202203- Make security a focal point during code reviews.204205### 3. Update Libraries206207- Keep all your libraries up to date to patch known vulnerabilities.208209## Application Integrity210211- Disable debugging.212- Include code to validate integrity of application code.213- Obfuscate the app binary.214- Implement runtime anti-tampering controls:215 - Check for signs of debugging, hooking, or code injection.216 - Detect if the app is running in an emulator or rooted/jailbroken device.217 - Verify app signatures at runtime.218 - Apply appropriate responses to detected tampering (e.g., limiting functionality).219220## Testing221222### 1. Penetration Testing223224- Perform ethical hacking to identify vulnerabilities.225- Example tests:226 - Cryptographic vulnerability assessment.227 - Attempt to execute backend server functionality anonymously by removing any228 session tokens from POST/GET requests.229230### 2. Automated Tests231232- Leverage automated tests to ensure that security features are working as233 expected and that access controls are enforced.234235### 3. Usability Testing236237- Ensure that security features do not harm usability, which could cause users238 to bypass security features.239240## Post-Deployment241242### 1. Incident Response243244- Have a clear incident response plan in place.245246### 2. Updates247248- Plan for regular updates and patches. In the case of mobile apps, this is249 especially important due to the delay between when a patch is released and250 when users actually receive the updated version due to app store review251 processes and the time it takes for users to update their apps.252253- Use a mechanism to force users to update their app version when necessary.254255### 3. Monitoring and Analytics256257- Use real-time monitoring to detect and respond to threats.258259## Platform-Specific Guidance260261### Android262263- Use Android's ProGuard for code obfuscation.264- Avoid storing sensitive data in SharedPreferences. See the265 [Android docs](https://developer.android.com/topic/security/data)266 on working with data securely for more details.267- Disable backup mode to prevent sensitive data being stored in backups.268269- Use Android Keystore with hardware backing (TEE or StrongBox) to securely store270 cryptographic keys.271 - **How**: Generate keys with hardware backing by specifying272 `.setIsStrongBoxBacked(true)` in `KeyGenParameterSpec.Builder` when available (Android 9+).273 - Verify hardware-backed storage via `KeyInfo.isInsideSecureHardware()`.274 - Fall back to regular hardware-backed keystore if Strongbox isn't available.275 - Configure key usage restrictions with `.setUserAuthenticationRequired(true)`276 for sensitive operations.277 - See [Hardware-backed Keystore documentation](https://developer.android.com/training/articles/keystore).278279- Implement Google's [Play Integrity API](https://developer.android.com/google/play/integrity) for device and app integrity checks.280 - **How**: Obtain an integrity verdict from the device, validate server-side,281 and take action if integrity checks fail.282 - The SafetyNet Attestation API was fully turned down in January 2025. All283 developers must migrate to Play Integrity API.284 - See [Play Integrity API documentation](https://developer.android.com/google/play/integrity/overview).285286### iOS and iPadOS287288#### Shortcuts Permissions289290- iOS/iPadOS Shortcuts allow for automation of app functions, which may291enable sensitive actions even when the device is locked.292293- There are several scenarios in which a user can execute a Shortcut294while the device is locked:295296 1. If a Shortcut is added as a widget to Today View, it can be accessed297and executed while the device is locked.298 2. If a Shortcut is assigned to the Action Button (on iPhone 15 Pro and299iPhone 16 Pro models), it can be executed by pressing the Action Button300while the device is locked.301 3. If a Shortcut is assigned to the Control Center (on iOS/iPadOS 18+),302it can be executed by pulling up the Control Center and pressing the303Shortcut button while the device is locked.304 4. A Shortcut can be invoked via Siri while the device is locked.305 5. If a Shortcut is added to the user's Home Screen (on iOS/iPadOS 18+),306it can be directly executed by tapping the Shortcut button on the user's307lock screen while the device is locked.308 6. If a Shortcut is set to run at a specific interval or a specific time,309it can execute even if the device is locked.310311- Sensitive app functionalities triggered via Shortcuts should always312require device unlock before execution.313314- **How**: Store secure tokens in Keychain that the app validates before315executing sensitive shortcuts. Implement checks with316`UIApplication.shared.isProtectedDataAvailable` to restrict execution317of sensitive actions when the device is locked.318319#### Siri Permissions320321- Siri can access app functionalities through voice or [Type to Siri](322 https://support.apple.com/guide/iphone/change-siri-accessibility-settings-iphaff1d606/ios.)323 commands, which is by default accessible even when the device is locked324 potentially enabling unauthorized actions.325- **How**: Configure `requiresUserAuthentication` to `true` on intents that expose326sensitive information or functionality. Additionally, set327`INIntent.userConfirmationRequired = true` for operations requiring explicit328user confirmation. These settings ensure proper authentication329(e.g., Face ID or PIN) and explicit approval before Siri can330execute sensitive commands. (For more information, see Apple Developer's331[SiriKit](https://developer.apple.com/documentation/sirikit) documentation.)332333#### Deep Link Security334335- Deep links offer direct access to specific app screens, which could336potentially bypass authentication if not secured, allowing unauthorized337users access to secure sections of the app.338- An example of this on Microsoft Authenticator for iOS (which was339remediated in July 2024) allowed users to bypass App Lock by simply340navigating to `msauth://microsoft.aad.brokerplugin/?`, which would341open Authenticator and dismiss the Face ID/Touch ID/passcode prompt.342- **How**: Implement authentication checks on any view controllers343or endpoints accessed via deep links. Configure and validate Universal344Links using apple-app-site-association files for secure deep linking.345Sanitize and validate all parameters received through deep links to346prevent injection attacks. Ensure unauthorized users are redirected347to the login screen, preventing direct access to sensitive parts of348the app without proper authentication. (See Apple Developer's349[Supporting universal links in your app](350https://developer.apple.com/documentation/xcode/supporting-universal-links-in-your-app)351documentation for more information.)352353#### WidgetKit Security354355- Widgets on the lock screen may display sensitive data, potentially356exposing it without the device being unlocked.357- **How**: For iOS/iPadOS versions 17 and higher, use `WidgetInfo.isLocked`358to detect lock screen state. For earlier iOS versions, implement custom359logic based on available widget states since `widgetFamily` alone doesn't360directly provide lock screen information. Apply conditional logic to mask361or restrict sensitive widget content when appropriate security conditions362aren't met. (See Apple's [WidgetKit security](363https://support.apple.com/guide/security/widgetkit-security-secbb0a1f9b4/web)364for more information.)365366#### Additional Security Considerations367368- Configure appropriate background refresh policies to prevent sensitive data369updates while the device is locked.370- Implement proper privacy-related configurations in `Info.plist` for371features requiring user permissions.372- Use App Groups with appropriate security configurations when sharing data373between app and widgets.374- Use ATS (App Transport Security) to enforce strong security policies for375network communication.376- Do not store sensitive data in `plist` files.377378- Use Apple's Secure Enclave for secure cryptographic key storage and379 sensitive operations.380 - **How**: Create keys using `SecKeyCreateRandomKey` with `kSecAttrTokenID`381 set to `kSecAttrTokenIDSecureEnclave`.382 - Keys created in the Secure Enclave never leave the secure hardware -383 only the operations using those keys are performed there.384 - For biometric operations, use `LAContext` with `evaluatePolicy` to385 perform authentication directly through the Secure Enclave without386 exposing biometric data to your application.387 - Consider access control options like `kSecAccessControlBiometryAny` or388 `kSecAccessControlUserPresence` to require user authentication before389 key usage.390 - See [Secure Enclave documentation](https://support.apple.com/guide/security/secure-enclave-sec59b0b31ff/web).391392- Use Apple's [App Attest API](https://developer.apple.com/documentation/devicecheck/establishing_your_app_s_integrity) (iOS 14+) to validate app integrity.393 - **How**: Generate attestation keys and assertions with `DCAppAttestService`394 and verify assertions server-side.395 - Complement with Apple's [DeviceCheck API](https://developer.apple.com/documentation/devicecheck) for persistent device state tracking.396 - See [App Attest documentation](https://developer.apple.com/documentation/devicecheck/dcappattestservice).397398## Advanced Hardware Security & Monitoring399400- Modern devices typically provide Trusted Execution Environments (TEE) or401 secure hardware modules. Leverage these through standard OS APIs.402- Consider additional runtime security measures (behavioral anomaly403 detection, runtime monitoring) to complement built-in OS protections404 in higher-risk scenarios.405406For further reading, visit the407[OWASP Mobile Top 10 Project](https://owasp.org/www-project-mobile-top-10/).408For a more detailed framework for mobile security, see the409[OWASP Mobile Application Security Project](https://mas.owasp.org/).