TL;DR: Android apps still leak sensitive data through SharedPreferences, backups, SQLite, logs, caches, Realm, and Firebase when developers rely on default storage patterns, weak encryption, or poor key management, according to Appknox. The governance problem is not storage itself but unmanaged data placement and secret exposure across the mobile lifecycle.
At a glance
What this is: This is an Appknox analysis of insecure Android local storage and the main places where sensitive data leaks from apps.
Why it matters: It matters because mobile app teams often treat local storage as a code issue, while IAM and security programmes need it governed as a credential, data, and access-risk problem.
By the numbers:
- Only 20% have formal processes for offboarding and revoking API keys, and even fewer have procedures for rotating them.
- 96% of organisations store secrets outside of secrets managers in vulnerable locations including code, config files, and CI/CD tools.
- 79% of organisations have experienced secrets leaks, with 77% of these incidents resulting in tangible damage.
👉 Read Appknox's analysis of insecure Android local storage and app secrets exposure
Context
Android local storage becomes a security problem when applications place tokens, credentials, session data, or personal information on device without strong encryption and access control. The issue is not that storage exists, but that developers often assume the local filesystem, backup settings, logs, and embedded databases are low-risk by default.
For identity and access programmes, this is relevant because exposed mobile storage can turn an app into a credential distribution channel rather than a protected client. That creates downstream risk for account takeover, token replay, and data exposure, especially when secrets are written into locations that are easy to extract during reverse engineering or device compromise.
The article's starting position is typical rather than exceptional: most mobile security failures here come from routine implementation shortcuts, not obscure attack techniques. That makes the control gap operational, not theoretical.
Key questions
Q: What breaks when sensitive data is stored in Android local storage without encryption?
A: Plaintext local storage lets attackers recover tokens, credentials, cached data, and session state from the device, backups, logs, or databases. The failure is not limited to rooted phones. It also shows up when debug tooling, backup settings, or third-party SDKs expose app state outside the intended security boundary.
Q: Why do mobile apps create account takeover risk when they store secrets on device?
A: Because the secret becomes reusable outside the app. If an attacker extracts a token or key, they can often replay it without needing the original device or user session. That is why mobile storage must be governed as part of identity security, not just application hardening.
Q: How do security teams know whether Android storage controls are actually working?
A: They should test the full data path, not just the database layer. That means checking for backup extraction, log leakage, keyboard cache retention, unencrypted local files, and weak Firebase rules. If any one of those paths can reveal sensitive data, the control is incomplete.
Q: Who is accountable when a mobile app passes audit but still leaks sensitive data at runtime?
A: Accountability sits with the programme owners who accepted incomplete evidence. Security, engineering, and compliance teams should define who signs off on runtime proof, who owns remediation, and which control objective failed. In regulated environments, audit success without behavioural verification is not a durable assurance model.
Technical breakdown
SharedPreferences and plaintext credential storage
SharedPreferences is designed for lightweight key-value storage, but by default it persists data in readable XML. When teams place session tokens, API keys, or passwords there, they convert convenience into direct extractability. On a rooted device, through adb access, or via file inspection, the contents are often recoverable without advanced exploitation. The real issue is not the API itself but the assumption that local equals safe. Secure storage needs both encryption and a decision not to persist long-lived secrets when the app can avoid it.
Practical implication: move sensitive values out of SharedPreferences unless they are encrypted and strictly time-limited.
Backups, logs, and cache paths as leakage channels
Android backups, logcat output, and keyboard caches create alternative paths to the same data. If allowBackup remains enabled, an attacker with USB or device access can often recover app state without rooting the phone. Logs can also expose tokens, database queries, and internal paths, while keyboard caching can retain sensitive input longer than users expect. These are governance failures because they widen the data exposure surface beyond the intended app boundary. Secure mobile design has to treat backup and telemetry settings as part of the storage control plane.
Practical implication: audit backup flags, logging, and input handling as part of the mobile data protection baseline.
SQLite, Realm, and Firebase depend on encryption and key management
SQLite offers no native encryption, so any sensitive data stored there is exposed unless the application adds a protection layer such as SQLCipher or encrypted ORM handling. Realm can be secure, but only if encryption keys are generated and stored correctly. Firebase introduces a different risk pattern because misconfigured read or write rules can expose cloud-hosted app data at scale. In all three cases, the control failure is misplaced trust in the storage layer rather than in the surrounding identity and key management model.
Practical implication: pair every local or synced datastore with explicit encryption, key governance, and access-rule review.
Threat narrative
Attacker objective: The attacker wants reusable authentication material and sensitive app state that can be replayed for account access or exfiltrated at scale.
- Entry occurs when attackers obtain device-level access through rooting, malware, physical possession, or exposed backup and debugging channels.
- Credential access follows when tokens, passwords, or keys are recovered from plaintext local storage, logs, backups, or unprotected databases.
- Impact occurs when the extracted data is used for account takeover, fraud, or broader disclosure of user and organisational information.
Breaches seen in the wild
- Google Firebase misconfiguration breach — Firebase misconfigurations exposed 19.8M secrets across developer instances.
- MongoBleed breach — MongoBleed exposed secrets across 87K MongoDB servers.
Read our 52 NHI Breaches Analysis report for a comprehensive view of breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Local storage is now a credential governance problem, not just a mobile coding issue. When apps store tokens, session state, or API keys on device, they create a second identity plane outside central IAM controls. That plane is harder to inspect, harder to rotate, and easier to lose during app updates or device compromise. Practitioners should treat mobile storage as part of the identity lifecycle, not only as an application design concern.
Backup settings and logs create a hidden exposure window that many teams do not model. A secure database is not enough if the same data can reappear in ADB backups, diagnostic logs, or keyboard caches. This is where the named concept of mobile data spillover matters: sensitive data leaves the intended storage boundary through alternate system features. Practitioners should map those spill paths before they appear in incident response.
Encryption without key governance creates a false sense of control. SQLite, Realm, and local caches can all be protected poorly if keys are hardcoded, reused, or stored alongside the data they protect. That is a lifecycle failure, not a cryptographic one. The practical conclusion is that key management, storage policy, and runtime access all need the same governance attention.
Mobile app teams need to align storage controls with identity and data protection frameworks. NIST CSF, NIST SP 800-53, and OWASP MASVS-STORAGE all point toward controlled access, auditability, and integrity for sensitive data. In practice, the security boundary is the combination of storage, authentication material, and runtime exposure, not any one control in isolation.
From our research:
- Only 20% have formal processes for offboarding and revoking API keys, and even fewer have procedures for rotating them, according to the Ultimate Guide to NHIs.
- 79% of organisations have experienced secrets leaks, with 77% of these incidents resulting in tangible damage.
- Ultimate Guide to NHIs , Lifecycle Processes for Managing NHIs shows why lifecycle governance has to include revocation, rotation, and offboarding discipline.
What this signals
Mobile storage exposure behaves like a secret lifecycle failure. When a token or API key is written to device storage, the question is no longer only whether it is encrypted. The real issue is whether the secret can be discovered, copied, backed up, or replayed outside its intended runtime window. That is why lifecycle thinking from Ultimate Guide to NHIs , Lifecycle Processes for Managing NHIs applies even in mobile app programmes.
Teams should expect mobile security reviews to converge with identity, data protection, and mobile engineering governance. The strongest programmes will treat app storage, backup policy, and runtime logging as one control surface rather than separate checklists.
Mobile data spillover: this is the pattern where app data escapes through logs, caches, backups, or sync rules even when the primary store looks protected. Practitioners should test for spillover paths during build, release, and incident exercises, not after a leak appears.
For practitioners
- Eliminate long-lived secrets from mobile storage Refactor apps so tokens, API keys, and passwords are not persisted unless absolutely necessary, and replace them with short-lived, scoped credentials where feasible.
- Harden backup and debug pathways Disable Android backups for sensitive apps, strip verbose logs from production builds, and verify that no secrets appear in logcat, crash reports, or exportable diagnostic files.
- Encrypt every local datastore with managed keys Use EncryptedSharedPreferences, SQLCipher, or equivalent controls, and store encryption keys in Android Keystore rather than in app files or shared preferences.
- Review Firebase and sync rules as access policy Treat Firebase read and write rules like identity policy, test them under misconfiguration scenarios, and confirm that reverse-engineered project identifiers do not expose data.
- Map mobile storage to IAM and data protection reviews Include device-side storage locations in access review, data classification, and incident response playbooks so mobile leakage is visible to both app and security teams.
Key takeaways
- Android local storage is a common path for secret exposure because developers often underestimate how easily device data can be extracted.
- The article shows that backups, logs, caches, and misconfigured databases can all leak sensitive information even when the app appears functionally secure.
- Security teams should govern mobile storage as part of identity, key management, and data protection rather than as a narrow code-quality issue.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-03 | Secret exposure and weak rotation map directly to local storage risks. |
| MITRE ATT&CK | TA0006 , Credential Access; TA0010 , Exfiltration | The article describes theft of credentials and data from devices and app storage. |
| NIST CSF 2.0 | PR.AC-4 | Access control must extend to app-held secrets and local data exposure paths. |
| NIST SP 800-53 Rev 5 | IA-5 | Key and authenticator management is central to protecting stored tokens and credentials. |
| CIS Controls v8 | CIS-3 , Data Protection | The article centers on preventing sensitive data exposure in app storage and logs. |
Treat local storage leakage as credential access and exfiltration risk in detection and response planning.
Key terms
- Insecure Local Storage: Insecure local storage is the practice of saving sensitive app data on a device without adequate protection. It becomes risky when tokens, credentials, or personal data are left in readable files, unencrypted databases, logs, caches, or backup paths that attackers can extract.
- Android Keystore: Android Keystore is the platform service that stores and uses cryptographic keys in a protected environment instead of exposing them directly to application memory. It helps reduce key extraction risk, but its security depends on device capability, key configuration, and whether the app verifies the backing state.
- EncryptedSharedPreferences: EncryptedSharedPreferences is an AndroidX storage option that encrypts key-value data before it is written to disk. It is useful for reducing plaintext exposure in lightweight app settings, but it should still be paired with strong key management and a decision not to store long-lived secrets unnecessarily.
- Firebase Security Rules: Firebase Security Rules define who can read and write to Firebase data resources. They act as an access policy layer, so misconfiguration can expose application data even when the app itself appears secure. They should be treated as part of the application's identity and authorisation model.
What's in the full article
Appknox's full blog post covers the operational detail this post intentionally leaves for the source:
- Step-by-step mitigation guidance for SharedPreferences, SQLite, Realm, backups, and logging controls
- Specific secure coding patterns for EncryptedSharedPreferences, SQLCipher, Android Keystore, and Firebase rules
- Practical examples of how sensitive values leak through adb, reverse engineering, and debug builds
- Developer-focused implementation advice for hardening mobile apps without breaking release workflows
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, and secrets management. It helps practitioners connect lifecycle controls to the broader security programme they are responsible for.
Published by the NHIMG editorial team on August 20, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org