Skip to content
Memory corruption Disclosed report Advanced CVE-2024-3857

Assertion failure: this->flags() == 0, at gc/Cell.h:797

A flaky assertion failure occurs in the SpiderMonkey JavaScript shell when running a fuzzing harness that exercises WebAssembly externref coercion, where a garbage-collected cell's flags are unexpectedly non-zero. The text does not claim an attacker can do anything beyond crashing the shell in this debug configuration.

lukas.bernhard Follow

Originally disclosed on Mozilla

  • Fixed in 6 days
  • Paid in 12 days
  • Disclosed after 6 days
Text
Created attachment 9392448
crash.js

Steps to reproduce:

This issue is about a flakey crash in the js-shell invoked as `obj-x86_64-pc-linux-gnu/dist/bin/js --fast-warmup --ion-check-range-analysis --
ion-extra-checks --fuzzing-safe --disable-oom-functions --enable-new-set-methods crash.js`.
I captured a pernos.co trace on my laptop on git commit 6a2a2a52d7e544a2fd5678d04991a7e78b694f22 (which is a couple of days old). On the server, the issue reproduces reliably even on the latest git commit f63ca2952da98e0817bdae0ddf1314281a497106.
Depending on your machine should be able to reproduce locally.

https://pernos.co/debug/Nmk1pGH10Siby2PktNMINw/index.html

'''
#0  js::gc::CellWithTenuredGCPointer<js::gc::Cell, js::Shape>::headerPtr (this=<optimized out>)
    at js/src/gc/Cell.h:797
#1  JSObject::shape (this=<optimized out>) at js/src/vm/JSObject.h:93
#2  JSObject::getClass (this=<optimized out>) at js/src/vm/JSObject.h:114
#3  JSObject::is<WasmValueBox> (this=<optimized out>) at js/src/vm/JSObject.h:492
#4  js::wasm::AnyRef::toJSValue (this=<optimized out>) at js/src/wasm/WasmAnyRef.cpp:119
#5  0x00005722f405482f in ToJSValue_externref<js::wasm::NoDebug> (src=0x5722f0c6e5de, dst=..., cx=<optimized out>)
    at js/src/wasm/WasmValue.cpp:757
#6  js::wasm::ToJSValue<js::wasm::NoDebug> (cx=cx@entry=0x7ded5833d200, src=src@entry=0x7ffeab2c6be0, type=..., dst=..., 
    level=level@entry=js::wasm::CoercionLevel::Spec) at js/src/wasm/WasmValue.cpp:820
#7  0x00005722f4053526 in js::wasm::ToJSValue<js::wasm::NoDebug> (cx=0x7ded5833d200, src=src@entry=0x7ffeab2c6be0, type=..., 
    dst=..., level=level@entry=js::wasm::CoercionLevel::Spec) at js/src/wasm/WasmValue.cpp:842
#8  0x00005722f2508fd1 in js::wasm::Instance::callImport (this=0x7ded5397c300, cx=0x7ded5833d200, 
    funcImportIndex=<optimized out>, argc=<optimized out>, argv=0x7ffeab2c6be0)
    at js/src/wasm/WasmInstance.cpp:264
#9  0x00005722f250a424 in js::wasm::Instance::callImport_general (instance=0x7ded586008e0 <_IO_stdfile_2_lock>, 
    funcImportIndex=1482684227, argc=-184039728, argv=0x0) at js/src/wasm/WasmInstance.cpp:349
#10 0x00001e165f9e3ee3 in ?? ()
#11 0x00000f1bebdfff60 in ?? ()
#12 0x3e09a6bdc70b2d00 in ?? ()
#13 0x00007ffeab2c6c80 in ?? ()
'''

The original report as published on Mozilla's Bugzilla, by lukas.bernhard. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 shell crashes with an assertion failure; the text does not describe any security impact beyond that, and it is a debug-only check.

What the attacker needed

A debug build of the js-shell; the attached crash script; specific fuzzing flags

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 report about a crash inside a JavaScript engine's testing shell, not a website. The engine hit an internal consistency check (an assertion) while converting a WebAssembly value back into a JavaScript value, meaning its own bookkeeping about memory was in an unexpected state. The report only shows a crash in a developer build, not a way for an outsider to attack anything.

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 lukas.bernhard

View all

16 more disclosed reports, best first.

More from Mozilla

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.