Skip to content
XSS Write-up Intermediate

how I found a tricky XSS

A language-selection feature stored the chosen value in a cookie, and the page copied that cookie value into the HTML lang attribute without sanitising it. An attacker could craft a link that set a malicious cookie value, so the injected markup ran as script when the victim opened the site.

Ziad Ali Follow

Published on medium.com

Hello everyone, this is my first write-up, and I hope you find it enjoyable. I would appreciate any feedback you have.

Ziad Shalaby, 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 on the site, though the write-up does not demonstrate any concrete harm beyond execution.

What the attacker needed

Victim opens an attacker-crafted link

How it was found

  1. Open the site and use the languages dropdown to select a language.
  2. Observe that a request sets a cookie named language to the chosen value.
  3. Notice the page reflects that cookie value into the HTML lang attribute.
  4. Craft a payload and send a link to the victim so the cookie is set and the payload runs when the page loads.

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 website lets you pick a language, and it remembers your choice in a small piece of data called a cookie that your browser sends back on later visits. The page then pasted that remembered value straight into its HTML without cleaning it, so a crafted value could contain code. Because the attacker controls the value through a link, the victim's browser runs the attacker's code on the site.

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 Ziad Ali

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.