How to fix: Third-party iframe without sandbox attribute
An iframe embedding third-party content does not use the sandbox attribute. Note: this fires on any cross-origin iframe, including common, legitimate embeds (YouTube, Google Maps, payment SDKs, chat widgets) that routinely omit sandbox because it would break their required functionality.
Why it matters
Without sandbox, a compromised third-party iframe can still open new windows/tabs, submit forms, or navigate the top-level page (the browser's Same-Origin Policy already prevents it from reading the parent page's DOM regardless of sandbox).
Add sandbox to third-party iframes where the embedded content doesn't need popups, top-level navigation, or forms, and grant only the permissions actually needed via allow-* tokens.
How to fix it
- 1Add sandbox="" (most restrictive)
- 2Add allow-scripts if the iframe requires JavaScript
- 3Never combine allow-scripts with allow-same-origin for cross-origin content
Code examples
Sandboxed third-party iframe
<iframe
src="https://widget.third-party.com"
sandbox="allow-scripts"
loading="lazy"
title="Widget"
></iframe>References
Detected automatically by VulnRadar. The check id is iframe-third-party-without-sandbox, stable across every scan so you can filter or diff on it.
More headers checks
Questions
- How severe is Third-party iframe without sandbox attribute?
- VulnRadar rates this low severity in the headers category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id iframe-third-party-without-sandbox, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Third-party iframe without sandbox attribute map to?
- It maps to CWE-1021. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.