Skip to content
XSS Advisory Advanced CVE-2026-11166

Inappropriate implementation in SVG (CVE-2026-11166)

SVGScriptElement::ChildrenChanged does not check the StatePreservingAtomicMoveInProgress flag, so moving a text node into an empty SVG script element with moveBefore() executes JavaScript synchronously while the flag is true. This lets an attacker re-parent an iframe without proper detachment, desynchronising the DOM and frame trees and potentially bypassing Site Isolation and Permissions Policies.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 51 days

Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team.

Overview: SVGScriptElement::ChildrenChanged lacks a check for StatePreservingAtomicMoveInProgress, allowing synchronous JavaScript execution during a moveBefore() operation. Executing script while this document-wide flag is true allows an attacker to bypass iframe detachment and structural security checks, leading to a desynchronization between the DOM tree and the Frame tree. This can be exploited to bypass Site Isolation and Permissions Policies.

Affected files:

  • third_party/blink/renderer/core/svg/svg_script_element.cc
  • third_party/blink/renderer/core/dom/node.cc
  • third_party/blink/renderer/core/dom/container_node.cc
  • third_party/blink/renderer/core/script/script_loader.cc
  • third_party/blink/renderer/core/html/html_frame_element_base.cc

Estimated timestamp from git blame: 2024-08-13

Description

A potential vulnerability exists in the handling of the new moveBefore DOM API when interacting with SVG <script> elements.

When a node is moved using moveBefore, Blink sets a document-wide flag, StatePreservingAtomicMoveInProgress, to true to ensure that state (such as iframe contents) is preserved and script execution is suspended during the transition. However, SVGScriptElement::ChildrenChanged fails to check this flag.

If an attacker uses moveBefore to move a text node containing a malicious payload into an already-connected, previously empty SVGScriptElement, SVGScriptElement::ChildrenChanged unconditionally triggers script evaluation via ScriptLoader::ChildrenChanged. Because the ScriptForbiddenScope used for the low-level DOM mutation has already been destroyed at this point in the insertion lifecycle, V8 executes the inline script synchronously.

Security Impact

Executing JavaScript while StatePreservingAtomicMoveInProgress is globally true is highly dangerous because several critical layout and security invariants are disabled based on this flag:

  1. Frame Detachment Bypass: If the executing script calls removeChild on an iframe, the ChildFrameDisconnector is skipped. The iframe is removed from the DOM, but its underlying FrameTree node and ContentFrame are not destroyed, and unload events do not fire.
  2. Security Check Bypass: If the script subsequently calls appendChild to insert the iframe into a new parent, it triggers HTMLFrameElementBase::InsertedInto. This method contains a critical check: SECURITY_CHECK(!ContentFrame() || GetDocument().StatePreservingAtomicMoveInProgress());. Because the flag is true, this check is bypassed.

By combining these primitives, an attacker can perform a "manual" state-preserving move, re-parenting an iframe in the DOM tree without updating its structural position in the renderer's FrameTree or communicating the change to the browser process. This creates a severe desynchronization that can be leveraged to bypass Site Isolation, Same-Origin Policy checks, and Permissions Policies, leading to a Universal Cross-Site Scripting (UXSS) and renderer sandbox compromise.

(Note: These are potential steps based on code analysis; a working proof-of-concept has not been executed by our tooling.)

Suggested Steps to Reproduce

  1. Create an HTML document containing an iframe pointing to a cross-origin target.
  2. Create an svg element containing an empty script element (<svg><script id="svgScript"></script></svg>) and append it to the document.
  3. Create a TextNode containing a JavaScript payload that removes the iframe and appends it to a different cross-origin parent.
  4. Call svgScript.moveBefore(text_node, null).
  5. The payload executes synchronously, completing the malicious iframe re-parenting and establishing the UXSS primitive.

Suggested Fix

Update SVGScriptElement::ChildrenChanged (in third_party/blink/renderer/core/svg/svg_script_element.cc) to mirror the check performed in HTMLScriptElement::ChildrenChanged:

C++
void SVGScriptElement::ChildrenChanged(const ChildrenChange& change) {
  SVGElement::ChildrenChanged(change);
  if (!GetDocument().StatePreservingAtomicMoveInProgress()) {
    loader_->ChildrenChanged(change);
  }
  children_changed_by_api_ |= !change.ByParser();
}

Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b


Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 SVG script element's child-change handler omits the StatePreservingAtomicMoveInProgress check that the HTML script element handler has, so script evaluation is not suppressed during a state-preserving move.

Impact

By combining these primitives, an attacker could perform a manual state-preserving move, re-parenting an iframe without updating its structural position in the FrameTree or communicating the change to the browser process, potentially bypassing Site Isolation, Same-Origin Policy checks, and Permissions Policies, leading to UXSS and renderer sandbox compromise; however, the text notes that a…

What the attacker needed

Victim visits a malicious page; browser supports moveBefore API

The fix

The SVGScriptElement::ChildrenChanged method should be updated to check StatePreservingAtomicMoveInProgress before calling loader_->ChildrenChanged, mirroring the check in HTMLScriptElement::ChildrenChanged.

How it was found

  1. Create an HTML document with an iframe pointing to a cross-origin target.
  2. Create an SVG element containing an empty script element and append it to the document.
  3. Create a text node containing a JavaScript payload that removes the iframe and appends it to a different cross-origin parent.
  4. Call moveBefore on the SVG script element with the text node.
  5. The payload executes synchronously, completing the iframe re-parenting and establishing the UXSS primitive.

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 a web page moves an element around, the browser normally pauses scripts and keeps things like embedded frames intact. Here, a specific type of script inside an SVG image was not paused, so it could run at the wrong moment and move an embedded frame in a way the browser did not expect. That could let an attacker break the rules that keep different websites separate.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.