Exploiting Insecure Android WebView with setAllowUniversalAccessF
An exported Android activity loaded a WebView with JavaScript enabled and universal file access allowed, and accepted an unvalidated URL extra. An attacker could launch the activity with a malicious local HTML file to read and exfiltrate sensitive files from the app's private storage.
Published on medium.com
Android applications often embed web content directly inside the app using WebView. While convenient, insecure configurations can completely bypass browser security controls and allow attackers to read and exfiltrate sensitive data from the application sandbox.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The exported activity accepted an unvalidated URL extra and loaded it into a WebView configured with JavaScript enabled and universal access from file URLs, allowing local file reads and exfiltration.
Impact
An attacker could read and exfiltrate sensitive files from the app's private storage, including shared preferences, by tricking a user into opening a crafted link or by having local access to the device.
What the attacker needed
Attacker can launch the exported activity; victim has the app installed; attacker can deliver a malicious HTML file or link
How it was found
- Inspect the app manifest and find an exported activity named RegistrationWebView.
- Decompile the app and see that the WebView enables JavaScript and allows universal access from file URLs, and loads the reg_url extra without validation.
- Launch the exported activity with a custom URL to prove the WebView loads attacker-controlled content.
- Launch the activity with a file:// URL pointing to a private app file to confirm local file read.
- Push a malicious HTML file to external storage and launch the activity to load it, causing the file contents to be sent to an attacker-controlled endpoint.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Android apps can show web pages inside a component called a WebView. If an app lets any other app open a screen that contains a WebView, and that WebView is allowed to run JavaScript and read local files, an attacker can make it load a malicious page that steals private files. This report shows exactly that: a screen anyone could open, which then loaded a file from the phone and sent its contents to an attacker's server.
What is Mobile?
Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.