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

Out of bounds write in V8 (CVE-2026-9973)

A stale replacement in V8's Wasm load elimination causes a loop-carried array phi to be incorrectly replaced with a large array, so a bounds check uses the large array's length while the actual store targets a small array, leading to an out-of-bounds write. An attacker can use this to corrupt adjacent heap objects and achieve arbitrary read/write within the V8 heap sandbox.

amyb Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 24 days

Hello,

We’re contacting you from OpenAI Security Research to notify you of a potential security issue identified during our internal research process.

The issue appears to affect your product. We've validated the behavior internally and believe it may pose a risk.

Please see the below report for details.

We are reaching out privately and cooperatively. We are happy to collaborate on patch validation or coordinate timelines. We are not planning to make any public disclosure unless there's an agreement to do so or we assess that the risk requires it.

Please let us know how you’d prefer to proceed and if you need additional details or support.

Best regards, OpenAI Security Research Team [email protected]

DISCLOSURE REPORT FOLLOWS:

Security Report: Wasm GC Load Elimination Stale Loop-Phi Replacement Enables V8 Heap-Sandbox Read/Write

Reporter: OpenAI Codex Security
Organization: OpenAI
Component: V8 JavaScript Engine (Turboshaft / WebAssembly GC optimizer)
Affected Area: WasmLoadEliminationReducer, loop snapshot/revisit handling, Wasm GC array bounds checks
Bug Class: Unsnapshotted compiler replacement state -> stale loop-phi base -> eliminated array-length check -> out-of-bounds Wasm GC array write
Discovery Method: Source review, optimizer-state analysis


Summary

Turboshaft's Wasm GC optimization phase runs WasmLoadEliminationReducer before Wasm GC typed optimization. The load-elimination analyzer stores operation replacements in a global side table, replacements_, but loop snapshots only preserve alias and memory-table state. When a loop is revisited, the analyzer restores alias and memory snapshots while stale replacement facts from an earlier loop view remain globally visible.

The dangerous consumer is ProcessPhi(). It attempts to simplify phis whose inputs resolve to the same base by calling memory_.ResolveBase() on every phi input. ResolveBase() follows replacements_. If a backedge input is a struct.get whose stale replacement still points at the loop's original large array, the loop-carried array phi is replaced by the large array even though the runtime value later becomes a small array.

That stale phi replacement feeds Wasm GC array-length elimination. The optimized bounds check for array.set uses the original large array's length. At runtime, the actual receiver is a length-1 array, so small[3] = value becomes an out-of-bounds write.

This out-of-bounds write can be used to corrupt adjacent objects in the V8 heap, creating persistent out-of-bounds read/write primitives leading to arbitrary read/write within the V8 heap sandbox. No non-default flags or configuration are required to achieve this. The vulnerability affects stable releases as we have confirmed it on V8 version 14.8.178.14.


Impact

Malicious JavaScript running in the default-configuration V8 engine can achieve arbitrary read/write within the V8 heap sandbox through this load-elimination vulnerability.

This affects the latest stable release and potentially previous stable releases as well.

$ ./out/x64.release/d8 --version
Warning: unknown flag --version.
Try --help for options
V8 version 14.8.178.14
$ ./out/x64.release/d8 ./wasm-gc-wle-arb-rw-stable-14.8.178.14.js
ARB_RW_OK
victimBase=0x12f3354
targetAddr=0x12f34a5 targetElements=0x12f34bd
dblAddr=0x12f35ed originalElements=0x12f3605
read64=0x5566778811223344
write64=0x4142434445464748

The proof-of-concept corrupts the length of a Wasm GC array<i32>, uses the corrupted array as an out-of-bounds i32 window over adjacent V8 heap objects, and retargets a packed-double JavaScript array's elements pointer. Normal JavaScript double-array access then provides the final read64/write64 operations.


Root Cause (High Level)

Wasm load elimination tracks three kinds of state:

1. non-aliasing object facts
2. memory/load-content facts
3. operation replacement facts

Only the first two are included in loop snapshots. The replacement table remains global while loops are revisited.

That is unsafe because replacement facts are not pure structural identities. A replacement can be valid for an early view of a loop and invalid after the loop backedge has been merged. In this vulnerability, an earlier pass records that a struct.get returns the original large array. Later, after loop state has changed, ProcessPhi() still follows that stale struct.get -> large array replacement through ResolveBase().

The optimized graph therefore treats a loop-carried array reference as the large array even when the runtime value is the small array. The resulting bounds check is performed with the large array's length, but the store executes against the small array.

Affected Versions

The vulnerability is present when the following source properties are present:

WasmLoadEliminationReducer runs before Wasm GC typed optimization.
WasmLoadEliminationAnalyzer has a global replacements_ table.
Loop snapshots include alias and memory state but not replacements_.
ProcessPhi() compares phi inputs through memory_.ResolveBase().
ResolveBase() follows replacements_.
ArrayLength replacements are emitted into the optimized graph.

We confirmed exploitability on V8 14.8.178.14 on x64.

The bug is related to the previous fix for Chromium 505481948, but that fix is incomplete for this exploit class. It clears the phi operation's own replacement slot. It does not snapshot or invalidate stale replacement facts belonging to other operations that ResolveBase() can follow while simplifying the phi.

The exploit-shape introducing commit is:

a3853a3901706d0079265335cfb3f1f6ec3cbfd6
[turboshaft][wasm] Load-eliminate AssertNotNull

The earlier prerequisite state model was introduced by:

6af530958779f086ffea75093d9bd67064622ad5
[turboshaft][wasm] Implement WasmLoadElimination

The incomplete mainline fix is:

bb38f8914db99bd3bed6758132b104a9af00ca04
[wasm][turboshaft] Fix Phi handling in Wasm Load Elimination

The M148 cherry-pick of that incomplete fix is:

c3031cebc008e7178ca9fb10b2275922d6bb041c
[M148] [wasm][turboshaft] Fix Phi handling in Wasm Load Elimination


Detailed Analysis

Wasm GC Load Elimination State

The Wasm GC optimization phase runs WasmLoadEliminationReducer before typed GC optimizations:

https://github.com/v8/v8/blob/77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca/src/compiler/turboshaft/wasm-gc-optimize-phase.cc#L18-L19

C
CopyingPhase<WasmLoadEliminationReducer, WasmGCTypedOptimizationReducer>::Run(
    data, temp_zone);

The analyzer owns a global replacement side table:

https://github.com/v8/v8/blob/77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca/src/compiler/turboshaft/wasm-load-elimination-reducer.h#L409-L418

C
WasmLoadEliminationAnalyzer(PipelineData* data, Graph& graph,
                            Zone* phase_zone)
    : graph_(graph),
      phase_zone_(phase_zone),
      replacements_(graph.op_id_count(), phase_zone, &graph),
      non_aliasing_objects_(phase_zone),
      memory_(data, phase_zone, non_aliasing_objects_, replacements_, graph_),
      block_to_snapshot_mapping_(graph.block_count(), phase_zone),
      predecessor_alias_snapshots_(phase_zone),
      predecessor_memory_snapshots_(phase_zone) {}

The loop snapshot does not contain replacements_:

https://github.com/v8/v8/blob/77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca/src/compiler/turboshaft/wasm-load-elimination-reducer.h#L516-L524

C
FixedOpIndexSidetable<OpIndex> replacements_;

AliasTable non_aliasing_objects_;
wle::WasmMemoryContentTable memory_;

struct Snapshot {
  AliasSnapshot alias_snapshot;
  MemorySnapshot memory_snapshot;
};

When loop state is restored or merged, only alias and memory snapshots are restarted:

https://github.com/v8/v8/blob/77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca/src/compiler/turboshaft/wasm-load-elimination-reducer.h#L1086-L1107

C
non_aliasing_objects_.StartNewSnapshot(
    base::VectorOf(predecessor_alias_snapshots_), merge_aliases);
...
memory_.StartNewSnapshot(base::VectorOf(predecessor_memory_snapshots_),
                         merge_memory);

This means stale entries in replacements_ can survive loop revisits even when the corresponding memory facts have been invalidated or merged away.

Stale Replacement Use in ProcessPhi

The vulnerable base resolver follows replacements_ before looking through wrapper operations:

https://github.com/v8/v8/blob/77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca/src/compiler/turboshaft/wasm-load-elimination-reducer.h#L327-L345

C
OpIndex ResolveBase(OpIndex base) {
  while (true) {
    if (replacements_[base] != OpIndex::Invalid()) {
      base = replacements_[base];
      continue;
    }
    Operation& op = graph_.Get(base);
    if (AssertNotNullOp* check = op.TryCast<AssertNotNullOp>()) {
      base = check->object();
      continue;
    }
    if (WasmTypeCastOp* cast = op.TryCast<WasmTypeCastOp>()) {
      base = cast->object();
      continue;
    }
    break;
  }
  return base;
}

ProcessPhi() then uses this resolver to decide whether all phi inputs are the same:

https://github.com/v8/v8/blob/77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca/src/compiler/turboshaft/wasm-load-elimination-reducer.h#L977-L1002

C
void WasmLoadEliminationAnalyzer::ProcessPhi(OpIndex op_idx, const PhiOp& phi) {
  InvalidateAllNonAliasingInputs(phi);

  // For robustness, unset the replacement by default.
  replacements_[op_idx] = OpIndex::Invalid();

  base::Vector<const OpIndex> inputs = phi.inputs();
  ...
  bool same_inputs = true;
  OpIndex first = memory_.ResolveBase(inputs.first());
  for (const OpIndex& input : inputs.SubVectorFrom(1)) {
    if (memory_.ResolveBase(input) != first) {
      same_inputs = false;
      break;
    }
  }
  if (same_inputs) {
    replacements_[op_idx] = first;
  }
}

Clearing replacements_[op_idx] is not sufficient. The stale fact used here belongs to another operation: the struct.get on the loop backedge. ProcessPhi() follows that stale input replacement and incorrectly concludes that the forward edge and backedge are the same large array.

Array-Length Elimination Turns This Into an OOB Write

The stale phi replacement is security-relevant because Wasm array length is also load-eliminated:

https://github.com/v8/v8/blob/77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca/src/compiler/turboshaft/wasm-load-elimination-reducer.h#L816-L831

C
void WasmLoadEliminationAnalyzer::ProcessArrayLength(
    OpIndex op_idx, const ArrayLengthOp& length) {
  static constexpr int offset = wle::kArrayLengthFieldIndex;
  OpIndex existing = memory_.FindLoadLike(length.array(), offset);
  if (existing.valid()) {
    ...
    replacements_[op_idx] = existing;
    return;
  }
  replacements_[op_idx] = OpIndex::Invalid();
  memory_.InsertLoadLike(length.array(), offset, op_idx);
}

Those analyzer replacements are then emitted into the optimized graph:

https://github.com/v8/v8/blob/77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca/src/compiler/turboshaft/wasm-load-elimination-reducer.h#L547-L559

C
#define EMIT_OP(Name)                                                          \
  OpIndex REDUCE_INPUT_GRAPH(Name)(OpIndex ig_index, const Name##Op& op) {     \
    if (v8_flags.turboshaft_wasm_load_elimination) {                           \
      OpIndex ig_replacement_index = analyzer_.Replacement(ig_index);          \
      if (ig_replacement_index.valid()) {                                      \
        OpIndex replacement = Asm().MapToNewGraph(ig_replacement_index);       \
        return replacement;                                                    \
      }                                                                        \
    }                                                                          \
    return Next::ReduceInputGraph##Name(ig_index, op);                         \
  }

EMIT_OP(ArrayLength)

The exploit uses the following loop shape:

JavaScript
cur = big;
holder.field = big;

loop:
  cur[3] = value;
  cur = holder.field;
  holder.field = small;

The runtime values are:

iteration 1: cur == big
iteration 2: cur == big
iteration 3: cur == small

The optimized graph still treats cur as big, so the array.set bounds check uses the large array length. On the third iteration, the actual receiver is the length-1 small array and the store at index 3 is out of bounds.

Exploitation Strategy

The proof-of-concept places three Wasm GC arrays consecutively:

big array
small array
victim array

The stale optimized store writes through small[3]. With the chosen allocation layout, this lands on the following victim array's length field and changes it to 0x400000.

The enlarged victim array is an array<i32>, so it becomes a stable 32-bit read/write window over adjacent V8 heap objects. The exploit then:

  1. Allocates marker JavaScript objects after the victim array.
  2. Scans the OOB i32 window for marker fields and repeated compressed object references.
  3. Computes the victim array element base.
  4. Locates a packed-double JavaScript array and its FixedDoubleArray elements backing store.
  5. Overwrites another packed-double array's elements pointer through the OOB window.
  6. Uses normal JavaScript double element reads/writes as read64 and write64.

The final primitive does not require a V8 native syntax flag or an experimental Wasm flag.

Proof of Concept

The reporting package contains two JavaScript artifacts:

wasm-gc-wle-arb-rw-stable-14.8.178.14.js
wasm-gc-wle-arb-rw-main.js

The stable-release proof was confirmed on V8 14.8.178.14 on x64:

$ ./out/x64.release/d8 --version
V8 version 14.8.178.14
$ ./out/x64.release/d8 ./wasm-gc-wle-arb-rw-stable-14.8.178.14.js
ARB_RW_OK
victimBase=0x12f3354
targetAddr=0x12f34a5 targetElements=0x12f34bd
dblAddr=0x12f35ed originalElements=0x12f3605
read64=0x5566778811223344
write64=0x4142434445464748

The main-branch POC was confirmed on commit 77663b3a0434fe0f8f1b73dbc3fcfe480e2490ca.

It uses the same exploit structure. The only adjustment needed for the stable 14.8.178.14 proof was in the sanity check used while selecting FixedDoubleArray element stores. The original proof assumed the FixedDoubleArray length field was stored as a raw integer and expected 7 and 9. On the stable release, those fields were Smi-tagged, so the scan observed 14 and 18.

The stable proof accepts either encoding:

JavaScript
function fixedArrayLengthMatches(lengthField, expected) {
  if (lengthField === undefined) return false;
  lengthField >>>= 0;
  return lengthField === (expected >>> 0) ||
         lengthField === ((expected << 1) >>> 0);
}

The stable proof uses ordinary JavaScript and WebAssembly APIs. The exploit logic did not change: it still corrupts the Wasm array length, builds the OOB i32 window, retargets a double array's elements pointer, and proves read64/write64 through normal JavaScript array access.

Suggested Fix

The core issue is that replacements_ participates in semantic reasoning across loop revisits but is not part of the loop snapshot state.

The safest fix is to make replacement facts obey the same lifetime rules as the alias and memory tables. In practice, one of the following should be done:

  1. Add replacements_ to the loop snapshot state and merge it conservatively across predecessors.
  2. Clear or invalidate replacement facts when loop snapshots are restored or revisited.
  3. Stop ProcessPhi() from using ResolveBase() results that follow unsnapshotted replacement facts. A safer phi simplification can compare raw inputs, or only strip transparent wrappers such as AssertNotNull / WasmTypeCast, without following the global replacement side table.

Option 3 is the smallest targeted mitigation for this specific exploit path. Option 1 is the more complete design fix if replacement facts are intended to remain available for other cross-block reasoning.

A regression test should cover the loop shape:

JavaScript
cur = big;
holder.field = big;
loop:
  cur[3] = value;
  cur = holder.field;
  holder.field = small;

The test should assert that the optimized Wasm code does not use the original large array length for the later small-array store.


This information is being shared by OpenAI solely for the purpose of improving security and reducing potential harm. This information is presented as-is. We make no representations or warranties, express or implied, as to the completeness, accuracy, or fitness for any particular purpose of the information. This includes, without limitation, any suggestions or ideas presented on how to remedy or mitigate an identified vulnerability, including whether such suggestions or ideas would be effective and/or could have other negative impacts.

OpenAI disclaims any liability for direct or indirect damages arising from the reliance on, or use, misuse, or interpretation of this information. Any references to third-party systems, services, or entities are included solely for identification purposes and do not imply endorsement, responsibility, or attribution.

The original report as published on the Chromium issue tracker, by amyb of OpenAI. 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 loop snapshot does not include the replacement side table, so stale replacement facts from an earlier loop view remain visible and are followed by ResolveBase() during phi simplification.

Impact

Malicious JavaScript running in the default-configuration V8 engine can achieve arbitrary read/write within the V8 heap sandbox.

What the attacker needed

Ability to run JavaScript in V8; no special flags required

The fix

The text suggests adding replacements_ to the loop snapshot state, clearing or invalidating replacement facts on loop revisit, or stopping ProcessPhi() from following unsnapshotted replacement facts; it does not state that a fix was applied.

How it was found

  1. Place three Wasm GC arrays consecutively: big, small, victim.
  2. Run a loop where cur starts as big, then is loaded from holder.field, and holder.field is set to small.
  3. The stale optimized store writes through small[3] and lands on the victim array's length field, changing it to 0x400000.
  4. Use the enlarged victim array as an out-of-bounds i32 window to scan for marker objects and locate a packed-double array's elements pointer.
  5. Overwrite another packed-double array's elements pointer through the OOB window.
  6. Use normal JavaScript double element reads/writes as read64 and write64.

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.

V8 is the JavaScript engine in Chrome. It optimises code by remembering that a value loaded earlier is still the same, but here it remembered an old value across a loop even after the value changed. That made a safety check use the wrong size, so a write went past the end of a small array and could be used to read and write other 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.