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

Use after free in Bindings (CVE-2026-95353)

A use-after-free exists in V8's FastIterateArray helper because it caches raw pointers to array elements on the stack. When a Blink callback allocates on the cppgc heap, a synchronous garbage collection can move the array, leaving the cached pointers dangling and allowing a stale write and a fake-object read.

Google Chrome

Originally disclosed on Chrome VRP

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

Overview: A potential Use-After-Free vulnerability exists in FastIterateArray when handling PACKED or HOLEY elements. A Blink IDL sequence callback allocating on the cppgc heap can trigger a synchronous V8 mark-compact GC, leaving raw stack-resident Tagged pointers stale since conservative stack scanning is off by default. This leads to an in-cage stale write and fakeobj-shaped read.

Affected files:

  • src/api/api.cc

Estimated timestamp from git blame: 2023-09-14

1. Summary of the Issue (Meant for Human Triage)

A potential use-after-free (UAF) / stale pointer vulnerability exists in the FastIterateArray optimization helper in src/api/api.cc. When iterating over arrays with PACKED or HOLEY element kinds, the function caches a raw (non-handle) Tagged<FixedArray> stack local and dereferences elements into a raw Tagged<Object> stack local. While the documented contract of v8::Array::Iterate prohibits the embedder's callback from allocating V8 objects while iterating, this restriction is not enforced in release builds, and embedders often interpret this as allowing allocations on independent heaps like Blink's cppgc (Oilpan).

In Chromium, Blink's IDL sequence converter for DOMArrayBuffer (CreateIDLSequenceFromV8ArraySlow<DOMArrayBuffer>) acts as the callback. During iteration, it allocates new DOMArrayBuffer objects on the cppgc heap via MakeGarbageCollected, subsequently returning kContinue to resume iteration. This cppgc allocation can synchronously trigger a full V8 mark-compact GC with compaction/evacuation when incremental marking is active and the old-generation allocation limit is overshot. Because conservative stack scanning (CSS) is disabled by default (v8_enable_direct_handle = false), the raw stack-resident Tagged<> pointers are neither traced nor updated when the elements array is relocated during GC.

This results in severe in-cage memory corruption:

  1. Stale Write: During the same iteration, the callback writes a CppHeapPointer handle to the stale, evacuated address of the ArrayBuffer element via v8::Object::Wrap.
  2. Stale Read: In the subsequent iteration, FastIterateArray reads elements from the dangling FixedArray pointer, yielding arbitrary/garbage values treated strictly as Tagged<Object> (a fakeobj-style type confusion / arbitrary read primitive).

This vulnerability is reachable from standard, unprivileged web content via several shipped WebCodecs APIs that accept a sequence<ArrayBuffer> dictionary member (e.g., EncodedVideoChunkInit.transfer).


2. Proof-of-Concept & Detailed Execution Flow

Note: Our tooling agent does not have the ability to run code, so the following are suggested, potential steps an attacker would follow to trigger the vulnerability based on static code analysis.

Phase 1: Setup and Preconditions

  1. Heap Grooming: The attacker grooms the V8 heap such that incremental major marking is currently active.
  2. Allocation Limit: The attacker ensures that the V8 heap allocation limit is currently overshot by a large margin (meaning heap->AllocationLimitOvershotByLargeMargin() evaluates to true).
  3. Payload Construction: The attacker creates a large array containing fresh ArrayBuffer objects via JavaScript: let abs = []; for(let k=0; k<50000; k++) abs.push(new ArrayBuffer(8));. Because they were just created in V8, they do not yet have Blink DOMArrayBuffer wrapper objects instantiated on the cppgc heap.
  4. API Invocation: The attacker triggers a WebCodecs API that accepts a sequence<ArrayBuffer>. For example: new EncodedVideoChunk({type: 'key', timestamp: 0, data: new Uint8Array(1), transfer: abs});.

Phase 2: V8 Invokes FastIterateArray

  1. Blink Bindings Resolution: The Blink bindings layer invokes CreateIDLSequenceFromV8ArraySlow<DOMArrayBuffer> to convert the incoming JavaScript array into an IDL sequence (third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h:909).
  2. V8 Fast Iteration Entry: Because DOMArrayBuffer implements ScriptWrappable, the Blink bindings call v8::Array::Iterate (include/v8-container.h:79), attempting to execute a fast callback for each element in the array.
  3. V8 delegates v8::Array::Iterate to i::FastIterateArray (src/api/api.cc:8199).
  4. FastIterateArray checks CanUseFastIteration which evaluates to true for standard arrays.
  5. Execution enters a DisallowJavascriptExecution scope (src/api/api.cc:8212). While this scope intercepts and fatals on V8 JS execution re-entry, it does not block V8 GC sweeps or cppgc memory allocations.
  6. FastIterateArray determines the elements kind of the array (e.g., PACKED_ELEMENTS).
  7. The Vulnerable Cache: V8 extracts the backing store of the array into a raw C++ stack local variable, bypassing Handle protections entirely: Tagged<FixedArray> elements = Cast<FixedArray>(array->elements()); (src/api/api.cc:8221).

Phase 3: The Iteration Loop and Raw Pointer Exposure

  1. The for loop begins iterating over the array length (src/api/api.cc:8222).
  2. During the first iteration (i=0), the element at index 0 is fetched into a second raw C++ stack local variable: Tagged<Object> element = elements->get(static_cast<int>(i)); (src/api/api.cc:8223).
  3. V8 constructs a temporary IndirectHandle<Object> named fake_handle that points directly to the memory address of the local element variable on the C++ stack (src/api/api.cc:8226-8227).
  4. V8 invokes the Blink-provided callback, passing the fake_handle containing the raw, unprotected pointer (src/api/api.cc:8228).

Phase 4: Blink Allocates on the cppgc Heap

  1. The Blink callback maps to NativeValueTraits<DOMArrayBuffer>::NativeValue which invokes ToDOMArrayBuffer (third_party/blink/renderer/bindings/core/v8/native_value_traits_buffer_sources.cc:286).
  2. Inside ToDOMArrayBuffer, Blink notices that the current V8 ArrayBuffer does not possess a Blink wrapper.
  3. Blink allocates a new DOMArrayBuffer object to act as the wrapper using DOMArrayBuffer::Create(contents).
  4. DOMArrayBuffer::Create utilizes MakeGarbageCollected<DOMArrayBuffer> to allocate memory on the cppgc (Oilpan) heap (include/cppgc/allocation.h:325).

Phase 5: Synchronous Mark-Compact Garbage Collection is Triggered

  1. The cppgc allocator calls cppgc::ObjectAllocator::OutOfLineAllocateGCSafePoint (src/heap/cppgc/object-allocator.cc:152).
  2. This notifies the stats collector via StatsCollector::NotifySafePointForConservativeCollection (src/heap/cppgc/stats-collector.cc:60).
  3. The stats collector invokes the CppHeap observer function: CppHeap::AllocatedObjectSizeIncreased (src/heap/cppgc-js/cpp-heap.cc:1056).
  4. CppHeap invokes ReportBufferedAllocationSizeIfPossible (src/heap/cppgc-js/cpp-heap.cc:1066).
  5. Because IsGCAllowed() evaluates to true and incremental marking is active, execution proceeds to check the allocation limits.
  6. Due to the attacker's heap grooming (Step 2), the condition heap->AllocationLimitOvershotByLargeMargin() evaluates to true (src/heap/cppgc-js/cpp-heap.cc:1098).
  7. Synchronous GC Execution: V8 synchronously triggers a full atomic mark-compact GC by calling heap->FinalizeIncrementalMarkingAtomically(i::GarbageCollectionReason::kExternalFinalize) (src/heap/cppgc-js/cpp-heap.cc:1099).

Phase 6: Array Backing Store Evacuation

  1. The mark-compact garbage collector begins execution.
  2. The V8 heap page containing the array's FixedArray backing store is selected as an evacuation candidate for compaction.
  3. The FixedArray containing the elements is relocated to a completely new address on a different heap page.
  4. By default, V8 does not scan the C++ stack for raw pointers. Because v8_enable_direct_handle is false (gni/v8.gni:200), ConservativeStackScanningModeForMajorGC returns StackScanMode::kNone (src/heap/heap.h:414).
  5. Because there is no conservative stack scanning, the raw Tagged<FixedArray> elements and Tagged<Object> element stack variables in the frozen FastIterateArray stack frame are not updated to reflect the new object locations. They now contain stale, dangling addresses pointing to the evacuated (freed) page memory.
  6. The garbage collection cycle completes, and execution returns to ToDOMArrayBuffer.

Phase 7: Stale Write (Same Iteration)

  1. Blink links the newly allocated array_buffer to the V8 object via array_buffer->AssociateWithWrapper(...).
  2. The V8 object provided to AssociateWithWrapper is backed by the fake_handle, which dereferences the un-updated, dangling element stack local.
  3. The execution path reaches v8::Object::Wrap (src/api/api.cc:6237).
  4. Wrap attempts to link the wrapper by storing a CppHeapPointer inside the V8 object via SetCppHeapWrappable.
  5. This calls WriteLazilyInitializedCppHeapPointerField (src/sandbox/cppheap-pointer-inl.h:56).
  6. The Stale Write (In-Cage UAF): V8 performs an atomic 32-bit release store (slot.Release_StoreHandle(new_handle)) to write the CppHeapPointerHandle directly to the object field located at the dangling, evacuated pointer address. This constitutes an out-of-bounds, in-cage Write Use-After-Free.
  7. The Blink callback completes and returns v8::Array::CallbackResult::kContinue to V8 (third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h:962).

Phase 8: Stale Read & Fake Object Confusion (Subsequent Iteration)

  1. FastIterateArray resumes execution. Since the result is kContinue, the for loop continues (src/api/api.cc:8229).
  2. The loop counter i is incremented.
  3. The Stale Read (In-Cage UAF): FastIterateArray attempts to fetch the next element in the array using the dangling elements pointer: Tagged<Object> element = elements->get(static_cast<int>(i)); (src/api/api.cc:8223).
  4. This reads garbage data (or attacker-groomed data placed during the GC evacuation) from the freed heap page.
  5. The garbage data is treated strictly as a valid Tagged<Object> by V8.
  6. A new fake_handle is bound to this invalid Tagged<Object> memory.
  7. The Blink callback is invoked again with the garbage pointer (src/api/api.cc:8228).
  8. Fake Object / Type Confusion: The callback invokes value->IsArrayBuffer(), which dereferences the map word of the fake object at the invalid pointer address, yielding a type confusion / controlled arbitrary read primitive.

Suggested Fix

Blink-side (route to Blink>Bindings): Exclude DOMArrayBuffer and DOMSharedArrayBuffer from the Array::Iterate fast-path at native_value_traits_impl.h:909. Their NativeValue lazy-creates an Oilpan wrapper, inherently violating V8's fast-iteration non-allocation constraints under memory pressure.

V8-side hardening: Handlify the elements and element variables in the PACKED and HOLEY branches of FastIterateArray at api.cc:8221 and api.cc:8241. The DOUBLE case at api.cc:8261 correctly uses DirectHandle<FixedDoubleArray> and is not vulnerable to this UAF.


3. Technical Verification Details (Automated Audit Logs - Reviewers may skip this section)

VERDICT: accept
RULE: Layer-1 write primitive whose reachability needs a contrived-but-plausible heap/feedback state.
LAYER: 1     CLASS: K6

Probabilities:
- 99% probability the vulnerability is real.
- 99% probability the details in the writeup are correct.
- 95% probability it could be exploited by an adversary (fakeobj-shaped read and Use-After-Free write).

Step-by-step Justification:
1. Determine the layer: The report specifies how a plain JavaScript WebCodecs API (`EncodedVideoChunk`) triggers the vulnerability via standard Blink bindings. The attacker does not require prior in-cage memory corruption. Thus, this is a Layer-1 finding.
2. Disqualifier checklist: No disqualifiers apply. The bug does not rely on DevTools, `d8`-only sinks, or non-shipping experimental flags. It is reachable on default flags (`v8_enable_direct_handle = false` disabling conservative stack scanning). The `DisallowJavascriptExecution` scope does not prevent the GC that triggers the bug.
3. Base severity: This is a Layer-1 memory corruption (Use-After-Free) resulting in a fakeobj-shaped read and an in-cage write. Under normal circumstances, an in-cage UAF write is rated `high`. However, as the report correctly identifies, reaching the GC trigger requires a very specific, contrived-but-plausible heap state (`Heap::AllocationLimitOvershotByLargeMargin()` being true during incremental marking, alongside a cppgc allocation threshold). Per the V8 severity determination guide, a "Layer-1 write primitive whose reachability needs a contrived-but-plausible heap/feedback/tier-up state that an attacker could realistically arrange but that significantly narrows applicability" caps the severity at `medium`.
4. Modifiers: The WebCodecs API is shipped and available on default flags. No experimental or developer flags are required. The bug applies to all architectures, including tier-1 (x64/arm64). Therefore, no modifiers reduce the severity. Final severity remains `medium`.

VERIFIED:
- `api.cc:8219-8233` (PACKED) and `:8239-8254` (HOLEY) use raw `Tagged<FixedArray>` and `Tagged<Object>` without Handle protections, unlike the DOUBLE branch.
- `DisallowJavascriptExecution` blocks JS via `execution.cc` but does not block V8 or cppgc GC.
- `cpp-heap.cc:1099` (`ReportBufferedAllocationSizeIfPossible`) triggers `FinalizeIncrementalMarkingAtomically`, causing a full GC with evacuation.
- `v8_enable_direct_handle = false` means conservative stack scanning is off by default, leaving raw stack pointers un-updated during GC.

NOT-VERIFIED:
- Blink's `third_party/blink/` binding implementations; accepted as reported.

DUPLICATE: DISTINCT from other `FastIterateArray` bugs (which involve Layer-2 length trusts).

Environmental Assumptions & Preconditions Verified by Tooling

  • CSS Off By Default: Checked v8_enable_direct_handle in gni/v8.gni:200. It defaults to false. As a result, ConservativeStackScanningModeForMajorGC returns StackScanMode::kNone (src/heap/heap.h:406-415).
  • DisallowJavascriptExecution: Traced in src/common/assert-scope.h and src/execution/execution.cc. This is an Isolate-level assertion scope checked strictly during Execution::Invoke. It does not intercept memory allocations or GC cycles. Indeed, DisallowJavascriptExecution is actively used inside Heap::CollectGarbage (src/heap/heap.cc:1467), proving it permits GC.
  • cppgc Triggers V8 GC: The call tree from MakeGarbageCollected leads to cppgc::ObjectAllocator::OutOfLineAllocateGCSafePoint. This calls StatsCollector::NotifySafePointForConservativeCollection, which invokes CppHeap::AllocatedObjectSizeIncreased (src/heap/cppgc-js/cpp-heap.cc:1056). Inside ReportBufferedAllocationSizeIfPossible, the path explicitly executes heap->FinalizeIncrementalMarkingAtomically if allocation limits are breached.
  • In-Cage Stale Write: Evaluated v8::Object::Wrap. It delegates to CppHeapObjectWrapper::SetCppHeapWrappable, which invokes WriteLazilyInitializedCppHeapPointerField (src/sandbox/cppheap-pointer-inl.h:56). Under pointer compression, this safely allocates an external CppHeapPointerTable entry, but performs an atomic 32-bit release store (slot.Release_StoreHandle) directly into the in-cage V8 JSObject memory address. If the object was evacuated, the write occurs at the dangling address.

Evaluated with Chrome root at commit: 71e7e1a98476f8faf0d126dc83935a84331b2194


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.

Note: This bug has been automatically redirected to the top-level Chromium component. Please move it to the actual component: https://b.corp.google.com/components/1456124 once PoCs have been generated.

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, FastIterateArray stores raw Tagged pointers to the array's backing store and elements on the C++ stack, and because conservative stack scanning is disabled by default, these pointers are not updated when a synchronous garbage collection relocates the array during a callback that allocates on the cppgc heap.

Impact

An attacker could achieve an in-cage stale write and a fake-object-shaped read, potentially leading to memory corruption or information disclosure, though reaching the required heap state is contrived.

What the attacker needed

Ability to run JavaScript in the browser; heap grooming to trigger GC during iteration

The fix

The issue should be fixed by excluding DOMArrayBuffer and DOMSharedArrayBuffer from the fast iteration path in Blink and by using handles for the elements and element variables in FastIterateArray.

How it was found

  1. Groom the V8 heap so incremental major marking is active and the allocation limit is overshot.
  2. Create a large JavaScript array of ArrayBuffer objects.
  3. Call a WebCodecs API that accepts a sequence<ArrayBuffer>, such as EncodedVideoChunk with a transfer member.
  4. The Blink bindings invoke v8::Array::Iterate, which enters FastIterateArray and caches raw pointers to the array elements.
  5. The Blink callback allocates a DOMArrayBuffer on the cppgc heap, triggering a synchronous mark-compact garbage collection that moves the array.
  6. The stale pointers are used for a write in the same iteration and a read in the next, causing memory corruption.

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 JavaScript code passes an array of buffers to a browser API, the browser's engine iterates over the array using a fast path that keeps direct pointers to the array's internal storage on the call stack. If, during that iteration, the browser allocates memory in a way that triggers a garbage collection, the array can be moved to a new location. The old pointers are not updated, so the code later reads and writes through them, which can corrupt memory or leak data.

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.