How i found RXSS in href Attribute
A reflected cross-site scripting vulnerability was found in a URL parameter that was reflected into an href attribute without proper sanitisation. An attacker could craft a link that, when clicked by a victim, executes arbitrary JavaScript in the victim's browser.
Published on medium.com
First, I discovered a page with an input field. I attempted a simple XSS payload like this:
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 reflected user input into an href attribute without properly escaping double quotes, allowing an attacker to inject event handler attributes.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser when the victim clicks a crafted link, potentially stealing cookies or performing actions on behalf of the victim.
What the attacker needed
Victim clicks a crafted link
How it was found
- Discover a page with an input field that reflects input.
- Try a simple XSS payload and observe self-XSS.
- Type random words and notice no parameters in the URL.
- Type 'ls' and see navigation to a different page, indicating a URL parameter.
- Test '<test11>' and see angle brackets are not allowed.
- Use double quotes to break out and inject an onclick event handler, then click the button to execute XSS.
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 shows user input without cleaning it, so an attacker can sneak in JavaScript code. Here, the input ended up inside a link's href attribute, and by using a double quote the attacker could break out and add an onclick event that runs code when the link is clicked. This lets an attacker steal cookies or perform actions as the victim.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.