Skip to content
XSS Write-up Intermediate

$200 Smart XSS

An input field hidden inside a div element allowed an attacker to inject a pattern attribute with an oninvalid event handler, which executed JavaScript when the form was submitted. This could let an attacker steal session cookies or perform actions on behalf of users.

medium.com

Published on medium.com

🚀Free Link: Click Here

Abhijeet kumawat, on medium.com

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 HTML attribute without proper encoding, allowing an attacker to inject an event handler.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially stealing cookies or performing actions on their behalf.

What the attacker needed

Victim visits a page with the injected payload

The fix

The application should properly encode user input and validate on both client and server sides.

How it was found

  1. Identify an input field hidden inside a div element.
  2. Try autofocus with onfocus, but it fails because the field is hidden.
  3. Use the pattern attribute with oninvalid to trigger JavaScript when the form is submitted.
  4. Submit the form and observe the alert.

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 an attacker sneaks JavaScript code into a website so it runs in other people's browsers. Here, the input field was hidden, so common tricks like autofocus didn't work, but the attacker used a form validation attribute to trigger the code when the form was submitted.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.