Android WebView Exploitation: From Deep Link to Account Takeover
An Android app's WebView trusted any URL on wildcard cloud domains like *.s3.amazonaws.com, exposed a JavaScript bridge with file upload/read methods to all loaded pages, and had a deep link handler that opened URLs in the WebView. An attacker could host a malicious page on an S3 bucket, trick a victim into clicking a deep link, and use the bridge to exfiltrate the app's cookie database, leading to account takeover.
Published on medium.com
How a malicious deep link can exfiltrate session cookies and compromise user accounts with a single click
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
Likely the app trusted wildcard cloud storage domains, exposed a JavaScript bridge with file operations to all WebView content, and allowed deep links to load attacker-controlled pages without proper validation.
Impact
An attacker could steal session cookies and refresh tokens, leading to complete account takeover and persistent access, with one click and no visible indication.
What the attacker needed
Victim clicks a link; attacker can host on a trusted domain; app has exposed JavaScript bridge
The fix
The app should use exact domain matching for URL validation, restrict the JavaScript bridge to first-party content, validate file paths, and disable file access in WebView settings.
How it was found
- Host a malicious HTML page on an S3 bucket (a trusted wildcard domain).
- Craft a deep link that opens the malicious page in the app's WebView.
- Victim clicks the link, the app validates the URL as trusted, and loads the page with the JavaScript bridge enabled.
- The malicious JavaScript calls the bridge's uploadFile method with the path to the cookie database and an attacker-controlled upload URL.
- The app uploads the cookie file to the attacker's server.
- The attacker imports the stolen cookies into their browser to access the victim's account.
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.
A WebView is a mini-browser inside a mobile app. This app let any page from certain cloud storage services run code that could ask the app to upload files from its private storage. By getting a user to tap a link, an attacker could steal the app's login cookies and take over the account.
What is Mobile?
Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.