Skip to content
XSS Write-up Intermediate

Stored XSS in the administrator’s panel due to misuse of MarkupSafe

A stored cross-site scripting flaw existed in the administrator panel because user-controlled offerer names were inserted into HTML using f-strings before MarkupSafe escaping, so the escaping never applied. An attacker with a professional account could create a malicious offerer name that, when an administrator viewed the fraud-validation page, ran script in the admin's session and could read or modify user data.

Aethlios Follow

Published on aeth.cc

Disclaimer : this exploitation was realized in a legal context of a Bug Bounty. The disclosure of the information contained in this article was made with the agreement of pass Culture and comes after a patch.

Aethlios (@AethliosIK), on aeth.cc

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 code used Python f-strings to build the HTML string before passing it to Markup, so MarkupSafe never escaped the user-supplied offerer name.

Impact

An attacker with a professional account could make an administrator's browser run script, potentially leaking all user data and allowing modification or suspension of users and offers; in the pre-production test the payload triggered but failed to exfiltrate data because of a browser-related mistake.

What the attacker needed

A professional account; ability to create an offerer and offer; admin views the validation page

How it was found

  1. Deploy the application locally using docker-compose.
  2. Create a professional account and a store whose name contains a script payload.
  3. Create an offer with that store and mark it as pending manual validation in the local database.
  4. Open the administrator's manual validation page to trigger the stored script.
  5. Host a JavaScript payload that fetches admin pages and sends the results to an attacker server.
  6. In pre-production, create a suspicious offer and ask the team to accept it so the payload triggers.

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 admin panel built HTML links by pasting a shop's name directly into the page. The developer thought a safety library was cleaning the name, but it was used in a way that skipped the cleaning. So a shop owner could put code in their shop name, and when an administrator looked at the page, that code ran in the administrator's browser.

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 Aethlios

View all

3 more disclosed reports, best first.

More from pass Culture

View all

The newest disclosed reports for this program.

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.