Embedded Mini-App Secret Exposure

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

embedded_miniapp_secret_exposure   MEDIUM

CategoryNative / WebView Bridge (JS <-> Native)
OWASP Mobile (2024)M9
MASVSMASVS-STORAGE-1MASVS-PLATFORM-2
MASWEMASWE-0001
MASTG (v2 tests)iOSNone publishedAndroidMASTG-TEST-0320
CWECWE-312CWE-522CWE-294
PlatformAndroidiOS

Description

An embedded web-app / Mini-App persists plaintext, replayable auth tokens (and recovery secrets such as wallet mnemonics) in WebView storage reachable over the JS<->native bridge with no origin isolation, so any embedded content or co-resident inspector reads and replays them (Telegram Mini App / TENET research class).

How it works

An embedded Mini-App persists plaintext, replayable auth tokens, and a recovery secret such as a wallet mnemonic, in WebView storage reachable over the JS<->native bridge with no origin isolation. So a co-resident inspector or injected script under another origin calls the bridge getter, reads the plaintext token and mnemonic, and replays the token (Telegram Mini App / TENET research class). This persists the token and mnemonic in real WebView storage and reads them back over a native JS bridge (the in-memory panel is the offline contrast). The secure path never persists the raw token or mnemonic in WebView-reachable storage: it mints a short-lived, origin-bound, single-use handle, so a replay from another origin (or a second time) fails and the mnemonic is never reachable over the bridge.

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, sqlite3 · Android: jadx, adb · iOS: ipsw, ifuse.
  2. Locate the target. From the home index, open Embedded Mini-App Secret Exposure (embedded_miniapp_secret_exposure). 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-0320 for the canonical procedure and remediation.

Tools (optional)

Android

iOS

Real-world references

Concrete public disclosures that match this vulnerability class: