XSS in Registration Form: A Bug Bounty Success
A registration form reflected user input into an HTML attribute without proper sanitisation, so a crafted first name could break out of the value attribute and add an event handler. An attacker could get script to run in a victim's browser, for example to read cookies, if the victim submitted or viewed the crafted input.
In this article, I’ll walk you through the process we followed to discover, exploit, and validate this vulnerability, as well as the key takeaways for improving web application security.
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 first_name value into an HTML attribute without encoding quotes or angle brackets, so user input could close the attribute and add new event-handler attributes.
Impact
Script could run in a user's browser, which the author says could steal session cookies or perform actions on the user's behalf; a firewall blocked the first attempt but was bypassed.
What the attacker needed
Victim views or submits crafted input; firewall bypass needed
How it was found
- Open the registration form and look at the input fields.
- Try injecting JavaScript event handlers such as onerror or onmouseover into the first_name field.
- Observe that the input is reflected inside the input tag's value attribute.
- Notice the firewall blocks the first attempt.
- Insert dummy characters inside the event handler name so the filter removes them and rebuilds the word.
- Send the request again and the script fires.
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.
A web page sometimes puts what you typed straight back into the page's HTML. If it does that without cleaning the text, someone can type HTML code instead of a normal name, and the browser treats it as part of the page. That lets the attacker's code run in the browser of anyone who sees it, which is called cross-site scripting.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.