Skip to content
XSS Write-up Beginner

Fastest Fix on Open Bug Bounty Platform

The login form reflected the submitted username value back into the page without encoding it, and it had no anti-CSRF token. An attacker could craft a page that auto-submits a POST to the login form and runs arbitrary JavaScript in the victim's browser on the site's domain.

Wen Bin KONG Follow

Published on kongwenbin.com

This is a write-up on the Fastest Fix on Open Bug Bounty (OBB) Platform. The security team was extremely prompt in responding and fixing the bug.

kongwenbin, on kongwenbin.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 username parameter was inserted into the HTML form without output encoding, and the form had no anti-CSRF token, so a cross-site POST could inject markup that executes script.

Impact

An attacker could force a visiting user to run arbitrary JavaScript in the context of the login site's domain, though the report does not demonstrate theft of data or account takeover.

What the attacker needed

Victim visits attacker's page; no login needed

The fix

The report says the organisation fixed and deployed the issue and a regression test confirmed it, but it does not describe the code change; properly, the username should be HTML-encoded on output and the form protected with an anti-CSRF token.

How it was found

  1. Craft an HTTP POST to the login endpoint with a malicious value in the username field.
  2. Observe that the value is rendered unencoded inside the HTML form.
  3. Build an HTML page that auto-submits the same POST when a user visits it.
  4. Confirm the injected SVG onload handler executes JavaScript in the browser.

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 login page took whatever text was typed into the username box and put it straight back into the page's HTML. Because special characters were not neutralised, an attacker could make the page run their own JavaScript, a scripting language browsers execute. The form also lacked a secret token that proves a request came from the site itself, so another website could silently submit the form for a visitor.

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.