Reflected XSS in OAuth Callback Endpoint
The OAuth callback endpoint reflected the error parameter into the page without encoding, allowing script execution. An attacker could craft a link that runs JavaScript in the site's context, potentially stealing cookies or tokens.
infosecwriteups.com
Published on infosecwriteups.com
Free Article Link: Click for free!
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application inserted the error parameter into the HTML without output encoding, and lacked a Content Security Policy and HttpOnly cookies.
Impact
If cookies are not HttpOnly, an attacker could steal session tokens and potentially take over accounts; the endpoint could also be used for phishing or OAuth flow manipulation.
What the attacker needed
Victim clicks a crafted link; cookies not HttpOnly; no CSP blocking inline scripts
The fix
The application should validate input, encode output, set HttpOnly and Secure cookies, and implement a restrictive Content Security Policy.
How it was found
- Open a browser with a clean session.
- Navigate to the OAuth callback URL with a crafted error parameter.
- Observe the alert showing cookies, confirming script execution.
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 write-up has not been written yet. The Original tab links to the source.
Reflected cross-site scripting (XSS) happens when a website takes something you type into a link and puts it directly on the page without cleaning it. If that input contains code, the browser runs it as if the website itself had written it. Here, the error message in an OAuth login callback was shown without cleaning, so a crafted link could run code in the victim's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.