Skip to content
XSS Write-up Intermediate

From IDOR to Stored XSS to Account Takeover — Chaining Bugs Like a Pro

An unauthenticated admin endpoint allowed editing product descriptions, and the oldimage parameter was reflected unsanitised into an img tag, enabling stored XSS. The session cookie lacked HttpOnly, so the XSS could steal it and take over accounts.

Waleed Osama Follow

Published on waleedosamaeg.medium.com

So I was casually poking around a website for a game (you know, just your average day of legally breaking stuff), when suddenly… things got interesting.

Waleed Osama, on waleedosamaeg.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 steal session cookies from users visiting the store page and take over their accounts.

What the attacker needed

No authentication needed; victim visits the store page

The fix

The report does not state a fix, but the endpoint should require authentication and the oldimage parameter should be properly encoded, and the session cookie should be set HttpOnly.

How it was found

  1. Fuzz the website to find the /admin/ directory.
  2. Crawl the admin page to discover backend.js, which lists API endpoints.
  3. Identify ajaxEditStore.php as an endpoint that does not require login.
  4. Send a POST request to ajaxEditStore.php with parameters including product_id and product_desc to edit a product.
  5. Set the oldimage parameter to a crafted value that breaks out of the img src attribute and injects an SVG with an onload handler.
  6. Refresh the store page to trigger the XSS and steal the zeus cookie.

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.

The website had a hidden admin page that anyone could use without logging in. One of its features let you change product details, and a field meant for an image name was inserted into the page without cleaning, so a script could run. Because the login cookie could be read by JavaScript, that script could steal it and log in as other users.

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 Waleed Osama

View all

4 more disclosed reports, 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.