Mobile apps have become the gateways to our personal, financial, and professional lives. From online banking and health monitoring to shopping and messaging, these apps often store sensitive user data locally on the device for performance and accessibility. Convenience comes with a hidden danger of insecure data storage.
OWASP Mobile Top 10 ranks Insecure Data Storage as M9, highlighting it as a serious yet frequently overlooked security vulnerability. When sensitive data such as authentication tokens, credit card information, or personally identifiable information (PII) is stored insecurely, attackers can exploit this flaw through rooted devices, malware, or physical access, often without bypassing advanced security layers.
OWASP M9: Insecure Data Storage
According to the OWASP (Open Worldwide Application Security Project) Mobile Top 10 list, Insecure Data Storage is the ninth most critical threat to mobile security. This risk involves the inadequate protection of sensitive information saved on mobile devices, which may be saved in plain text, cached without security, stored without proper encryption, or lacking appropriate controls for access and protection.
Unlike weaknesses from intricate multi-step exploits or flaws within the system architecture, insecure data storage primarily stems from development missteps, overly optimistic views regarding the mobile operating system’s security features, or both. Examples of information that could be improperly handled are:
- Unencrypted SQLite databases
- Shared preferences and list files
- Unprotected external storage (like SD cards)
- App logs and debug files
- Cache or temporary storage
Why this remains a persistent mobile security concern
Despite increased awareness around mobile app security, insecure data storage continues to persist for several reasons:
- Developer Convenience: Mobile apps are expected to be fast and responsive. Developers sometimes prioritize speed and user experience over security by caching or storing sensitive data locally to reduce network calls, which often lack proper protection.
- Misplaced Trust in OS Security: There’s a false sense of security that iOS and Android’s sandboxing mechanisms are enough to protect data. Attackers can bypass these restrictions easily if a device is jailbroken or rooted.
- Lack of Security Training: Not all mobile developers are trained in secure coding practices. Many may be unaware that storing session IDs in shared preferences or saving files to external storage can lead to data breaches.
- Inadequate Testing: Many security audits focus on backend APIs, while local storage security on the client side remains under-tested or neglected entirely.
Who should care: AppSec teams, mobile developers, and CISOs
The responsibility of addressing OWASP M9 doesn’t fall on one group. It’s a shared concern across the mobile app development lifecycle.
- Mobile Developers: They are on the frontlines of implementation. Understanding secure storage APIs, encrypting data at rest, and avoiding poor storage practices are essential for reducing the attack surface.
- Application Security (AppSec) Teams: AppSec specialists must integrate mobile-specific storage tests into their CI/CD pipelines, perform regular code reviews, and ensure security tools like MAST (Mobile Application Security Testing) solutions are in place.
- Chief Information Security Officers (CISOs): CISOs must ensure that security governance extends to mobile apps. Includes enforcing policies, allocating budgets for secure development, and incorporating mobile risks into the organization’s broader threat models.
What Constitutes Insecure Data Storage
Mobile applications frequently save data to improve convenience, enable offline access, or for other reasons. When this storage space is not secured appropriately, it can become a risk zone rather than a convenience zone. Inefficient data storage occurs when more sensitive data than required is saved on a device in a manner that can be easily accessed by an attacker, malware, or even some other application with little effort.
Definition & Threat Model
Insecure data storage keeps sensitive data in a device or system without adequate protection, such as encryption, proper access controls, or passwords. This problem is caused by broken user and authentication systems, which enable the user to be authenticated but act as a trusting customer server instance. In reality, filesystems are openly available, especially on mobile devices.
Threat Model: The threat model for data storage focuses on opponents that include advanced technological experts with hacking skills, career cybercriminals, and even traitorous employees, state-sponsored individuals, and company competitors. These threat agents might attack the application to harvest confidential information, alter information, or inject harmful software into it. Some of these attack vectors include access to the device, such as physical access or malware, use of exploitation through weak or the absence of encryption, and use of poorly documented props.
Types of sensitive data commonly mishandled
Information has become integral to the world, powering everything from secure access to custom offers. Unfortunately, not all information is stored with the requisite care it deserves. One glaring flaw in how sensitive data is stored is its lax security. This poor handling approach was marked as a critical threat by OWASP M9 and is a common issue amongst user devices.
Mobile applications are just as guilty as every other technology. They also store critical information such as access tokens, session IDs, personal identity information, and cryptographic keys without adequate encryption or protection. Storing such sensitive information makes one susceptible to data breaches, regulatory breaches, and even unsupported access.
Authentication tokens & session IDs
These tokens maintain user sessions without requiring repeated logins. Storing them insecurely, such as in plain text files or shared preferences, allows attackers to hijack user sessions or impersonate users on backend services.
Examples of risky practices:
- Storing OAuth tokens in plaintext on internal storage.
- Not clearing tokens upon logout.
- Failing to use secure keychain or keystore mechanisms provided by the OS.
User PII & financial data
Personally identifiable information (PII) such as names, email addresses, phone numbers, government IDs, and financial data like credit card numbers or transaction histories are prime targets for attackers.
Common missteps include:
- Logging user data during debugging and not removing logs in production builds.
- Storing financial details in unencrypted local databases.
- Using insecure external storage (e.g., SD card) for sensitive PDFs or invoices.
App configurations & keys
Apps often store configuration files, API endpoints, encryption keys, or license information locally. If these are exposed, attackers can reverse-engineer the app, exploit backend services, or manipulate app behaviour.
Examples of poor practices:
- Embedding hardcoded API keys in the source code.
- Storing private keys in plaintext configuration files.
- Allowing debug configurations in production builds.
Common storage mechanisms that are misused
Storing data locally on a device is often necessary to enhance user experience, improve performance, and support offline functionality. Convenience can come at the cost of security when developers unknowingly misuse built-in storage mechanisms.
Mobile platforms like Android and iOS offer various storage options, such as shared preferences, user defaults, local databases, and temporary files, each with its own purpose and security considerations. When these mechanisms are used to store sensitive information without proper encryption, access controls, or cleanup routines, they create exploitable vulnerabilities.
Shared Preferences (Android)
SharedPreferences is a widely used Android API for persistently storing small amounts of key-value data. It is intended to store user preferences and simple settings.
- Plaintext Storage: By default, SharedPreferences stores data in plaintext XML files, which can be accessed by any process or user with root access.
- Root Access: On rooted devices, attackers can read these files, exposing sensitive information such as usernames, passwords, or tokens.
NSUserDefaults (iOS)
NSUserDefaults is the iOS equivalent of SharedPreferences, used to store user preferences and configuration data.
- Plaintext Storage: Like SharedPreferences, NSUserDefaults stores data in plaintext property list (plist) files.
- Accessible Data: These files can be easily accessed on jailbroken devices, exposing sensitive information.
Internal & external storage
Android and iOS apps can store files in internal (private to the app) and external (shared or public) storage.
- Internal Storage: Generally secure, but data can still be accessed on rooted or jailbroken devices.
- External Storage: Files saved on external storage (SD card, shared directories) can be accessed by any app or user, leading to data leakage.
Local databases (SQLite, Realm)
SQLite and Realm are popular local mobile app database solutions that store structured data.
- Plaintext Databases: By default, databases are stored unencrypted, making data accessible to attackers with device access.
- SQL Injection: Poorly implemented queries can lead to data leakage or corruption.
Caches, logs, and temp files
Apps often use caches, logs, and temporary files for performance and debugging.
- Accessible Files: Other apps or users can access Cached data and logs, especially on rooted/jailbroken devices.
- Debugging Leaks: Debug logs may contain sensitive data if not properly sanitized.
How Insecure Data Storage is Exploited
A casual stance on mobile apps insecure data storage practices may be understandable, as it concerns files or preferences saved on a user’s device. Data storage on mobile devices is one of the most appealing attack targets for cybercriminals, who are keen on extracting sensitive information without the hassle of sophisticated hacks or server-side infiltrations.
Cybercriminals aim for mobile apps data management systems, targeting less closely controlled zones like authentication tokens, personal identifiers, and encryption keys. This exploitation transpires in one of the existing methods: physical access to the device (malware capabilities or rooting the device) or controlled adversary access.
Learn more about real-world exploitation scenarios in our Mobile Application Penetration Testing Guide.
Rooted/jailbroken device risks
Rooted (Android) or jailbroken (iOS) devices remove many built-in security restrictions protecting app data. On such devices, attackers can bypass sandboxing and access files and databases that would otherwise be restricted.
- Direct File Access: Attackers can browse the device’s filesystem and extract sensitive data stored in plaintext, such as SharedPreferences, SQLite databases, or logs.
- Data Theft: Authentication tokens, PII, and encryption keys are easily accessible if not adequately protected.
- Bypassing Encryption: Some encryption mechanisms rely on device security features compromised on rooted/jailbroken devices, making decryption easier for attackers.
Access via third-party tools or malware
Third-party tools (such as backup utilities or file managers) and malware can access app data, especially if stored insecurely.
- Backup Extraction: Tools like adb backup can create local app data backups, which can be analysed for sensitive information.
- Malware Attacks: Malicious apps with storage permissions can read, modify, or delete external or poorly protected internal storage data.
- Cross-App Data Leakage: Malware can exploit inter-app communication or shared storage to siphon data from vulnerable apps.
Memory dumps & forensic extraction
Memory dumps and forensic tools allow attackers to extract data from a device’s volatile memory or persistent storage.
- RAM Extraction: Sensitive data temporarily stored in memory (such as passwords or tokens) can be captured using memory dumps, especially if the app does not clear memory after use.
- Forensic Tools: Tools like forensic extraction kits can recover deleted files, cached data, and even encrypted data if weak encryption is used.
- Persistent Data Recovery: Forensic techniques can reconstruct app databases and logs to retrieve sensitive information.
Reverse engineering app packages (APK/IPA)
Attackers often reverse engineer mobile app binaries (APK for Android, IPA for iOS) to identify hardcoded secrets and understand how data is stored.
- Hardcoded Secrets: API keys, encryption keys, or credentials embedded in the app binary can be extracted using decompilation tools.
- Storage Logic Analysis: Reverse engineering reveals where and how the app stores sensitive data, allowing attackers to target those storage locations.
- Debug Information: Debug logs or configuration files in the app package may inadvertently expose sensitive data.
Real-world mobile data breach examples
Numerous high-profile breaches have resulted from insecure data storage in mobile apps.
- Plaintext Password Storage: Apps found storing user passwords in plaintext in local databases or logs, leading to mass credential theft.
- Unsecured Cloud Storage: Misconfigured cloud storage buckets used by mobile apps have exposed millions of user records to the public internet.
- Third-Party Library Vulnerabilities: Apps using vulnerable third-party libraries have inadvertently leaked sensitive data, enabling attackers to exploit known flaws.
- Fitness App Data Leaks: Several fitness and health apps have exposed user location data, health records, and PII due to insecure storage and sharing practices.
Mobile Platform-Specific Pitfalls
While mobile operating systems like Android and iOS provide robust security features, they also have unique quirks and implementation differences that can lead to security oversights if not carefully handled. These platform-specific pitfalls often emerge when developers rely on default behaviours, assume cross-platform security parity, or overlook platform guidelines during development.
Features like background services, inter-app communication, and third-party library usage introduce additional complexity and risk. Understanding these platform-specific vulnerabilities is critical for building secure mobile applications.
Android-specific risks
Android’s open and flexible architecture has made it the most widely adopted mobile operating system globally, but this popularity comes with a unique set of security challenges. Android presents several vulnerabilities due to its file system accessibility, broad device ecosystem, and user permissions model.
Unlike iOS, Android allows more freely accessible external storage and inter-app data interactions, which, if misused, can lead to unintentional data exposure. Features like SharedPreferences, internal/external storage APIs, and SQLite databases are powerful, but if developers overlook encryption or access controls, sensitive data becomes easy prey for attackers, especially on rooted devices.
Unprotected shared preferences
SharedPreferences is a common mechanism for storing small amounts of key-value data, such as user settings or preferences. SharedPreferences files are stored in plaintext XML format within the app’s private directory. While this directory is protected by Android’s sandboxing, on rooted devices or through backup tools, attackers can access these files.
- If accessed, sensitive data like authentication tokens, user credentials, or configuration details stored in SharedPreferences can be easily read.
- Tools like adb backup can extract these files, bypassing sandbox protections.
World-readable files
Android allows developers to set file permissions when creating files. If a file is created with world-readable permissions, any app or user on the device can read its contents.
- Data Leakage: Sensitive information stored in world-readable files can be accessed by any app, increasing the risk of data breaches.
- Common Missteps: Developers may inadvertently set incorrect permissions when writing files, especially when targeting older Android versions or using legacy code.
SD card uses without encryption
Android apps sometimes store data on external storage (SD cards) for convenience or to save internal storage space. External storage is accessible to all apps with permission from READ_EXTERNAL_STORAGE.
- Unrestricted Access: Any app with the appropriate permissions can read or modify files stored on the SD card, making sensitive data highly vulnerable.
- Tampering and Injection: Malicious apps can alter files on the SD card, potentially injecting harmful data or code that the app may later load and execute.
IOS-specific risks
Apple’s iOS ecosystem is often considered more secure than its counterparts due to strict app sandboxing, controlled hardware-software integration, and limited user access. Assuming that iOS apps are immune to data storage vulnerabilities is a dangerous misconception. While iOS does provide robust security frameworks like the Keychain and Data Protection APIs, these tools are only practical if developers use them correctly.
Many iOS apps still misuse storage mechanisms such as NSUserDefaults, unsecured list files, or unprotected local databases, exposing sensitive user data. Jailbroken devices bypass system protections, making it easier for attackers to extract insecurely stored data from app sandboxes.
Misuse of Keychain
The iOS Keychain is designed to securely store sensitive data such as passwords, authentication tokens, and encryption keys. Misuse of the Keychain can undermine its security benefits.
- Incorrect Access Controls: If developers do not use appropriate Keychain access controls (e.g., allowing access only when the device is unlocked or restricting access to a single app), sensitive data may be exposed to other apps or unauthorized users.
- Hardcoding or Mismanagement: Storing secrets with weak protection attributes or failing to use the Keychain’s advanced security features (like requiring user presence with Face ID or Touch ID) can make data vulnerable to extraction via jailbreak or forensic tools.
NSUserDefaults misuse
NSUserDefaults is a convenient way to store small amounts of user preferences or settings. It is not intended for sensitive data.
- Plaintext Storage: NSUserDefaults stores data in plaintext property list (plist) files within the app’s sandbox. These files can be easily accessed on jailbroken devices, exposing sensitive information.
- Data Leakage: Storing credentials, authentication tokens, or PII in NSUserDefaults can lead to data leakage if the device is compromised.
No Data Protection class assigned
iOS provides file protection classes that leverage the device’s hardware encryption and link file access to the user’s passcode and device state. If no data protection class is assigned, files are only encrypted at rest but remain accessible when the device is unlocked, regardless of the app’s state.
- Reduced Security: Without a data protection class, files are not protected when the device is unlocked, making it easier for attackers with physical access to extract sensitive data.
- Forensic Extraction: Attackers can use forensic tools to access files if a strong passcode does not protect the device or the app does not use appropriate protection classes.
Red Flags in Code & Config
Security is often compromised not by sophisticated attacks but simple oversights in code and configuration. These oversights, commonly referred to as red flags, are warning signs that indicate the presence of insecure practices that could lead to vulnerabilities such as insecure data storage, unauthorized access, or data leakage.
Mobile apps interact with sensitive data, including authentication tokens, personal user information, and payment credentials. When developers use insecure storage mechanisms, hard-code sensitive values, or fail to implement proper encryption protocols, they unknowingly introduce serious security gaps.
Hardcoded secrets
Hardcoded secrets refer to sensitive information, such as passwords, API keys, encryption keys, or database credentials, embedded directly in the source code or configuration files. This practice is risky because anyone accessing the codebase can extract and misuse these credentials.
- Information Disclosure: Attackers can easily access sensitive data if the code is leaked or shared.
- Unauthorized Access: Hardcoded credentials allow attackers to impersonate legitimate users or services.
- Data Modification: Attackers can alter or delete data, potentially causing data loss or system instability.
Lack of file encryption
File encryption is the process of encoding files so only authorized users with the correct decryption key can access their contents.
- Data Breach Risk: Unencrypted files are vulnerable to unauthorized access, especially if stored in shared or cloud environments.
- Compliance Violations: Many regulations require encryption of sensitive data at rest and in transit.
- Loss of Confidentiality: Sensitive information, such as user data or intellectual property, can be easily stolen.
Use of outdated libraries for crypto or DB
Using outdated or unsupported cryptographic libraries or database connectors can introduce vulnerabilities, as these libraries may contain unpatched security flaws.
- Known Vulnerabilities: Outdated libraries may have publicly known exploits.
- Insecure Algorithms: Older libraries may use deprecated or weak cryptographic algorithms.
- Compatibility Issues: Outdated libraries might not support modern security features or standards.
Debug logs storing sensitive data
Debug logs that inadvertently capture sensitive data, such as passwords, credit card numbers, or user identifiers, can become a serious security risk if logs are exposed or leaked.
- Information Leakage: Unauthorized users or attackers can access Sensitive data in logs.
- Regulatory Non-Compliance: Many data protection laws require that sensitive data not be stored in logs.
- Increased Attack Surface: Attackers can use logged data to perform reconnaissance or impersonate users.
Detection and Monitoring Challenges
Detecting and monitoring insecure data storage in mobile applications is far from straightforward. Unlike server environments where centralized logging and monitoring are standard, mobile apps operate on user-controlled devices with limited visibility and control. This decentralization, combined with third-party SDKs, conditional logic, and varying storage mechanisms, creates significant blind spots for developers and security teams.
Static vs dynamic analysis limitations
Static and dynamic analysis are two widely used methods for identifying vulnerabilities in mobile applications, but both have notable limitations when detecting insecure data storage.
- Static Analysis: This method scans source code or compiled binaries without executing the app. While it helps catch hardcoded secrets or insecure API usage, it often generates false positives and misses context-specific issues, such as data being conditionally written to insecure storage based on runtime logic.
- Dynamic Analysis: This involves observing the app during execution in a controlled environment. Although more realistic, it may fail to trigger specific storage paths unless every edge case is manually tested.
Difficulty in testing all execution flows
Modern mobile apps have increasingly complex codebases with multiple user flows, conditions, and asynchronous operations. This complexity makes it extremely challenging to test all execution paths that might lead to insecure data storage.
- A token might only be cached locally if a network call fails.
- Sensitive logs might only be written when a debug mode is enabled.
- User data might be temporarily stored during specific onboarding flows or payment errors.
Obfuscation by third-party SDKs
Many mobile apps rely heavily on third-party SDKs for analytics, payments, ads, and crash reporting. These SDKs often operate as black boxes and may store data locally without the developer’s knowledge or control.
Worse still, some SDKs use code obfuscation techniques to hide their internal logic, making it nearly impossible to audit their behaviour. Even security tools might be unable to inspect or intercept what these SDKs are doing at runtime. If an SDK is insecurely storing user data or sending it to external servers, the risk becomes invisible to the developer and the security team.
Lack of runtime alerts or telemetry
Unlike server-side environments that benefit from robust logging, monitoring, and real-time alerting systems, mobile apps often lack meaningful runtime telemetry. If sensitive data is stored insecurely or accessed inappropriately on a user’s device, there is typically no mechanism to detect or report it.
- No alerts are triggered when data is written to insecure locations like shared preferences or external storage.
- Mobile operating systems don’t natively provide audit trails for file access or data leaks.
- Security incidents on mobile devices are more complex to monitor because the app runs in a user-controlled environment without persistent oversight.
Prevention & Remediation Strategies
Insecure data storage remains one of mobile applications’ most overlooked yet critical security risks. While identifying vulnerabilities is essential, the true strength of a secure mobile app lies in the preventive measures and remediation practices implemented throughout the development lifecycle.
From secure coding practices and proper encryption techniques to robust testing workflows and post-release monitoring, understanding and applying these strategies is vital to safeguarding user data and maintaining regulatory compliance in today’s mobile-first world. Many of the cryptographic failures that may lead to insecure storage are covered in OWASP A02: Cryptographic Failures.
Strong data classification practices
Data classification is the foundation of information security. It helps organizations understand what data they possess, its sensitivity, and how it should be protected. By categorizing data, such as public, internal, confidential, or restricted, organizations can apply appropriate security controls and ensure compliance with regulations like GDPR and HIPAA.
- Identify Data Categories: Define clear categories based on sensitivity and business impact.
- Set Classification Criteria: Use confidentiality, integrity, and regulatory requirements to determine classification levels.
- Assign Ownership: Appoint data owners responsible for classification and protection.
- Communicate and Train: Educate employees on classification policies and handling procedures.
Proper use of encryption
Encryption is a critical defence mechanism in mobile app security to protect sensitive data from unauthorized access. Simply implementing encryption is not enough; how it is applied determines its effectiveness. Improper or incomplete encryption practices can give users a false sense of security while still leaving data exposed to attackers.
Platform-specific best practices (iOS/Android)
iOS
- Keychain Services: Store sensitive data such as passwords, tokens, and cryptographic keys in the secure iOS Keychain, which is hardware-protected and encrypted.
- HTTPS with TLS: Always use secure network protocols for data in transit to prevent interception.
Android
- Android Keystore: Store cryptographic keys and sensitive data securely within the Android Keystore, which protects keys from extraction and misuse.
- Store Keys in Native Code: Consider using the Android NDK to store sensitive data in native code, which is more difficult to analyze than Java code.
Use hardware-backed keystores
Hardware-backed keystores leverage the device’s Secure Element or Trusted Execution Environment (TEE) to store cryptographic keys and perform sensitive operations. This approach protects keys and data from software-based attacks and unauthorized access.
- Enhanced Security: Keys are stored in a secure, isolated environment, making them resistant to extraction.
- Compliance: Essential for meeting strict security standards in industries like finance and healthcare.
- Key Attestation: Implement key attestation to verify that keys are generated and stored in a secure environment, providing additional assurance of device integrity.
Avoid unnecessary storage of sensitive data
Storing sensitive data on a device should always be a last resort. The best security practice is collecting and storing only the data necessary for your app’s core functionality. Unnecessary storage increases risk: if a device is compromised, any sensitive information stored locally becomes a liability.
- Data Minimization: Only request and store the minimum user data required. For example, avoid storing full credit card numbers or personal identifiers unless necessary.
- Retention Policies: Implement clear data retention policies to delete data that is no longer needed automatically.
- Regular Audits: Periodically review stored data and remove anything obsolete or unnecessary.
- User Education: Inform users about what data is collected and why, enhancing transparency and trust.
Secure implementation of local DBs and cache
Local databases and caches are often essential for app performance and offline functionality, but they must be managed securely to prevent unauthorized access and data leaks.
- Use Internal Storage: Always store sensitive data in the device’s internal storage, which is sandboxed and inaccessible to other apps.
- Encrypt Sensitive Data: Apply strong encryption (e.g., AES-256) to sensitive data stored in local databases or caches.
- Secure Key Management: Store encryption keys securely, preferably using platform-provided solutions like Android Keystore or iOS Keychain.
Implement secure delete practices
Removing files or database entries does not always erase data; malicious actors can sometimes recover “deleted” data from storage devices.
- Overwrite Data Before Deletion: When deleting sensitive data, overwrite the storage location with random data to prevent recovery.
- Use Platform APIs: Leverage platform-specific secure deletion APIs where available.
- Immediate Deletion: Remove sensitive data as soon as it is no longer needed, rather than waiting for periodic cleanup.
Secure logging strategies
Logging is crucial for troubleshooting and monitoring but can expose sensitive data if not managed carefully.
- Filter Sensitive Data: Do not log sensitive information such as passwords, authentication tokens, or personal identifiers.
- Use Log Redaction Tools: Implement tools or libraries that automatically redact or mask sensitive data in logs.
- Control Log Access: Restrict access to log files to authorized personnel only.
Organizational & Development Best Practices
Building secure mobile applications goes beyond individual coding techniques; it requires a coordinated effort across organizational policies and development workflows. As highlighted in OWASP M9, insecure data storage often stems from a lack of standardized practices, inadequate security training, or siloed teams working without shared accountability. Organizations must embed security into the entire software development lifecycle (SDLC) to effectively mitigate such risks, from design and coding to testing and deployment.
Enforce secure mobile coding standards
Secure coding standards are the foundation of mobile app security. They provide developers with clear guidelines to avoid common vulnerabilities such as hardcoded secrets, improper input validation, and insecure API usage. Enforcing these standards reduces the risk of introducing security flaws during development.
- Establish a Secure Coding Policy: Define and document secure coding guidelines for mobile platforms (iOS, Android).
- Automate Code Analysis: Use static code analysis tools to scan for vulnerabilities before merging the code.
- Code Reviews: Integrate secure code reviews into the development workflow to catch issues early.
Threat modeling for mobile data paths
Threat modelling helps identify and mitigate risks by analyzing how data flows through an application and where it might be vulnerable to attack. This proactive approach is essential for understanding potential threats and designing appropriate defences.
- Decompose the Application: Use diagrams such as data flow diagrams (dfds) to map out data flows, entry points, and trust boundaries.
- Identify and Rank Threats: To assess risks, use frameworks like STRIDE (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege) or DREAD (Damage, Reproducibility, Exploitability, Affected Users, Discoverability).
- Mitigate Risks: Develop countermeasures for identified threats and integrate them into the app’s design and code.
Include insecure storage checks in CI/CD pipeline
Continuous Integration/Continuous Deployment (CI/CD) pipelines automate the build and deployment process but can also introduce security risks if not adequately secured. Checks, including insecure storage, ensure that sensitive data is not inadvertently stored or leaked in logs, caches, or databases.
Best Practices
- Automate Security Scans: Integrate automated tools that scan for insecure storage of sensitive data (e.g., hardcoded credentials, unencrypted local storage).
- Enforce Security Gates: Configure the pipeline to block deployments if insecure storage practices are detected.
- Regularly Update Tools: Keep security scanning tools updated to detect new vulnerabilities.
Developer education and secure code reviews
Developers are the first line of defence against security vulnerabilities. Ongoing education and secure code reviews help teams recognise emerging threats and best practices.
- Regular Training Programs: Provide developers up-to-date training on secure coding, threat modeling, and platform-specific security features.
- Conduct Secure Code Reviews: Peer reviews focused on security help identify issues automated tools might miss.
- Encourage Security Champions: Appoint team members to advocate for security and mentor others.
Regulatory & Ecosystem Guidance
Organizations must adhere to a growing body of compliance requirements while effectively integrating into broader technology ecosystems. Regulatory & Ecosystem Guidance is a strategic resource to help businesses understand and navigate these complex frameworks.
Ecosystem considerations and governance models that influence operational and technological decisions. By following this guidance, organizations can ensure compliance, foster innovation, and maintain alignment with industry standards and ecosystem expectations.
OWASP Mobile Top 10 – M9
The OWASP Mobile Top 10 is a widely recognized list of the most critical security risks to mobile applications, curated by security professionals worldwide. The 2024 and 2025 lists place Insecure Data Storage (M9) as a persistent and high-priority risk, emphasizing the ongoing need to secure sensitive data stored on mobile devices.
Key Aspects of M9: Insecure Data Storage
- Definition: M9 covers vulnerabilities that allow unauthorized access to sensitive data stored on a device, such as user credentials, personal information, or payment details.
- Common Causes: Storing data in plaintext, using weak encryption, or placing sensitive files in insecure locations (such as external storage or unencrypted databases).
- Impact: Data breaches, identity theft, and regulatory non-compliance.
GDPR, HIPAA, and local data privacy laws
GDPR (General Data Protection Regulation):
- Scope: Applies to organizations handling the personal data of EU citizens.
- Requirements: Obtain explicit consent for data collection, implement data minimization, ensure data portability, and report breaches within 72 hours.
- Implications for Mobile Apps: Secure storage, encryption, and clear privacy policies are mandatory. Users must be able to access, correct, or delete their data.
HIPAA (Health Insurance Portability and Accountability Act):
- Scope: Pertains to healthcare-related data in the United States.
- Requirements: Protect the confidentiality, integrity, and availability of Protected Health Information (PHI).
- Implications for Mobile Apps: Strict access controls, encryption of PHI, audit trails, and secure deletion of data when no longer needed.
Local Data Privacy Laws:
- Examples: California Consumer Privacy Act (CCPA), Brazil’s LGPD, and India’s DPDP Act.
- Requirements: Vary by region but generally include data subject rights, breach notification, and security safeguards.
- Implications for Mobile Apps: Data handling and protection measures must be tailored to comply with each jurisdiction’s regulations.
Apple & Google security policy alignment
Apple App Store:
- Guidelines: Require apps to implement strong data protection, use secure APIs (e.g., Keychain), and provide transparent privacy policies.
- Review Process: Apps are scrutinized for compliance with Apple’s security and privacy standards before publication.
- User Controls: Apps must request permission for sensitive data access (e.g., location, contacts, camera) and respect user choices.
Google Play Store:
- Guidelines: Mandate secure coding practices, proper data handling, and using Android’s security features (e.g., the Android Keystore and the permission model).
- Review Process: Google performs automated and manual checks to detect malicious or non-compliant apps.
- User Controls: Like Apple, apps must request permissions and respect user privacy settings.
Conclusion
Overlooking secure data storage is no longer an option. Missteps can lead to breaches, compliance violations, and irreversible reputational damage. Whether you are storing authentication tokens, financial details, or user preferences, every bite of data needs to be treated as a security asset. Building trust begins with safeguarding that data from day one.
Now is the time to assess your app’s data storage practices, identify misconfigurations, and fortify vulnerabilities.
At SecureLayer7, we specialize in identifying insecure data storage patterns and securing mobile applications against modern threats. Our expert-driven assessments, code reviews, and penetration testing services help you build secure, compliant, and resilient apps from the ground up.
Schedule a security assessment with SecureLayer7 today and safeguard your mobile future.
FAQs
Insecure data storage refers to the improper handling of sensitive information, such as authentication tokens, personal user data, or financial details, on a mobile device. This can include saving data in plaintext in local files, using weak or no encryption, or storing data in areas easily accessible by other apps or users. Attackers can exploit these weaknesses to access, modify, or steal data, even without elevated privileges in some cases.
SharedPreferences is designed for storing simple key-value pairs, not sensitive information. By default, data stored in SharedPreferences is written in plaintext and is vulnerable if the device is rooted or if an attacker gains physical access. Without additional encryption, storing sensitive data like passwords or tokens here can expose users to identity theft or unauthorized access.
• Android: Use the Android Keystore system to generate and store cryptographic keys. Encrypt data using AES with proper cipher modes (like AES/GCM/NoPadding). Avoid storing keys or encrypted data in insecure locations.
• iOS: Use Keychain Services to store sensitive data securely. Leverage NSData encryption APIs with secure storage flags like kSecAttrAccessibleWhenUnlocked to protect data when the device is locked.
Several tools are available to help identify insecure storage practices:
• MobSF (Mobile Security Framework): Offers both static and dynamic analysis to detect insecure data storage.
• QARK: Helps identify potential vulnerabilities in Android apps, including storage flaws.
• Drozer: A powerful security audit and exploitation framework for Android apps.
• Frida: A dynamic instrumentation toolkit that can be used to inspect runtime storage behaviors.
• AppScan and Checkmarx: Provide comprehensive security testing, including insecure storage detection.
Yes, in some cases. If the data is stored in publicly accessible directories (e.g., external storage), it can be read by other apps with proper permissions. Also, backup mechanisms or debugging interfaces might expose such data. Rooting a device increases the risk significantly by allowing access to protected directories and files.




