Skip to content
Mobile Write-up Intermediate

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.

BaymaxPop23 Follow

Published on medium.com

How a malicious deep link can exfiltrate session cookies and compromise user accounts with a single click

Source_To_Sink, on medium.com

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

  1. Host a malicious HTML page on an S3 bucket (a trusted wildcard domain).
  2. Craft a deep link that opens the malicious page in the app's WebView.
  3. Victim clicks the link, the app validates the URL as trusted, and loads the page with the JavaScript bridge enabled.
  4. The malicious JavaScript calls the bridge's uploadFile method with the path to the cookie database and an attacker-controlled upload URL.
  5. The app uploads the cookie file to the attacker's server.
  6. 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.

More by BaymaxPop23

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Mobile app vulnerabilities

The lesson behind this report.

Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.