<embed/object> frames bypass parent's CSP `sandbox` header directive
A Content-Security-Policy sandbox header applied to a parent page was not enforced for child frames loaded through embed and object elements. An attacker could get same-origin script to run inside those frames despite the sandbox restriction that should have blocked it.
Originally disclosed on Mozilla
- Fixed in 20 days
- Paid in 11 days
- Disclosed after 20 days
A given Content-Security-Policy: sandbox ...; HTTP header directive is not correctly enforced for <embed> and <object> child frames during load, allowing to bypass the set restrictions.
Test case
parent.html:
Content-Security-Policy: sandbox
<iframe src="child.html"></iframe>
<embed src="child.html"></embed>
<object data="child.html"></object>
child.html:
<script>prompt(document.domain)</script>
Expected result
Per the blanket sandbox directive, all three child frames should be treated as cross-origin loads and be denied script execution.
Actual result
The <embed> and <object> children are able to execute same-origin script code.
CSP3 spec reference:
6.2.2. sandbox The sandbox directive specifies an HTML sandbox policy which the user agent will apply to a resource, just as though it had been included in an
iframewith asandboxproperty.
I will follow up with additional details to the root cause.
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
Root cause
Likely the browser's frame-loading logic for embed and object elements does not inherit or apply the parent's CSP sandbox directive the way iframe loading does.
Impact
Content that a site intended to sandbox could run same-origin script through embed or object frames, weakening the protection the sandbox directive was meant to give.
What the attacker needed
Attacker can get content into an embed or object frame; victim visits the parent page
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.
A website can send a special instruction (a sandbox) telling the browser to treat embedded content as untrusted, so any scripts inside it cannot run. Here the browser applied that instruction to normal iframe frames but forgot to apply it to content loaded with the older embed and object tags. That means script in those frames ran when it should have been blocked.