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

Out of bounds read in AdFilter (CVE-2026-7995)

A missing check for the end() iterator in AdTracker::GetAncestry allows an out-of-bounds read when a script ID from a different local root is encountered. An attacker could trigger this by moving an ad-tagged event handler across local roots, potentially leading to an arbitrary memory increment primitive and remote code execution in the renderer process.

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 without the Chrome Security team.

Overview: A missing check for the end() iterator in AdTracker::GetAncestry can lead to an out-of-bounds read when a script ID from a different local root is encountered. This can be triggered by moving an ad-tagged event handler across local roots, allowing an attacker to trigger an arbitrary memory increment primitive. This is a high severity issue that can likely be used to achieve Remote Code Execution in the renderer process.

Affected files:

  • third_party/blink/renderer/core/ad_tracker/ad_tracker.cc
  • third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc
  • third_party/blink/renderer/core/dom/node.cc
  • third_party/blink/renderer/core/frame/local_frame.cc

Estimated timestamp from git blame: 2025-08-28

Summary

The AdTracker::GetAncestry function in Blink's AdTracker implementation contains a missing check for the end() iterator after a HashMap::find call. This allows an out-of-bounds read from the HashMap's backing buffer. Because the AdScriptIdentifier structure contains a WTF::String, copy-constructing it from the OOB memory triggers StringImpl::AddRef() on a pointer read from uninitialized PartitionAlloc padding. This provides a highly reliable 32-bit atomic increment primitive at an arbitrary address in the Renderer process, which can be leveraged for Remote Code Execution.

Vulnerability Details

In third_party/blink/renderer/core/ad_tracker/ad_tracker.cc, the GetAncestry function iterates through a script's provenance chain. At line 750, it performs a lookup and immediately pushes the result without checking if the item was found:

C++
auto it = this->ad_script_data_.find(script_id);
ancestry.ancestry_chain.push_back(it->value.id); // L751: it is not checked against end()

If the script ID is not found, find() returns end(). In WTF::HashMap, the end() iterator internally points to the memory immediately following the backing buffer. Dereferencing it results in an Out-of-Bounds (OOB) read.

An attacker can reliably trigger this state because AdTracker instances are per-LocalRoot, but JSEventHandlerForContentAttribute captures the ad provenance of the context where it was created and retains it, even if the element is moved to a different LocalRoot via adoptNode.

Potential Exploit Flow

Note: These are suggested steps to trigger the vulnerability, as a working exploit has not been verified yet.

  1. Setup: The attacker controls Page A and executes a script that is tracked by AdTracker A (e.g., matching a Subresource Filter rule).
  2. Capture Provenance: In Page A, the ad script creates a div and sets an onclick handler. The parser synchronously calls JSEventHandlerForContentAttribute::Create, which checks IsAdScriptInStack on Tracker A. Finding an ad script, it stores its V8ScriptId in the parent_ad_script_ member.
  3. Cross-Root Move: The attacker opens Page B (a new LocalRoot with an independent Tracker B) and uses document.adoptNode() to move the div into Page B. The event listeners are preserved, carrying the stale parent_ad_script_ ID from Page A.
  4. Heap Grooming: The attacker uses JavaScript in Page B to groom the PartitionAlloc heap. For a HashMap capacity of 1024 bytes, PartitionAlloc's kDenser distribution allocates an 1152-byte bucket, leaving 128 bytes of uninitialized padding. The attacker fills freed 1152-byte buckets with forged pointers at the precise offset where the OOB read will occur.
  5. Trigger Execution: The attacker triggers the onclick handler in Page B. It lazy-compiles the handler, sees it is ad-related, and registers it with Tracker B. Crucially, it registers it using the stale parent_ad_script_ ID.
  6. IFrame Creation: The onclick handler's payload creates an iframe. The new LocalFrame constructor checks !IsMainFrame() && ad_tracker_ and calls ad_tracker_->IsAdScriptInStack to check if an ad script created the frame.
  7. The Bug: Tracker B identifies the running onclick script and calls GetAncestry. It reads the provenance ID (from Page A) and attempts to find() it in Tracker B's map. It fails, returning end(). The uninitialized PartitionAlloc padding is read as an AdScriptIdentifier.
  8. Arbitrary Increment: The push_back operation copies the OOB memory into the ancestry chain. Because AdScriptIdentifier contains a WTF::String (which contains a scoped_refptr), copying it invokes StringImpl::AddRef(). This performs a fetch_add(1) on the forged pointer residing in the groomed padding.
  9. Exploitation: The incremented reference count is permanently stored in LocalFrame::ad_script_ancestry_. By targeting the size field of a JavaScript ArrayBuffer, the attacker can permanently increase its bounds, achieving arbitrary memory read/write and ultimately RCE in the Renderer.

Suggested Fix

Add a check for end() before dereferencing the iterator in AdTracker::GetAncestry:

C++
auto it = this->ad_script_data_.find(script_id);
if (it != this->ad_script_data_.end()) {
  ancestry.ancestry_chain.push_back(it->value.id);
} else {
  // Handle missing provenance safely, perhaps by breaking the loop or logging.
  break;
}

Additionally, consider auditing if JSEventHandlerForContentAttribute should reset its ad provenance when moved to a new execution context via adoptNode.

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

The code calls HashMap::find and then dereferences the iterator without checking if it equals end(), leading to an out-of-bounds read when the key is not found.

Impact

This could likely be used to achieve Remote Code Execution in the renderer process, though a working exploit has not been verified yet.

What the attacker needed

Attacker controls two pages; ability to move DOM nodes across pages; heap grooming capability

The fix

Add a check for end() before dereferencing the iterator in AdTracker::GetAncestry, and consider resetting ad provenance when moving elements across execution contexts.

How it was found

  1. Attacker controls Page A and executes a script tracked by AdTracker A.
  2. In Page A, the ad script creates a div with an onclick handler, storing its V8ScriptId.
  3. Attacker opens Page B and uses document.adoptNode() to move the div into Page B, preserving the stale script ID.
  4. Attacker grooms the PartitionAlloc heap in Page B to place forged pointers in uninitialized padding.
  5. Attacker triggers the onclick handler in Page B, which registers with Tracker B using the stale ID.
  6. The handler creates an iframe, causing Tracker B to call GetAncestry, which reads out-of-bounds memory and performs an arbitrary increment.

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.

The code that tracks which scripts are ads has a bug: it looks up a script's ID in a list but forgets to check if the ID is actually there. If the ID is missing, it reads memory that it shouldn't, which can be used to corrupt data and potentially run malicious code.

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.