Skip to content
XSS Write-up Intermediate

Beyond GET: Unleashing POST‑Based XSS with a CSRF Twist

A login endpoint reflected the username parameter without sanitisation and lacked CSRF tokens, so an attacker could host an auto-submitting form that made a victim's browser send a POST request containing an XSS payload, which then executed in the victim's context.

medium.com

Published on medium.com

Cross‑site scripting (XSS) is traditionally a GET‑driven affair, threat actors craft malicious URLs, lure victims to click, and inject their payload straight into query parameters or stored payload on some pages. But what happens when we weaponise POST requests?

carson12345, 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 login endpoint reflected user input without sanitisation and did not require a CSRF token, allowing a cross-site form to submit the payload.

Impact

The XSS could allow session theft, UI redressing and user impersonation, potentially causing complete account compromise.

What the attacker needed

Victim visits attacker's page; victim is authenticated

The fix

The endpoint should sanitise all inputs and include CSRF protection even on login forms, and a Content Security Policy could help block inline scripts.

How it was found

  1. The attacker hosts a malicious HTML page containing a hidden form that auto-submits a POST request to the login endpoint with an XSS payload in the username field.
  2. A victim visits the attacker's page, and their browser automatically sends the POST request to the login endpoint.
  3. The login endpoint reflects the username parameter without sanitisation, returning the XSS payload in the response.
  4. The payload executes in the victim's browser context.

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) lets an attacker run their own JavaScript in someone else's browser. Normally this is done with a link, but here the vulnerable page only accepted form submissions (POST requests). Because the form had no CSRF token (a secret value that proves the request came from the real site), an attacker could make a victim's browser submit the form automatically, and the malicious script in the username field would run.

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.