Skip to content
XSS Write-up Intermediate

Vaulting over a .innerHTML sink in a Locked-Down CSP

A template name was reflected unsanitised into a delete confirmation modal via an innerHTML sink, and a strict CSP blocked inline scripts. The author bypassed the CSP by using an iframe srcdoc that loaded a whitelisted JSONP endpoint, achieving script execution and cookie theft.

medium.com

Published on medium.com

Hello, I’m Syed Mushfik Hasan Tahsin aka SMHTahsin33. A 20 Y/O Cyber Security Enthusiast from Bangladesh.

SMHTahsin33, 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 template name was inserted into the page using the innerHTML property without sanitisation, and the CSP allowed a JSONP endpoint on a whitelisted domain.

What the attacker needed

Ability to create a template; victim views the delete confirmation

How it was found

  1. Create a template with a name containing an XSS payload.
  2. Open the delete confirmation modal for that template to see the unsanitised reflection.
  3. Observe that the CSP blocks inline scripts and event handlers.
  4. Use an iframe with a srcdoc attribute containing a script tag that loads a whitelisted JSONP endpoint to execute JavaScript.

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 website let a user-supplied template name appear on a delete confirmation page without cleaning it. The site had a Content Security Policy (CSP), a browser rule that blocks most scripts, but the attacker found a way around it by loading a script from an allowed Google Maps address inside an iframe, a small embedded page. This let them run code in the victim's browser and read cookies.

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.