CWE-1021: Improper Restriction of Rendered UI Layers or Frames
Base
The web application does not restrict or incorrectly restricts frame objects or UI layers that belong to another application or domain.
Consequences
- Access Control: Gain Privileges or Assume Identity, Bypass Protection Mechanism, Read Application Data, Modify Application Data
How to prevent it
- Implementation: The use of X-Frame-Options allows developers of web content to restrict the usage of their application within the form of overlays, frames, or iFrames. The developer can indicate from which domains can frame the content. The concept of X-Frame-Options is well documented, but implementation of this protection mechanism is in development to cover gaps. There is a need for allowing frames from multiple domains.
- Implementation: A developer can use a "frame-breaker" script in each page that should not be framed. This is very helpful for legacy browsers that do not support X-Frame-Options security feature previously mentioned. It is also important to note that this tactic has been circumvented or bypassed. Improper usage of frames can persist in the web application through nested frames. The "frame-breaking" script does not intuitively account for multiple nested frames that can be presented to the user.
- Implementation: This defense-in-depth technique can be used to prevent the improper usage of frames in web applications. It prioritizes the valid sources of data to be loaded into the application through the usage of declarative policies. Based on which implementation of Content Security Policy is in use, the developer should use the "frame-ancestors" directive or the "frame-src" directive to mitigate this weakness. Both directives allow for the placement of restrictions when it comes to allowing embedded content.
- Implementation: In addition to frames or iframes as previously mentioned, the web application is expected to place restrictions on whether it is allowed to be rendered within objects, embed, or applet elements.
Recent advisories
- GHSA-jmc6-2wr8-h3wj — Open WebUI: Same-origin XSS to account takeover via terminal port-preview iframe hardcoding allow-same-origin
- GHSA-9f4c-93c8-jc8g — Electron: Sandboxed iframe can bypass the allow-popups restriction via the OpenURL navigation path
- GHSA-x8rc-wpg4-grpf — Electron: Cross-origin iframe can position native autofill popup
- GHSA-3xpf-xq7r-v8c5 — Open WebUI: Same-origin XSS to account takeover via terminal file-preview iframe hardcoding allow-same-origin
- GO-2026-5030 — Invoking duplicate attributes can cause XSS in golang.org/x/net/html
- GO-2026-5029 — Invoking incorrect handling of character references in DOCTYPE nodes in golang.org/x/net/html
- GO-2026-5027 — Invoking incorrect handling of HTML elements in foreign content in golang.org/x/net/html
- GHSA-cjv3-m589-v3rx — OpenClaw has Canvas route hardening for mixed-trust deployments
- GHSA-54vw-f4xf-f92j — HAX CMS application pages vulnerable to clickjacking
- GHSA-v3ph-2q5q-cg88 — @haxtheweb/haxcms-nodejs Iframe Phishing vulnerability
- GHSA-5xfx-55x4-j223 — Cross-Frame Scripting vulnerability has been found on Plone CMS
- GHSA-gm7m-rqf8-jx4m — Improper Restriction of Rendered UI Layers or Frames in cockpit-hq/cockpit
- GHSA-h8r9-467r-vjjf — pyLoad vulnerable to Improper Restriction of Rendered UI Layers or Frames
- GHSA-m379-x4xc-38x9 — rdiffweb vulnerable to Improper Restriction of Rendered UI Layers or Frames
- GHSA-7xp8-7wqx-5hqx — Jenkins REST APIs vulnerable to clickjacking
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor