Type Confusion in V8 (CVE-2024-5158)
The V8 engine's SetPrototype function only checked if the target object was a WasmObject, not the prototype value, allowing a WasmObject to be set as a prototype. When Array.prototype.concat traversed the prototype chain, it cast the WasmObject to a JSObject, causing a type confusion that could be exploited because WasmObject fields are controllable.
Originally disclosed on Chrome VRP
- Fix shipped in 16 days
Steps to reproduce the problem
- Download debug v8 from: gs://v8-asan/linux-debug/d8-linux-debug-v8-component-93712.zip
- Run:
./d8 poc.js
$ cd /path/to/v8/
$ /tmp/d8-linux-debug-v8-component-93712/d8 /tmp/poc.js
#
# Fatal error in gen/torque-generated/src/objects/js-objects-tq-inl.inc, line 67
# Check failed: !v8::internal::v8_flags.enable_slow_asserts.value() || (IsJSObject_NonInline(*this)).
#
#
#
#FailureMessage Object: 0x7ffd386ecee0
==== C stack trace ===============================
/tmp/d8-linux-debug-v8-component-93712/libv8_libbase.so(v8::base::debug::StackTrace::StackTrace()+0x13) [0x7ff68426fd83]
/tmp/d8-linux-debug-v8-component-93712/libv8_libplatform.so(+0x18e0d) [0x7ff684218e0d]
/tmp/d8-linux-debug-v8-component-93712/libv8_libbase.so(V8_Fatal(char const*, int, char const*, ...)+0x17d) [0x7ff684250f7d]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x25721f2) [0x7ff6813721f2]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x2660ffc) [0x7ff681460ffc]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x26589d3) [0x7ff6814589d3]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(v8::internal::Builtin_ArrayConcat(int, unsigned long*, v8::internal::Isolate*)+0x7d) [0x7ff68145800d]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x1d7bb7d) [0x7ff680b7bb7d]
[1] 1575121 trace trap /tmp/d8-linux-debug-v8-component-93712/d8 /tmp/poc2.js
Problem Description
Root Cause Analysis
JSReceiver::SetPrototype only checks if object is a WasmObject, not if value is a WasmObject, so we can register a WasmObject as Prototype for it.
Maybe<bool> JSReceiver::SetPrototype(Isolate* isolate,
Handle<JSReceiver> object,
Handle<Object> value, bool from_javascript,
ShouldThrow should_throw) {
if (IsWasmObject(*object)) {
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
}
if (IsJSProxy(*object)) {
return JSProxy::SetPrototype(isolate, Handle<JSProxy>::cast(object), value,
from_javascript, should_throw);
}
return JSObject::SetPrototype(isolate, Handle<JSObject>::cast(object), value,
from_javascript, should_throw);
}
But some call sites of PrototypeIterator::GetCurrent function don't notice this, it will directly cast the prototype to T type object when it traverses the prototype. At this time [1] in Array Concat implementation, if caller use iter.GetCurrent<JSObject>() , it will cast the prototype of type WasmObject directly to JSObject , but the two are inconsistent, which will lead to type confusion and trigger DCHECK.
inline bool HasOnlySimpleElements(Isolate* isolate,
Tagged<JSReceiver> receiver) {
DisallowGarbageCollection no_gc;
PrototypeIterator iter(isolate, receiver, kStartAtReceiver);
for (; !iter.IsAtEnd(); iter.Advance()) {
if (IsJSProxy(iter.GetCurrent())) return false;
Tagged<JSObject> current = iter.GetCurrent<JSObject>(); // <---- [1]
if (!HasSimpleElements(current)) return false;
}
return true;
}
This vulnerability allows an arbitrary Wasm Object to be confused with a JSObject. And most of the data fields in Wasm object (especially in WasmStruct) are controllable.
Summary
Type Confusion between WasmObject and JSObject in Array Concat
Custom Questions
Type of crash:
tab
Reporter credit:
Zhenghang Xiao (@Kipreyyy)
Additional Data
Category: Security
Chrome Channel: Not sure
Regression: N/A
Context
V8 is the JavaScript engine used by Chrome, and it also hosts WebAssembly. The engine has two object families that are meant to stay separate: ordinary JavaScript objects (JSObject) and WebAssembly objects (WasmObject). The report describes a type confusion between the two, reached through Array.prototype.concat, tracked as CVE-2024-5158 and rated high severity. It was reported through the Chrome VRP and paid a bounty of 10,000 USD; the researcher is credited as Zhenghang Xiao (@Kipreyyy).
The feature involved is the prototype chain. Every JavaScript object can have a prototype, and engine code frequently walks that chain with PrototypeIterator, casting each entry to an expected type. The bug is that a WasmObject can be installed as a prototype, and one such walk in the Array concat implementation casts it to JSObject without checking.
Setup
The researcher used a debug build of V8, published at the following path:
gs://v8-asan/linux-debug/d8-linux-debug-v8-component-93712.zip
The only tool needed is the d8 shell from that archive and a proof of concept script, poc.js. The crash shown is a Check failed abort in a debug build.
Finding it
The starting point is JSReceiver::SetPrototype. It refuses to operate on a WasmObject when the object whose prototype is being set is a Wasm object, but it never checks the value being installed as the prototype. That asymmetry means a WasmObject can be registered as the prototype of an ordinary object.
Maybe<bool> JSReceiver::SetPrototype(Isolate* isolate,
Handle<JSReceiver> object,
Handle<Object> value, bool from_javascript,
ShouldThrow should_throw) {
if (IsWasmObject(*object)) {
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
}
if (IsJSProxy(*object)) {
return JSProxy::SetPrototype(isolate, Handle<JSProxy>::cast(object), value,
from_javascript, should_throw);
}
return JSObject::SetPrototype(isolate, Handle<JSObject>::cast(object), value,
from_javascript, should_throw);
}
The guard only inspects object. Nothing in this function rejects a value that is a WasmObject, so the invariant that prototypes are ordinary JS receivers is not enforced here.
The researcher then looked at consumers of the prototype chain. Some call sites of PrototypeIterator::GetCurrent do not account for this possibility: when the iterator walks the chain, they cast the current entry directly to the expected type T. In the Array concat path, the helper HasOnlySimpleElements asks for iter.GetCurrent<JSObject>(). If the chain contains a WasmObject, that cast produces a JSObject view of memory that is not a JSObject, which is the type confusion. In the debug build the mismatch is caught immediately by a check on the cast, which is what makes the bug visible.
Exploitation
Step 1: obtain the debug build
Download the ASan debug component build from the bucket path given in the report:
gs://v8-asan/linux-debug/d8-linux-debug-v8-component-93712.zip
This is the exact build the researcher used; the crash output below refers to paths inside it.
Step 2: run the proof of concept
$ cd /path/to/v8/
$ /tmp/d8-linux-debug-v8-component-93712/d8 /tmp/poc.js
The script is run with the d8 shell from the extracted archive. The report does not include the contents of poc.js; what it shows is the resulting abort.
Step 3: observe the crash
#
# Fatal error in gen/torque-generated/src/objects/js-objects-tq-inl.inc, line 67
# Check failed: !v8::internal::v8_flags.enable_slow_asserts.value() || (IsJSObject_NonInline(*this)).
#
#
#
#FailureMessage Object: 0x7ffd386ecee0
==== C stack trace ===============================
/tmp/d8-linux-debug-v8-component-93712/libv8_libbase.so(v8::base::debug::StackTrace::StackTrace()+0x13) [0x7ff68426fd83]
/tmp/d8-linux-debug-v8-component-93712/libv8_libplatform.so(+0x18e0d) [0x7ff684218e0d]
/tmp/d8-linux-debug-v8-component-93712/libv8_libbase.so(V8_Fatal(char const*, int, char const*, ...)+0x17d) [0x7ff684250f7d]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x25721f2) [0x7ff6813721f2]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x2660ffc) [0x7ff681460ffc]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x26589d3) [0x7ff6814589d3]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(v8::internal::Builtin_ArrayConcat(int, unsigned long*, v8::internal::Isolate*)+0x7d) [0x7ff68145800d]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x1d7bb7d) [0x7ff680b7bb7d]
[1] 1575121 trace trap /tmp/d8-linux-debug-v8-component-93712/d8 /tmp/poc2.js
The failing check is IsJSObject_NonInline(*this) in the Torque-generated inline accessors for JS objects: the object being treated as a JSObject is not one. The stack trace places the failure under Builtin_ArrayConcat, which confirms that the concat builtin is the path that reached the bad cast. The process terminates with a trace trap. Note that the shell line at the bottom of the output names poc2.js, while the command above runs poc.js; the report shows both names.
Root cause
The defect is a missing type check on the prototype value in JSReceiver::SetPrototype. The function rejects a WasmObject as the receiver but accepts one as the prototype, so the prototype chain can contain an object of a type that the rest of the engine does not expect there.
Consumers of the chain rely on that expectation. HasOnlySimpleElements walks from the receiver with PrototypeIterator and, for each entry, checks only for JSProxy before casting:
inline bool HasOnlySimpleElements(Isolate* isolate,
Tagged<JSReceiver> receiver) {
DisallowGarbageCollection no_gc;
PrototypeIterator iter(isolate, receiver, kStartAtReceiver);
for (; !iter.IsAtEnd(); iter.Advance()) {
if (IsJSProxy(iter.GetCurrent())) return false;
Tagged<JSObject> current = iter.GetCurrent<JSObject>(); // <---- [1]
if (!HasSimpleElements(current)) return false;
}
return true;
}
The IsJSProxy test is the only filter, and it does not cover WasmObject. The unchecked GetCurrent<JSObject>() at the marked line then reinterprets the WasmObject as a JSObject. In a debug build the cast's own assertion fires; in a release build the same confusion would let the engine read and use WasmObject memory through JSObject field layouts. The report notes that most data fields in a Wasm object, especially in WasmStruct, are controllable, which is what makes the confusion interesting beyond the assertion failure.
Impact
The report's summary is a type confusion between WasmObject and JSObject in Array concat. It allows an arbitrary Wasm object to be confused with a JSObject, and because much of a Wasm object's data, particularly in WasmStruct, is attacker-controllable, the confused view exposes data the engine will interpret as JS object fields. The report does not describe a full exploit chain or a release-mode primitive beyond this confusion; the demonstrated result is the debug assertion in Builtin_ArrayConcat.
Fix
The report does not state which change was made. The defect it identifies is the missing check on the prototype value in JSReceiver::SetPrototype: rejecting a WasmObject there, in the same way the receiver is rejected, would stop such an object from entering the prototype chain at all. Hardening the PrototypeIterator consumers, so that each cast is guarded by a type check rather than only a JSProxy check, addresses the same class of mistake at the point of use.
Variants to test
- Other
PrototypeIteratorconsumers. Any code that callsGetCurrent<T>()after filtering only for proxies is a candidate. A positive result is a debug assertion on the cast, or a release-mode misbehaviour, when aWasmObjectsits in the chain. - Other paths that install a prototype. Look for entry points that reach
JSReceiver::SetPrototypeor its equivalents with a value the engine does not validate. A positive result is aWasmObject(or another opaque type) becoming the prototype of an ordinary object. - Other builtins that inspect elements or the prototype chain, such as code sharing
HasOnlySimpleElements. A positive result is the sameIsJSObject_NonInlinefailure under a different builtin in the stack trace. - Different Wasm object kinds, in particular
WasmStruct, whose fields the report describes as controllable. A positive result is a confused read whose values track the fields set from Wasm.
Hunting notes
This kind of bug hides at the boundary between two object models in one engine, and in the helpers that walk shared structures such as the prototype chain. The signal in this report is a guard that checks one side of an operation but not the other: SetPrototype validates the receiver and ignores the value. When reading engine code, compare each check against the invariant it is supposed to protect, and then find the consumers that assume the invariant holds.
Debug and ASan builds are the practical way to surface these bugs: the failing DCHECK names the exact inline accessor and the builtin in the stack trace, which is enough to point at the confused type and the code path. The report names the confused types, the builtin that reaches the cast, and notes that Wasm object fields, especially in WasmStruct, are controllable.
What happened, in plain words
Chrome runs JavaScript using a piece of software called V8. V8 is the JavaScript engine: the part of the browser that reads the code on a web page and actually executes it. V8 also runs WebAssembly, a second, lower-level language that pages can use for heavy work.
Inside V8 there are two different kinds of object that are supposed to stay apart. One kind is an ordinary JavaScript object, written JSObject in the engine's source code. The other is a WebAssembly object, written WasmObject. They are laid out differently in memory, so treating one as the other is a mistake.
This report describes exactly that mistake, called a type confusion, and it is reached through Array.prototype.concat, the built-in JavaScript function that joins arrays together. The bug is tracked as CVE-2024-5158 and rated high severity. It was reported through the Chrome VRP, Google's bug bounty programme for Chrome, and paid a bounty of 10,000 USD. The researcher is credited as Zhenghang Xiao (@Kipreyyy).
The feature at the centre of it is the prototype chain. Every JavaScript object can have a prototype: another object it inherits behaviour from. Engine code often walks that chain, step by step, using a helper called PrototypeIterator, and assumes every entry it meets is of an expected type. The bug is that a WasmObject can be installed as a prototype, and one such walk, inside the Array concat implementation, casts it to JSObject without checking.
Setup
The researcher used a debug build of V8, published at the following path:
gs://v8-asan/linux-debug/d8-linux-debug-v8-component-93712.zip
A few terms here. A debug build is a version of the engine compiled with extra internal checks switched on, so mistakes are caught loudly instead of silently. AddressSanitizer, or ASan, is a tool that watches memory use and reports problems. A component build is a build split into separate shared libraries rather than one big file. The gs:// prefix means the file lives in a Google Cloud Storage bucket.
The only tool needed is the d8 shell from that archive and a proof of concept script, poc.js. d8 is V8's own command-line shell: a small program that runs JavaScript without a browser around it, which makes testing the engine much easier. A proof of concept script is a short program written only to demonstrate that a bug exists.
The crash shown is a Check failed abort in a debug build. A DCHECK is an internal self-check that only exists in debug builds; when it fails, the program stops on purpose.
Finding it
The starting point is JSReceiver::SetPrototype. In JavaScript, setting an object's prototype is a normal operation, and this function is where the engine performs it. It refuses to operate on a WasmObject when the object whose prototype is being set is a Wasm object, but it never checks the value being installed as the prototype. That asymmetry means a WasmObject can be registered as the prototype of an ordinary object.
Maybe<bool> JSReceiver::SetPrototype(Isolate* isolate,
Handle<JSReceiver> object,
Handle<Object> value, bool from_javascript,
ShouldThrow should_throw) {
if (IsWasmObject(*object)) {
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
}
if (IsJSProxy(*object)) {
return JSProxy::SetPrototype(isolate, Handle<JSProxy>::cast(object), value,
from_javascript, should_throw);
}
return JSObject::SetPrototype(isolate, Handle<JSObject>::cast(object), value,
from_javascript, should_throw);
}
Line by line:
- The function takes the engine instance (
isolate), theobjectwhose prototype is being changed, the new prototypevalue, a flag saying whether the request came from JavaScript, and a flag saying whether errors should be thrown. if (IsWasmObject(*object))asks: is the object being modified a Wasm object? If so, the next lines return a failure with aTypeErrorsaying Wasm objects are opaque, meaning they cannot be inspected or modified this way.if (IsJSProxy(*object))handles a special kind of object called a proxy, which forwards operations to another object, and passes the work to the proxy-specific version of the function.- The final
returnhandles the ordinary case: it castsobjecttoJSObjectand callsJSObject::SetPrototype.
The guard only inspects object. Nothing in this function rejects a value that is a WasmObject, so the invariant that prototypes are ordinary JS receivers is not enforced here. An invariant is simply a rule the code assumes always holds.
The researcher then looked at consumers of the prototype chain. Some call sites of PrototypeIterator::GetCurrent do not account for this possibility: when the iterator walks the chain, they cast the current entry directly to the expected type T. A cast is an instruction to the program to treat a piece of data as a particular type; if the data is not really that type, the result is nonsense. In the Array concat path, the helper HasOnlySimpleElements asks for iter.GetCurrent<JSObject>(). If the chain contains a WasmObject, that cast produces a JSObject view of memory that is not a JSObject, which is the type confusion. In the debug build the mismatch is caught immediately by a check on the cast, which is what makes the bug visible.
Exploitation
Step 1: obtain the debug build
Download the ASan debug component build from the bucket path given in the report:
gs://v8-asan/linux-debug/d8-linux-debug-v8-component-93712.zip
This is the exact build the researcher used; the crash output below refers to paths inside it. Using the same build matters because internal checks and memory layouts differ between versions, so a crash seen on one build may not reproduce on another.
Step 2: run the proof of concept
$ cd /path/to/v8/
$ /tmp/d8-linux-debug-v8-component-93712/d8 /tmp/poc.js
Line by line:
cd /path/to/v8/moves the terminal into the V8 source directory. The path is a placeholder for wherever the researcher keeps the code.- The second line runs the
d8program from the extracted archive, passing it the script/tmp/poc.js. The$at the start of each line is the shell prompt, not part of the command.
The script is run with the d8 shell from the extracted archive. The report does not include the contents of poc.js; what it shows is the resulting abort.
Step 3: observe the crash
#
# Fatal error in gen/torque-generated/src/objects/js-objects-tq-inl.inc, line 67
# Check failed: !v8::internal::v8_flags.enable_slow_asserts.value() || (IsJSObject_NonInline(*this)).
#
#
#
#FailureMessage Object: 0x7ffd386ecee0
==== C stack trace ===============================
/tmp/d8-linux-debug-v8-component-93712/libv8_libbase.so(v8::base::debug::StackTrace::StackTrace()+0x13) [0x7ff68426fd83]
/tmp/d8-linux-debug-v8-component-93712/libv8_libplatform.so(+0x18e0d) [0x7ff684218e0d]
/tmp/d8-linux-debug-v8-component-93712/libv8_libbase.so(V8_Fatal(char const*, int, char const*, ...)+0x17d) [0x7ff684250f7d]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x25721f2) [0x7ff6813721f2]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x2660ffc) [0x7ff681460ffc]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x26589d3) [0x7ff6814589d3]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(v8::internal::Builtin_ArrayConcat(int, unsigned long*, v8::internal::Isolate*)+0x7d) [0x7ff68145800d]
/tmp/d8-linux-debug-v8-component-93712/libv8.so(+0x1d7bb7d) [0x7ff680b7bb7d]
[1] 1575121 trace trap /tmp/d8-linux-debug-v8-component-93712/d8 /tmp/poc2.js
What each part means:
- The
Fatal errorline names the file and line where the engine gave up:gen/torque-generated/src/objects/js-objects-tq-inl.inc, line 67. Torque is a language Google uses to generate parts of V8's code automatically, so this file was produced by a tool rather than written by hand. - The
Check failedline is the assertion itself:IsJSObject_NonInline(*this)must be true, meaning the object really is a JS object. It is not, so the check fails. FailureMessage Objectis an internal address the engine prints for debugging.- The
C stack tracelists the chain of function calls that led to the failure, most recent first. The interesting entry isBuiltin_ArrayConcat, the built-in implementation of arrayconcat. The other entries are internal helpers and library functions. - The last line shows the operating system reporting that the process died with a
trace trap, which is how a deliberate abort appears from the shell.
The failing check is IsJSObject_NonInline(*this) in the Torque-generated inline accessors for JS objects: the object being treated as a JSObject is not one. The stack trace places the failure under Builtin_ArrayConcat, which confirms that the concat builtin is the path that reached the bad cast. The process terminates with a trace trap. Note that the shell line at the bottom of the output names poc2.js, while the command above runs poc.js; the report shows both names.
Root cause
The defect is a missing type check on the prototype value in JSReceiver::SetPrototype. The function rejects a WasmObject as the receiver but accepts one as the prototype, so the prototype chain can contain an object of a type that the rest of the engine does not expect there.
Consumers of the chain rely on that expectation. HasOnlySimpleElements walks from the receiver with PrototypeIterator and, for each entry, checks only for JSProxy before casting:
inline bool HasOnlySimpleElements(Isolate* isolate,
Tagged<JSReceiver> receiver) {
DisallowGarbageCollection no_gc;
PrototypeIterator iter(isolate, receiver, kStartAtReceiver);
for (; !iter.IsAtEnd(); iter.Advance()) {
if (IsJSProxy(iter.GetCurrent())) return false;
Tagged<JSObject> current = iter.GetCurrent<JSObject>(); // <---- [1]
if (!HasSimpleElements(current)) return false;
}
return true;
}
Line by line:
- The function is declared
inline, a hint to the compiler to paste it into callers for speed, and returns abool, true or false. DisallowGarbageCollection no_gc;temporarily forbids the garbage collector from moving objects while this code runs, so the references stay valid.PrototypeIterator iter(isolate, receiver, kStartAtReceiver);creates the iterator, starting at the receiver itself rather than at its prototype.- The
forloop advances through the chain untiliter.IsAtEnd()is true. if (IsJSProxy(iter.GetCurrent())) return false;is the only filter: if the current entry is a proxy, stop and report false.Tagged<JSObject> current = iter.GetCurrent<JSObject>();is the marked line[1]: it takes the current entry and casts it toJSObjectwith no check.if (!HasSimpleElements(current)) return false;inspects the object's elements and stops if they are not simple.- If the loop finishes, the function returns true.
The IsJSProxy test is the only filter, and it does not cover WasmObject. The unchecked GetCurrent<JSObject>() at the marked line then reinterprets the WasmObject as a JSObject. In a debug build the cast's own assertion fires; in a release build the same confusion would let the engine read and use WasmObject memory through JSObject field layouts. The report notes that most data fields in a Wasm object, especially in WasmStruct, are controllable, which is what makes the confusion interesting beyond the assertion failure. WasmStruct is a WebAssembly data structure whose fields the report describes as controllable.
Impact
The report's summary is a type confusion between WasmObject and JSObject in Array concat. It allows an arbitrary Wasm object to be confused with a JSObject, and because much of a Wasm object's data, particularly in WasmStruct, is attacker-controllable, the confused view exposes data the engine will interpret as JS object fields. The report does not describe a full exploit chain or a release-mode primitive beyond this confusion; the demonstrated result is the debug assertion in Builtin_ArrayConcat.
Fix
The report does not state which change was made. The defect it identifies is the missing check on the prototype value in JSReceiver::SetPrototype: rejecting a WasmObject there, in the same way the receiver is rejected, would stop such an object from entering the prototype chain at all. Hardening the PrototypeIterator consumers, so that each cast is guarded by a type check rather than only a JSProxy check, addresses the same class of mistake at the point of use.
Variants to test
- Other
PrototypeIteratorconsumers. Any code that callsGetCurrent<T>()after filtering only for proxies is a candidate. A positive result is a debug assertion on the cast, or a release-mode misbehaviour, when aWasmObjectsits in the chain. - Other paths that install a prototype. Look for entry points that reach
JSReceiver::SetPrototypeor its equivalents with a value the engine does not validate. A positive result is aWasmObject(or another opaque type) becoming the prototype of an ordinary object. - Other builtins that inspect elements or the prototype chain, such as code sharing
HasOnlySimpleElements. A positive result is the sameIsJSObject_NonInlinefailure under a different builtin in the stack trace. - Different Wasm object kinds, in particular
WasmStruct, whose fields the report describes as controllable. A positive result is a confused read whose values track the fields set from Wasm.
Hunting notes
This kind of bug hides at the boundary between two object models in one engine, and in the helpers that walk shared structures such as the prototype chain. The signal in this report is a guard that checks one side of an operation but not the other: SetPrototype validates the receiver and ignores the value. When reading engine code, compare each check against the invariant it is supposed to protect, and then find the consumers that assume the invariant holds.
Debug and ASan builds are the practical way to surface these bugs: the failing DCHECK names the exact inline accessor and the builtin in the stack trace, which is enough to point at the confused type and the code path. The report establishes impact by naming the confused types, the builtin that reaches the cast, and the fact that Wasm object fields, especially WasmStruct, are controllable, which is what turns an assertion into a memory-safety concern.
Glossary
- V8: the JavaScript engine inside Chrome that reads and runs the JavaScript on a page.
- WebAssembly: a low-level language that runs in the browser alongside JavaScript, used for performance-heavy code.
- JavaScript engine: the software component that executes JavaScript code.
- JSObject: V8's internal representation of an ordinary JavaScript object.
- WasmObject: V8's internal representation of a WebAssembly object.
- Type confusion: a bug where data of one type is treated as another type, so the program misreads it.
- Prototype: an object another object inherits behaviour from in JavaScript.
- Prototype chain: the sequence of prototypes followed from an object upwards.
- PrototypeIterator: a V8 helper that walks the prototype chain one entry at a time.
- Cast: telling the program to treat a piece of data as a particular type.
- Array.prototype.concat: the built-in JavaScript function that joins arrays together.
- Builtin: a function implemented inside the engine rather than in page code.
- CVE: a public identifier for a known security vulnerability.
- Chrome VRP: Google's Vulnerability Reward Program, which pays for Chrome security reports.
- Bounty: the money paid for a valid security report.
- Severity: a rating of how serious a vulnerability is.
- Debug build: a version of software compiled with extra internal checks enabled.
- Release build: the normal version shipped to users, without those extra checks.
- AddressSanitizer (ASan): a tool that detects memory errors while a program runs.
- Component build: a build split into several shared libraries instead of one file.
- d8: V8's command-line shell for running JavaScript outside a browser.
- Proof of concept (poc): a short script that demonstrates a bug exists.
- DCHECK / Check failed: an internal self-check that only runs in debug builds and aborts when it fails.
- Assertion: a statement in code that something must be true, checked at runtime.
- Abort / trace trap: the deliberate termination of a program, reported by the operating system.
- Stack trace: the list of function calls that led to a point in the program.
- Torque: a language Google uses to generate parts of V8's code automatically.
- Inline accessor: a small generated function that reads or checks a field of an object.
- Isolate: V8's term for one independent instance of the engine.
- JSProxy: a JavaScript object that forwards operations to another object.
- Invariant: a rule the code assumes always holds.
- WasmStruct: a WebAssembly data structure whose fields are filled in by WebAssembly code.
- Memory safety: the property that a program never reads or writes memory it should not.
- Primitive: a basic building block of an exploit, such as a way to read or write memory.
- Opaque: something that cannot be inspected or modified from outside.