Inappropriate implementation in AdFilter (CVE-2026-17751)
Blink's AdTracker uses a V8 API that skips a callback enforcing the ScriptForbiddenScope, allowing a malicious getter to run JavaScript during DOM insertion. This can corrupt the DOM tree and potentially lead to a use-after-free and renderer RCE.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
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: Blink's AdTracker::GetApiFunctionInfo relies on v8::Object::Get to traverse properties when checking for monkey-patched APIs during DOM insertion. This V8 API intentionally skips the BeforeCallEnteredCallback, bypassing Blink's ScriptForbiddenScope checks. An attacker can exploit this using a malicious getter to execute synchronous JavaScript and mutate the DOM tree mid-insertion, leading to state corruption and potential renderer RCE.
Affected files:
third_party/blink/renderer/core/ad_tracker/ad_tracker.ccthird_party/blink/renderer/core/html/media/html_video_element.ccthird_party/blink/renderer/core/dom/container_node.ccthird_party/blink/renderer/core/html/html_frame_element_base.cc
Estimated timestamp from git blame: 2025-10-28
Background
During DOM tree mutations (e.g., ContainerNode::AppendChild), Blink instantiates a ScriptForbiddenScope and an EventDispatchForbiddenScope to prevent synchronous JavaScript execution. This guarantees that C++ DOM manipulation algorithms and iterators can operate safely without the tree being modified from underneath them.
The Vulnerability
When a <video> element is inserted into the DOM by an ad script, its InsertedInto lifecycle method calls AdTracker::IsAdScriptInStack. To prevent false positives from benign monkey-patching, AdTracker calls GetApiFunctionInfo to verify if standard APIs (like Node.prototype.appendChild) have been tampered with.
GetApiFunctionInfo walks the global object properties using v8::Object::Get(context, property_key). However, v8::Object::Get invokes PrepareForExecutionScope with the template parameter do_callback = false (defined in v8/src/api/api-inl.h).
Because do_callback is false, V8 skips calling isolate_->FireBeforeCallEnteredCallback(). Blink relies entirely on this callback (implemented in V8PerIsolateData::BeforeCallEnteredCallback) to enforce CHECK(!ScriptForbiddenScope::IsScriptForbidden()). Consequently, if an attacker places a JavaScript getter or Proxy on the property path (e.g., window.Node), it will execute synchronously inside V8 while the C++ stack is in the middle of a forbidden scope.
Impact
Bypassing ScriptForbiddenScope during DOM mutation algorithms is a critical violation of Blink's memory safety invariants. It enables classic DOM mutation reentrancy. An attacker can mutate the tree mid-iteration (e.g., reparenting nodes, creating circular sibling pointers), which leads to Detached Tree Use-After-Free (UAF) and potential Arbitrary Code Execution (RCE) within the sandboxed renderer process.
Potential Reproduction Steps
Note: These steps are generated based on static code analysis by an AI tooling agent and represent a theoretical attack path. A working proof-of-concept has not yet been executed.
-
An attacker serves a script classified by Blink as an ad script (e.g., via a known ad domain).
-
The ad script defines a malicious getter on
window.Node:JavaScript Object.defineProperty(window, 'Node', { configurable: true, get() { // Executes during ScriptForbiddenScope! document.body.appendChild(iframe); return originalNode; } }); -
The ad script constructs a
DocumentFragmentcontaining a<video>and the<iframe>element. -
The script appends the fragment to the DOM:
document.body.appendChild(fragment). -
During
ContainerNode::InsertNodeVector, the<video>element is processed first. ItsInsertedIntomethod triggersAdTracker, which evaluateswindow.Node. -
The getter fires, synchronously appending the
<iframe>. This links the<iframe>into the tree and triggers itsInsertedIntolifecycle, initializing its frame. -
Control returns to the outer
InsertNodeVectorloop, which then processes the<iframe>a second time. Because the<iframe>was already appended during the getter, applying the insertion logic again creates a circular sibling pointer (lastChild()->SetNextSibling(&child)) and triggers aSECURITY_CHECK(!ContentFrame())crash inHTMLFrameElementBase::InsertedInto.
Proposed Fix
There are several ways to address this issue:
- Use safe V8 accessors: Refactor
AdTracker::GetApiFunctionInfoto avoid triggering author JavaScript. Instead ofv8::Object::Get, usev8::Object::GetRealNamedPropertyor retrieve the property descriptor to ensure only the native, non-getter value is inspected. - Early exit: Check
ScriptForbiddenScope::IsScriptForbidden()explicitly at the top ofAdTracker::GetApiFunctionInfoorIsAdScriptInStackHelper, and gracefully return early (e.g., assuming it is not a monkey patch) if script execution is currently forbidden.
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.
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, AdTracker uses a V8 property access method that does not trigger the callback which enforces ScriptForbiddenScope, so a getter can execute JavaScript during a forbidden scope.
Impact
Bypassing ScriptForbiddenScope could lead to a detached tree use-after-free and potential arbitrary code execution within the sandboxed renderer process, though a working proof-of-concept has not been executed.
What the attacker needed
Victim visits a page with an ad script; attacker controls ad script content
The fix
The report proposes using safe V8 accessors that do not trigger author JavaScript, or checking ScriptForbiddenScope explicitly and returning early.
How it was found
- An attacker serves a script classified by Blink as an ad script.
- The ad script defines a malicious getter on window.Node.
- The ad script constructs a DocumentFragment containing a video and an iframe.
- The script appends the fragment to the DOM.
- During insertion, the video element triggers AdTracker, which evaluates window.Node and fires the getter.
- The getter appends the iframe, causing it to be processed again and leading to a crash.
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 changes its structure, the browser normally blocks JavaScript from running at the same time to keep things safe. This report says a specific ad-detection feature accidentally allows JavaScript to run during that blocked period. That could let an attacker mess up the browser's internal state and possibly take over the part of the browser that runs the page.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.