Skip to content
XSS Write-up Beginner

Démonstration d’une attaque Reflected XS

A deliberately vulnerable training application reflects user input into its responses without sanitising it, so injected scripts run in the victim's browser. The author shows that a weak filter blocking only the lowercase script tag can be bypassed with different casing or an event-handler attribute, and that cookies can be read through the injected script.

medium.com

Published on medium.com

Le Reflected XSS (ou XSS réfléchi) est une vulnérabilité où un site web renvoie directement des données injectées par un utilisateur dans sa réponse, permettant l’exécution d’un script malveillant dans le navigateur de la victime.

Hassan Makawi, 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

Impact

An attacker could run script in a victim's browser and read their cookies, which may allow session theft if the site is poorly secured; the text only demonstrates this on a practice application.

What the attacker needed

A deliberately vulnerable practice app; victim views the crafted input

The fix

User input should be escaped and validated, and a content security policy should be applied to block malicious scripts.

How it was found

  1. Enter a script tag in the input field on the low-security level and observe the alert box.
  2. Change the script so it displays the document cookie instead of a fixed message.
  3. On the medium level, submit a lowercase script tag and see that it is blocked.
  4. Bypass the filter by changing the case of the tag or by using an image element with an error handler.
  5. On the high level, try a link with a click handler, a cookie-reading link, and an input element that fires on focus.

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 reflected cross-site scripting flaw means a website takes text you type or put in a link and places it straight into the page it sends back. If that text is a small program (a script), the browser runs it as if the site itself had written it. The author tests this on a practice site with several difficulty levels and shows that blocking one exact word is not enough, because the browser accepts many variations.

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.