# Android WebViews in Twitter app are vulnerable to UXSS due to configuration and CVE-2020-6506

Twitter Android WebViews in Video Website Cards kept setSupportMultipleWindows false, letting cross-origin iframes window.open a javascript: URL and run JS in the top document.

- Payout: $560
- Severity: high
- Program: X / xAI
- Found by: alesandroortiz
- Disclosed: 2020-09-24
- CVE: CVE-2020-6506
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/906433
- Library page: https://bugbountylibrary.com/r/h1%3A906433
- Tags: area:mobile domain:browser domain:mobile impact:data-leak impact:integrity kind:bounty platform:hackerone sev:high tech:android technique:chained technique:source-review vuln:xss

**Target:** Android WebView rendering Video Website Card landing URLs
**Root cause:** WebView with setSupportMultipleWindows() default/false treats window.open() with a javascript: URL like an https:// navigation, navigating the top-level document to the javascript: URL and executing it in the top origin.
**Steps:**
1. Use unpatched Android WebView (<83.0.4103.106) and Twitter 8.50.0.
2. Create a Video Website Card whose landing URL hosts a cross-origin iframe PoC.
3. Iframe calls `window.open()` with a javascript: URL or uses a link with `target="_blank"` and `href="javascript:..."`.
4. Obtain one user activation: tap the visible iframe, or steal keyboard focus with a hidden iframe while user types in the parent page.
5. Observe attacker JS executing in the top-level document (payload writes a `<p>` then `alert(document.domain)`).
**How found:** Discovered while pentesting over a dozen Android browsers; determined the cause was Android WebView behavior with setSupportMultipleWindows false, then checked which apps (Twitter Video Website Cards) used that configuration.
**Exploitation:** Attacker shares a Video Website Card (organic tweet or paid campaign) pointing to a page containing a malicious/compromised cross-origin iframe. On tap or keypress the iframe opens a javascript: URL, which WebView navigates the top document to, executing attacker JS in the card's origin to exfiltrate page data or spoof content.
**Escalation:** Hidden iframe steals keyboard focus from the parent page to gain activation without direct iframe interaction; nesting depth does not matter. In rare file:// + setJavaScriptCanOpenWindowsAutomatically + setAllowUniversalAccessFromFileURLs configs, drive-by with no interaction.
**Insight:** When auditing Android apps, check whether WebViews keep setSupportMultipleWindows at default/false while rendering third-party or ad content; a cross-origin iframe can then escalate window.open('javascript:') into top-level UXSS, and hidden iframes can steal keyboard focus to satisfy the activation requirement.

## Proof of concept (copied exactly from the original report)

**PoC payload writing to top-level document**

```
javascript:var elem = document.createElement("p"); elem.innerHTML = "<b>Executed JS in parent origin: "+window.location.origin+"</b>"; document.body.append(elem); alert(document.domain)
```

**Vulnerable WebView configuration sample code**

```
class VulnerableActivity : AppCompatActivity() {
 override fun onCreate(savedInstanceState: Bundle?) {
 // ...other setup code...
 
 // Get WebView from layout
 val myWebView: WebView = findViewById(R.id.webview)
 // Enable JavaScript (only configuration required)
 myWebView.settings.javaScriptEnabled = true
 // Load parent page
 myWebView.loadUrl("https://PARENT_ORIGIN/parent.html")
```

**PoC URLs for testing WebViews**

```
PoC 1: https://alesandroortiz.com/security/chromiumwebview/cve-2020-6506.html
- PoC 2: https://alesandroortiz.com/security/chromiumwebview/cve-2020-6506-keypress.html
```

