Skip to main content
LowHeadersOWASP A05:2021CWE-1021

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

  1. 1Add sandbox="" (most restrictive)
  2. 2Add allow-scripts if the iframe requires JavaScript
  3. 3Never combine allow-scripts with allow-same-origin for cross-origin content

Code examples

Sandboxed third-party iframe

HTML
<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.

See every headers check

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.

Propose a checkHow a check is built

Scan your own site for third-party iframe without sandbox attribute

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Third-party iframe without sandbox attribute fix | VulnRadar