Skip to content
Memory corruption Advisory Advanced CVE-2026-15123

Insufficient data validation in DOM (CVE-2026-15123)

A logic flaw in the DOM insertion code allows JavaScript to bypass structural safety checks when appending multiple nodes to a Document, potentially leaving a node in two child lists. This could corrupt the DOM tree and provide a memory corruption primitive in the renderer.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 25 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A logic flaw in ContainerNode::EnsurePreInsertionValidity allows JavaScript to bypass structural safety checks during multi-node insertions on Document targets. Malicious reparenting during synchronous events can lead to a node existing in two child lists, creating a memory corruption primitive.

Affected files:

  • third_party/blink/renderer/core/dom/container_node.cc

Estimated timestamp from git blame: Unknown (Google3 checkout)

Root Cause

When a multi-node DOM insertion API like document.append(node1, node2) is called, the C++ implementation (Node::append) sequentially processes the nodes via ConvertNodeUnionsIntoNodes. This function removes each node from its current location using node->remove(). If removing one of the nodes triggers a synchronous event (e.g., removing an iframe dispatches an unload event), JavaScript execution is re-entered.

During this reentrancy, an attacker can safely reparent one of the previously processed nodes into a new intermediate container (e.g., a detached div). Once the event handler completes, the append operation resumes and calls ContainerNode::AppendChildren on the target Document.

To prevent this exact type of reentrancy attack, a structural validation check (RecheckNodeInsertionStructuralPrereq) was previously introduced. However, ContainerNode::EnsurePreInsertionValidity contains an early-return path specifically for Document targets:

C++
  if (auto* document = DynamicTo<Document>(this)) {
    // Step 2 is unnecessary. No one can have a Document child.
    // Step 3:
    if (!CheckReferenceChildParent(*this, next, old_child, exception_state))
      return false;
    // Step 4-6.
    return document->CanAcceptChild(new_child, new_children, next, old_child,
                                    exception_state);
  }

This early return completely bypasses the RecheckNodeInsertionStructuralPrereq call located further down in the function. As a result, the insertion proceeds blindly.

Inside InsertNodeVector, a DCHECK(!target_node->parentNode()) validates that the node is detached. However, in release builds, this DCHECK is compiled out. The operation then calls AppendChildCommon, which overwrites the node's parent and sibling pointers to point to the Document. Crucially, it does not unlink the node from the intermediate div. The div's internal child list still references the node, while the node points to the Document and its siblings.

This DOM tree corruption (where a node effectively belongs to two different parents) can confuse the Blink layout engine or Garbage Collector, reliably providing a primitive for Use-After-Free (UAF) or Out-of-Bounds (OOB) memory corruption in the renderer process.

Potential Trigger Steps

These steps outline how an attacker could potentially trigger this vulnerability (note: this is a theoretical sequence derived from code analysis):

  1. Create a target Document (const doc = document.implementation.createDocument(null, null, null);).
  2. Create an intermediate container (const div = document.createElement('div');).
  3. Create a detached comment node (const node1 = document.createComment('');).
  4. Create an iframe (node2), append it to the active DOM, and attach a synchronous unload handler to its contentWindow.
  5. Call the multi-node append API on the target Document: doc.append(node1, node2).
  6. During the extraction phase, removing node2 triggers the unload handler.
  7. Inside the unload handler, reparent the comment node: div.append(node1).
  8. The insertion resumes and bypasses the structural safety check due to the Document-specific early return, corrupting the tree.

Suggested Fix

Ensure that the structural validation check is also applied when inserting into a Document. For instance, in ContainerNode::EnsurePreInsertionValidity, add the re-check logic before the Document early return completes:

C++
  if (auto* document = DynamicTo<Document>(this)) {
    if (!CheckReferenceChildParent(*this, next, old_child, exception_state))
      return false;
    
    if (new_children && new_children->size() != 1u &&
        RuntimeEnabledFeatures::RecheckParentDuringNodeVectorInsertionEnabled() &&
        !RecheckNodeInsertionStructuralPrereq(*new_children, next, exception_state)) {
      return false;
    }

    return document->CanAcceptChild(new_child, new_children, next, old_child,
                                    exception_state);
  }

Evaluated with Chrome root at commit: 65b3256311f3ab6fb9870eaa522de7e6dd2663bb


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there's no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

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 an early-return path for Document targets in EnsurePreInsertionValidity skips the RecheckNodeInsertionStructuralPrereq call, so a node reparented during a synchronous event is not re-validated before insertion.

Impact

This DOM tree corruption could confuse the layout engine or garbage collector, potentially providing a primitive for use-after-free or out-of-bounds memory corruption in the renderer process.

What the attacker needed

Ability to run JavaScript in the renderer; synchronous event handler on a removed node

The fix

The structural validation check should also be applied when inserting into a Document, by adding the re-check logic before the Document early return completes.

How it was found

  1. Create a target Document.
  2. Create an intermediate container div.
  3. Create a detached comment node.
  4. Create an iframe, append it to the active DOM, and attach a synchronous unload handler.
  5. Call the multi-node append API on the target Document with the comment and iframe.
  6. During removal of the iframe, the unload handler reparents the comment node into the div, and insertion resumes bypassing the structural check.

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 you add several elements to a web page at once, the browser normally checks that each element is in a safe place. This report says a shortcut in that check for the top-level document can be tricked by running code in the middle of the operation, so an element ends up listed under two parents. That confusion could crash or corrupt the browser's memory.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.