WebView Untrusted URL -> Local File Read (iOS WKWebView)
wkwebview_untrusted_url_local_file HARD
| Category | Improper Platform Usage |
| OWASP Mobile (2024) | M4 |
| MASVS | MASVS-PLATFORM-2MASVS-STORAGE-2 |
| MASWE | MASWE-0034MASWE-0035 |
| MASTG (v2 tests) | iOSMASTG-TEST-0333MASTG-TEST-0332AndroidNone |
| MASTG demos | iOSMASTG-DEMO-0096AndroidNone |
| CWE | CWE-79CWE-73CWE-200 |
| Platform | iOS |
Description
Unsanitized user-controlled fields are reflected into a WebView, and file access is left enabled, so injected JS can read the app’s local files from the WebView context (ZOLL ePCR iOS CVE-2025-12699 class).
How it works
An unsanitized user-controlled field is reflected into HTML rendered in a WKWebView that was created with local file access enabled and a file:// origin. Injected JavaScript therefore runs and can fetch() the app’s own local files (session tokens, patient records) and exfiltrate them (ZOLL ePCR iOS CVE-2025-12699 class). On a real device this runs a genuine WebView that actually reads the seeded local file: on iOS a real WKWebView backed by a custom WKURLSchemeHandler that serves the page and the secret under one origin, and on Android a System WebView with file access enabled reading over a file:// origin; off-device it falls back to a deterministic model. The secure path HTML-escapes the reflected field and disables local file access, so the payload is inert and no files are reachable.
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 Improper Platform Usage category (e.g.
--dart-define-from-file=config/flavors/dev.json) and run on an iOS simulator / a device you control. The demo needs no external tooling; for the optional on-device reproduction the relevant tools are:objection,frida,r2frida,ipsw,class-dump,Hopper,r2ghidra,Ghidra. - Locate the target. From the home index, open WebView Untrusted URL -> Local File Read (iOS WKWebView) (
wkwebview_untrusted_url_local_file). 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. From an attacker context (a crafted custom-URL-scheme / Universal Link, a malicious document provider / share extension, or a Shortcut), send the untrusted input to the handler and confirm the app performs the unsafe action (navigation, file/URL access, privileged operation) with no validation.
- 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-0333, MASTG-TEST-0332 for the canonical procedure and remediation.
Tools (optional)
Real-world references
Concrete public disclosures that match this vulnerability class: