JS Bridge Exposes a Privileged Native API

← Native / WebView Bridge (JS <-> Native)

js_bridge_exposes_privileged_api   HARD

CategoryNative / WebView Bridge (JS <-> Native)
OWASP Mobile (2024)M4
MASVSMASVS-PLATFORM-2MASVS-AUTH-1
MASWEMASWE-0033
MASTG (v2 tests)iOSNone publishedAndroidMASTG-TEST-0334
MASTG demosiOSNone publishedAndroidMASTG-DEMO-0097
CWECWE-749CWE-862CWE-926
PlatformAndroidiOS

Description

A bridge method exposes a privileged native capability (auth-token read, Keychain/Keystore, filesystem, camera/location) to any web content with no origin allowlist or permission gate, so a loaded page calls it directly.

How it works

A WebView native bridge exposes a privileged capability, reading the auth token from the Keychain/Keystore, as a plain bridge method callable by any loaded web content. There is no origin allowlist and no capability/permission gate, so an untrusted ad origin simply calls getAuthToken() and gets the token (Home Assistant Companion CVE-2026-44698 class). On a real device this runs a real WebView whose ungated privileged channel reads the token from a genuine app-private file and hands it to the untrusted page; the deterministic offline model backs the contrast panels. The secure path gates every privileged method behind an origin allowlist and a per-origin capability check, so the untrusted origin is denied before the native capability runs.

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 Native / WebView Bridge (JS <-> Native) 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: r2frida, frida, objection, mitmproxy · Android: jadx, apktool · iOS: ipsw, class-dump, Hopper.
  2. Locate the target. From the home index, open JS Bridge Exposes a Privileged Native API (js_bridge_exposes_privileged_api). 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. 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.
  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-0334 for the canonical procedure and remediation.

Tools (optional)

Android

iOS

Real-world references

Concrete public disclosures that match this vulnerability class: