WebView Remote Debugging Enabled
← Native / WebView Bridge (JS <-> Native)
webview_remote_debugging_enabled MEDIUM
| Category | Native / WebView Bridge (JS <-> Native) |
| OWASP Mobile (2024) | M8 |
| MASVS | MASVS-RESILIENCE-1MASVS-PLATFORM-2 |
| MASWE | MASWE-0063 |
| MASTG (v2 tests) | iOSNoneAndroidMASTG-TEST-0227 |
| CWE | CWE-489CWE-215CWE-200 |
| Platform | Android |
Description
WebView.setWebContentsDebuggingEnabled(true) is left on in a production build, so anyone with adb / chrome://inspect access can attach DevTools to the WebView, inspect the DOM/JS, and execute script in the app’s web context - reading tokens, cookies, and authentication material. A production-configuration failure the release build should disable (Android WebView MASTG-TEST-0227 class).
How it works
The app leaves WebView.setWebContentsDebuggingEnabled(true) on in a release build. That exposes the WebView over the Chrome DevTools Protocol, so anyone with adb / chrome://inspect access attaches DevTools to the app web context, inspects the live DOM/JS, and evaluates script, reading the session cookie/token and auth material in the page (Android WebView MASTG-TEST-0227 class). This boots a real WebView with debugging enabled and reads the live JS context back; the in-memory panel is the offline contrast. The secure path forces debugging off in release builds so the inspector fails closed, while still allowing DevTools in debug builds for local development.
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 Native / WebView Bridge (JS <-> Native) 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,jadx,chrome://inspect. - Locate the target. From the home index, open WebView Remote Debugging Enabled (
webview_remote_debugging_enabled). 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. Reach the JS<->native bridge (or the framework/plugin API) from untrusted web content / a cross-origin iframe / a malicious provider, and confirm the privileged native call fires with no main-frame/origin, callback-id, or permission gate in between.
- 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-0227 for the canonical procedure and remediation.
Tools (optional)
Attack inputs
Payloads/artifacts you author for the on-device attack. The demo already ships and simulates these in-process (e.g. the malicious companion app / crafted intent is emulated inside the screen), so you only need to craft them to reproduce the exploit on a real device:
chrome://inspect session
Real-world references
Concrete public disclosures that match this vulnerability class: