Skip to content
XSS Write-up Intermediate

Advanced Javascript injections : Amazon XSS to full account takeover

A URL parameter on the seller signup page was reflected unescaped inside a script tag, allowing an attacker to break out of the string with a single quote and run JavaScript. Because session cookies for amazon.fr lacked the HttpOnly flag, an attacker could steal authentication cookies and take over any user's account who visited a crafted link.

medium.com

Published on medium.com

While doing some purchases on amazon.fr, i saw that it was possible to create a seller account on the domain sellercentral.amazon.fr.

Adolphoramirez, 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 a URL parameter into a JavaScript string inside a script tag without escaping single quotes or otherwise encoding the value for that context.

Impact

Any user who visits the crafted URL could have their session cookies stolen, leading to full account takeover, because the cookies were not protected by the HttpOnly flag.

What the attacker needed

Victim clicks a crafted link; attacker can host or share a URL

The fix

The vulnerability was fixed by Amazon within a week of being reported.

How it was found

  1. Open the seller signup page and note that the passthrough/account parameter is reflected inside a script tag.
  2. Try injecting HTML tags such as a closing script tag, but observe that angle brackets are HTML-encoded.
  3. Inject a single quote to break out of the JavaScript string, then use the minus operator to execute a JavaScript expression.
  4. Load the crafted URL and confirm that the JavaScript runs.

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 web page took a value from the address bar and pasted it straight into a piece of JavaScript code on the page without cleaning it. By adding a single quote character, the attacker could close the existing text and add their own JavaScript, which the victim's browser would then run. Since the site's login cookies could be read by JavaScript, the attacker could copy them and log in 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.

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.