Custom Keyboard / IME Input Interception
← Privileged System-Provider Activation
custom_keyboard_input_interception MEDIUM
| Category | Privileged System-Provider Activation |
| OWASP Mobile (2024) | M4 |
| MASVS | MASVS-PLATFORM-1MASVS-PRIVACY-1 |
| MASWE | MASWE-0040 |
| MASTG (v2 tests) | iOSMASTG-TEST-0390AndroidNone published |
| CWE | CWE-200CWE-359CWE-522 |
| Platform | Android |
Description
A custom keyboard / InputMethodService (or iOS keyboard extension) captures sensitive input typed in OTHER apps - passwords, OTPs, financial data, passkey/AI prompts - and exfiltrates it or logs it because the extension has network access / lacks isolation, so the IME provider surface becomes a system-wide keylogger (Apple keyboard-extension / Android IME provider-privilege class).
How it works
A custom keyboard / InputMethodService (or iOS keyboard extension) sees every keystroke the user types across other apps, including passwords and OTPs in secure fields. Granted “Allow Full Access” (network egress) and running without isolation, it logs and exfiltrates that input to an attacker sink. This is an offline, deterministic simulation; the endpoint is never actually contacted. The secure path refuses to log or transmit for secure fields and runs with no network access. DVMA declares a real, user-enablable custom keyboard (DvmaKeyboardService); the “real state” panel reports whether it is enabled via Settings.Secure. To fully arm it, enable “DVMA Training Keyboard” under Settings > Languages & input > On-screen keyboards and select it; it then sees keystrokes typed in other apps (watch logcat DVMA-EVIDENCE).
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
- Set up. Build DVMA with a flavor that enables the Privileged System-Provider Activation category (e.g.
--dart-define-from-file=config/flavors/dev.json) and run on an Android emulator you control. The demo needs no external tooling; for the optional on-device reproduction the relevant tools are:adb,frida,mitmproxy,jadx. - Locate the target. From the home index, open Custom Keyboard / IME Input Interception (
custom_keyboard_input_interception). The How it works section above describes this module’s specific weakness; the screen states the intended-secure behavior and exposes the vulnerable action. - Exploit. Drive the provider-activation / enablement workflow (accessibility, notification-listener, VPN, IME, phone-account, MediaProjection, credential-provider) and confirm the granted capability is invoked on an untrusted caller’s behalf - the enablement flow is the boundary.
- 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).
- 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.
- Map it back. Cross-reference the MASTG v2 test(s) MASTG-TEST-0390 for the canonical procedure and remediation.
Tools (optional)
Real-world references
Concrete public disclosures that match this vulnerability class: