medium · M4 · MASVS-PLATFORM-2 · PTKD-WEBVIEW-FILEACCESS
WebView allows file access from web content
setAllowUniversalAccessFromFileURLs / setAllowFileAccessFromFileURLs (Android) or the allowFileAccessFromFileURLs / allowUniversalAccessFromFileURLs preference keys (WKWebView) let a page loaded from a file:// URL read other local files and, with universal access, send them anywhere.
How it is exploited
setAllowFileAccessFromFileURLs lets a file:// page read other local files via XHR. One injected HTML file (downloads, cache) can exfiltrate cookies databases and private files through the WebView.
Why it matters
Local-file boundary inside the app breaks; web content reads app-private storage.
How to fix it
- Set setAllowFileAccessFromFileURLs(false) and setAllowUniversalAccessFromFileURLs(false) (default on modern APIs; check legacy code).
- Serve packaged content via WebViewAssetLoader over https:// app assets instead of file:// URLs.
Does your app have this?
PTKD checks your build or your source project for PTKD-WEBVIEW-FILEACCESS and every other check in this knowledge base.
Scan your appReferences
Related checks (M4)
- Supabase function runs any SQL the caller sends
- Deep link URL loaded or opened without a host check (heuristic)
- Hybrid WebView may open any website inside the app
- Wildcard associated domain (universal-link hijack surface)
- Process execution via system()/exec/popen
- Unsafe C string function (buffer overflow risk)
- Hijackable custom URL-scheme deep link
- SQL built by joining request data into a string (text search)