How a Forgotten data-cfg Attribute Let Me Steal a Reviewer Bot's
A note-taking app's renderer evaluated a user-controlled data-cfg attribute as JavaScript, enabling stored XSS. The report endpoint's URL validation used a prefix check on un-normalised input, so a crafted path traversal URL made the reviewer bot visit a privileged page where the stored payload executed and its session cookies were exfiltrated.
Published on medium.com
It was late. My terminal had four tabs open Caido, the target, a notes file full of dead ends, and webhook.site refreshing on its own.
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 two mistakes combined: the renderer passed an attacker-controlled data-cfg attribute to a JavaScript evaluator, and the report endpoint validated the URL with a prefix check on un-normalised input that the browser later normalised.
Impact
The attacker could steal the reviewer bot's session cookies, including a flag and a profile token that could be replayed to act as the bot.
What the attacker needed
Ability to create and publish notes; ability to submit reports; proxy tool to modify requests; attacker-controlled webhook
The fix
The text recommends parsing data-cfg as JSON instead of JavaScript, normalising and exactly matching the report URL server-side, setting HttpOnly on session cookies, and shipping a CSP without unsafe-eval; it does not state that a fix was deployed.
How it was found
- Create and publish a note containing an enabling element and a data-enhance element whose data-cfg holds the payload.
- Intercept outgoing requests with a proxy tool.
- Submit a report for the note with any reason.
- Replace the url field in the report request with a path traversal URL that starts with the note prefix.
- Forward the request so the bot's browser normalises the path and lands on the account preferences page.
- Observe the exfiltrated cookies arriving at the attacker's webhook.
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 app let users write notes containing HTML, and a special attribute in that HTML was run as JavaScript code. Separately, the 'report' feature checked only that a submitted link started with a note path, so adding encoded dots and slashes made the bot's browser go to a different, logged-in page. When the bot opened the note there, the JavaScript ran and sent the bot's session cookies to the attacker.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.