Object corruption in WebAssembly (CVE-2024-3833)
A check in InstallConditionalFeatures only verified the WebAssembly object lacked a 'Function' property before calling InstallTypeReflection, which adds 'type' properties to other objects without checking for duplicates. An attacker could trigger duplicate property installation, causing a debug assertion failure and potentially object corruption.
Originally disclosed on Chrome VRP
- Fix shipped in 36 days
VULNERABILITY DETAILS
In InstallConditionalFeatures, a check is in place to check that the WebAssembly object does not contain the Function property to avoid adding duplicate properties in the object:
void WasmJs::InstallConditionalFeatures(Isolate* isolate,
Handle<NativeContext> context) {
...
// Install Wasm type reflection features (if not already done).
Handle<String> function_string = v8_str(isolate, "Function");
if (!JSObject::HasRealNamedProperty(isolate, webassembly, function_string)
.FromMaybe(true)) {
InstallTypeReflection(isolate, context);
}
}
}
However, InstallTypeReflection also add properties in various other objects, and those are not checked:
void WasmJs::InstallTypeReflection(Isolate* isolate,
Handle<NativeContext> context) {
Handle<JSObject> webassembly(context->wasm_webassembly_object(), isolate);
#define INSTANCE_PROTO_HANDLE(Name) \
handle(JSObject::cast(context->Name()->instance_prototype()), isolate)
InstallFunc(isolate, INSTANCE_PROTO_HANDLE(wasm_table_constructor), "type",
WebAssemblyTableType, 0, false, NONE,
SideEffectType::kHasNoSideEffect);
InstallFunc(isolate, INSTANCE_PROTO_HANDLE(wasm_memory_constructor), "type",
WebAssemblyMemoryType, 0, false, NONE,
SideEffectType::kHasNoSideEffect);
InstallFunc(isolate, INSTANCE_PROTO_HANDLE(wasm_global_constructor), "type",
WebAssemblyGlobalType, 0, false, NONE,
SideEffectType::kHasNoSideEffect);
InstallFunc(isolate, INSTANCE_PROTO_HANDLE(wasm_tag_constructor), "type",
WebAssemblyTagType, 0);
#undef INSTANCE_PROTO_HANDLE
...
In the above, the type property is added to the prototype of wasm_table_constructor etc., without checking that the properties already exists. This leads to issues like 40056206 where duplicate properties are installed on objects.
Thank you very much for your help and please let me know if there is anything I can help. As with 40056206, the bug depends on origin trial and only affects Chrome version 123 onwards after the JSPI origin trial started.
VERSION Chromium version 123.0.6312.58 stable OS: Ubuntu 22.04 LTS
REPRODUCTION CASE
To simulate origin trial token locally, apply the patch trial-token.patch to accept the token from the test cases. Then open wasm_type.html in Chrome. In a debug build, the renderer should crash with a DCHECK failure when duplicated properties are added.
CREDIT INFORMATION Reporter credit: Man Yue Mo of GitHub Security Lab
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 code only checked for an existing 'Function' property on the WebAssembly object before calling InstallTypeReflection, which then added 'type' properties to other objects without verifying they were absent.
Impact
The bug could cause a renderer crash and potentially object corruption, but it only affects Chrome version 123 onwards after the JSPI origin trial started and depends on an origin trial token.
What the attacker needed
Chrome version 123 or later; JSPI origin trial enabled; Origin trial token
How it was found
- Apply the trial-token.patch to accept the origin trial token locally.
- Open wasm_type.html in Chrome.
- Observe a DCHECK failure in a debug build when duplicate properties are added.
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.
WebAssembly is a way to run fast code in the browser. Chrome adds features to WebAssembly objects, but a check only looked at one object before adding properties to others. This could let a malicious page cause a crash or corrupt 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.