Keyboard Cache & Autofill Leakage

← Insecure Data Storage

keyboard_cache_autofill_leakage   MEDIUM

CategoryInsecure Data Storage
OWASP Mobile (2024)M9
MASVSMASVS-STORAGE-2
MASWEMASWE-0036
MASTG (v2 tests)iOSMASTG-TEST-0313MASTG-TEST-0314AndroidMASTG-TEST-0258
MASTG demosiOSMASTG-DEMO-0076MASTG-DEMO-0077AndroidMASTG-DEMO-0064
CWECWE-524
PlatformAndroidiOS

Description

Sensitive text fields allow keyboard caching / autofill of secrets.

How it works

This secret field leaves autocorrect and suggestions ON and is not obscured, so what the user types is eligible to be learned by the keyboard (personal dictionary / next-word model, later autofilled in other apps) and, because the window is not FLAG_SECURE, captured into the recents thumbnail. The misconfigured field is the real artifact; the probe reports only the field’s actual configuration flags and the real window screenshot posture, not invented dictionary entries. A secure field would set obscureText:true, autocorrect:false, and enableSuggestions:false.

How to exercise it. DVMA is the harness - open this module from the home index and tap the demo action. The screen ships the malicious input and simulates the attacker (e.g. the companion app, crafted intent, or scanned payload) in-process, and the evidence panel prints the proof. The Tools (optional) and Attack inputs below are only needed to reproduce the exploit end-to-end on a real device.

Exploit steps

  1. Set up. Build DVMA with a flavor that enables the Insecure Data Storage category (e.g. --dart-define-from-file=config/flavors/dev.json) and run on an emulator/simulator you control. The demo needs no external tooling; for the optional on-device reproduction the relevant tools are: Android: adb, run-as, SharedPreferences/XML inspection · iOS: ifuse, afcclient, plutil, plist inspection.
  2. Locate the target. From the home index, open Keyboard Cache & Autofill Leakage (keyboard_cache_autofill_leakage). The How it works section above describes this module’s specific weakness; the screen states the intended-secure behavior and exposes the vulnerable action.
  3. Exploit. Exercise the flow that persists data, then inspect on-device storage (adb shell run-as <pkg> / pull the app sandbox, or objection’s android keystore/ios nsuserdefaults helpers) and confirm the sensitive value is present in cleartext or without hardware backing.
  4. Observe the evidence. Trigger the vulnerable action and read the evidence panel - it prints the concrete proof (leaked value, accepted replay, executed payload, or unauthorized result).
  5. Contrast with the secure path. Run the module’s secure/hardened action (where provided) and confirm the same attack is rejected - this is what a correct implementation should do.
  6. Map it back. Cross-reference the MASTG v2 test(s) MASTG-TEST-0258, MASTG-TEST-0313, MASTG-TEST-0314 for the canonical procedure and remediation.

Tools (optional)

Android

iOS