How a Simple Redirect Led to a $550 XSS Vulnerability
The login page's redirect_url parameter was not sanitised, allowing an attacker to inject a script that executed in the victim's browser. This could let an attacker steal session cookies and impersonate the victim.
medium.com
Published on medium.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 redirect_url parameter was reflected into the page without output encoding or validation.
Impact
An attacker could steal session cookies and impersonate the victim, redirect users to phishing sites, or modify the page, potentially leading to account takeover.
What the attacker needed
Victim clicks a crafted link
The fix
The application should escape or encode all user-supplied input before rendering it, and implement a Content Security Policy to restrict script execution.
How it was found
- Open a browser.
- Navigate to the login URL with a script in the redirect_url parameter.
- Observe the alert showing the document's cookies.
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.
Cross-site scripting (XSS) is when a website puts user-supplied text into a page without cleaning it, so a malicious script runs in another visitor's browser. Here, the login page took a redirect address from the URL and inserted it into the page unsafely, so a script hidden in that address ran. That script could read the victim's cookies, which are small pieces of data a site uses to remember who is logged in.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.