# Stealing SSO Login Tokens (snappublisher.snapchat.com)

Chained CSRF login, open referrer with hash-fragment passthrough, non-expiring SSO ticket, and SVG XSS on GCS to steal Snapchat SSO tickets and take over accounts.

- Payout: $7,500
- Severity: high
- Program: Snapchat
- Found by: coolboss
- Disclosed: 2021-07-29
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/265943
- Library page: https://bugbountylibrary.com/r/h1%3A265943
- Tags: area:web domain:web impact:ato kind:bounty platform:hackerone sev:high tech:gcp tech:sso technique:chained technique:incomplete-fix vuln:account-takeover vuln:auth-bypass vuln:csrf vuln:xss

**Target:** snappublisher.snapchat.com SSO flow and media upload (SVG on Google Cloud Storage)
**Root cause:** SSO `referrer` param accepts any snappublisher URL including `#hashfragment`, tickets are reusable, SSO lacks CSRF state, and SVG uploads execute JS on storage.googleapis.com.
**Steps:**
1. Upload malicious SVG via `https://snappublisher.snapchat.com/snaps/create/new` import-from-site; served at `https://snappublisher.snapchat.com/api/v1/media/<id>/file/x.svg`
2. CSRF-login victim into attacker's snappublisher account via SSO without state param
3. Redirect victim to `https://accounts.snapchat.com/accounts/sso?client_id=creativesuite-prod&referrer=https://snappublisher.snapchat.com/api/v1/media/<id>/file/x.svg?%23pranav`
4. accounts.snapchat.com 302s to the SVG URL with `ticket` in `#hashfragment`; browser carries fragment across 307 redirect to `storage.googleapis.com/creativesuite-prod-media/*`
5. SVG JS reads `location.hash`, exfiltrates ticket
6. Attacker replays ticket at `https://snappublisher.snapchat.com/sso_continue?ticket=<stolen>` to log into victim account
**How found:** Noticed SSO ticket flows via `referrer` param, tested that `#hashfragment` is accepted and survives 302/307 redirects, then found SVG upload executes JS on GCS to read the fragment.
**Exploitation:** Victim logged into accounts.snapchat.com visits attacker page; CSRF logs them into attacker's snappublisher account, then SSO redirect leaks reusable ticket via hash fragment to attacker-controlled SVG which exfiltrates it; attacker replays ticket for account takeover and API access.
**Escalation:** Chained four low-severity flaws (CSRF login, open referrer, hash passthrough, non-expiring ticket) plus SVG XSS to convert into full ATO.
**Insight:** When an SSO `referrer`/redirect param allows fragments, the token lands in `location.hash` on the destination origin — look for any user-content origin (GCS/S3 bucket, SVG upload) on that domain to read it; also test ticket reuse and missing state.

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

**SSO URL leaking ticket in hash fragment**

```
https://accounts.snapchat.com/accounts/sso?client_id=creativesuite-prod&referrer=https://snappublisher.snapchat.com/api/v1/media/████████/file/somthine.svg?%23pranav
```

**Login using stolen ticket**

```
https://snappublisher.snapchat.com/sso_continue?ticket=<stolen token>
```

