The Bouncer Who Never Read the Envelope
The HTML sanitizer in a dashboard SaaS allowed anchor tags with javascript: or data: URL schemes in href attributes, and the app lacked a Content-Security-Policy. An attacker with a data-write-only push key could inject stored XSS that, when a viewer clicked anywhere on the dashboard, ran script in the app origin and could create an admin member on the organization.
Published on medium.com
I have a soft spot for a sanitizer that takes its job seriously, and the one in this story takes its job very seriously. It is the most conscientious bouncer in town.
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
The sanitizer enforced tag and attribute allow-lists and well-formed XHTML but did not validate the URL scheme in href or src attributes, and the application had no Content-Security-Policy.
Impact
An attacker with a leaked data-write-only push key could achieve stored XSS that, when a viewer with invite privileges clicked anywhere on the dashboard, could create an admin member on the organization; a lower-privilege viewer's click still executed script in their session but could not mint an admin.
What the attacker needed
A data-write-only push key; victim views the dashboard; victim clicks anywhere on the page; viewer holds invite privileges for admin takeover
The fix
The sanitizer should validate URL schemes after normalising case, trimming whitespace, and decoding entities, and the application should add a Content-Security-Policy; the text does not state that a fix has landed.
How it was found
- Obtain a data-write-only push key for the Text widget.
- Post widget content containing an anchor with a javascript: href to the push endpoint server-to-server.
- The dashboard renders the stored content through dangerouslySetInnerHTML.
- Style the anchor as a full-viewport overlay so the viewer's next click anywhere triggers it.
- The script runs in the app origin with the viewer's session and queries the GraphQL endpoint.
- The script calls the user-management mutation to create a pending ADMIN member, which the attacker accepts from their own inbox.
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 sanitizer is a filter that tries to remove dangerous HTML before it is shown on a page. This one checked which tags and attributes were allowed but never checked the address inside a link, so a link could contain JavaScript instead of a normal web address. Because the site also had no Content-Security-Policy (a browser rule that limits what scripts can run), that JavaScript could act as the logged-in viewer and change account settings.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.