Skip to content
XSS Write-up Beginner

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.

mohaned0101 Follow

Published on medium.com

First, I discovered a page with an input field. I attempted a simple XSS payload like this:

mohaned haron, 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 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

  1. Discover a page with an input field that reflects input.
  2. Try a simple XSS payload and observe self-XSS.
  3. Type random words and notice no parameters in the URL.
  4. Type 'ls' and see navigation to a different page, indicating a URL parameter.
  5. Test '<test11>' and see angle brackets are not allowed.
  6. 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.

More by mohaned0101

View all

1 more disclosed report, best first.

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.