Crash [@ js::CheckTracedThing]
A crafted JavaScript script using garbage-collection and out-of-memory testing functions causes the SpiderMonkey engine to crash while tracing a corrupted object pointer during compacting GC. The text shows only a debug-build crash, not a demonstrated attacker capability.
Originally disclosed on Mozilla
- Fixed in 13 days
- Paid in 18 days
- Disclosed after 13 days
Created attachment 9390239
debug stack
'''
gczeal(10);
x = 1;
newGlobal();
oomAtAllocation(8);
try {
newGlobal();
} catch (e) {}
oomAtAllocation(8);
try {
newGlobal();
} catch (e) {}
oomAtAllocation(8);
try {
newGlobal();
} catch (e) {}
newGlobal();
'''
'''
136 if (IsForwarded(thing)) {
(gdb) bt
#0 js::CheckTracedThing<JSObject> (trc=trc@entry=0x7fffffffbb38, thing=0xe5e5e5e5e5e5e5e5) at /home/yksubu/trees/mozilla-central/js/src/gc/Marking.cpp:136
#1 0x0000555557c8c134 in js::gc::TraceEdgeInternal (trc=0x7fffffffbb38, thingp=0x7fffffffbb68, Object=<optimized out>) at /home/yksubu/trees/mozilla-central/js/src/gc/Tracer.h:109
#2 js::TraceManuallyBarrieredEdge<JSObject*> (trc=0x7fffffffbb38, thingp=0x7fffffffbb68, name=<optimized out>) at /home/yksubu/trees/mozilla-central/js/src/gc/Tracer.h:252
#3 js::BaseShape::traceChildren (this=0x1bfc73d6e2e0, trc=0x7fffffffbb38) at /home/yksubu/trees/mozilla-central/js/src/gc/TraceMethods-inl.h:305
#4 UpdateCellPointers<js::BaseShape> (trc=0x7fffffffbb38, cell=0x1bfc73d6e2e0) at /home/yksubu/trees/mozilla-central/js/src/gc/Compacting.cpp:497
#5 UpdateArenaPointersTyped<js::BaseShape> (trc=0x7fffffffbb38, arena=0x1bfc73d6e000) at /home/yksubu/trees/mozilla-central/js/src/gc/Compacting.cpp:503
#6 UpdateArenaPointers (trc=0x7fffffffbb38, arena=0x1bfc73d6e000) at /home/yksubu/trees/mozilla-central/js/src/gc/Compacting.cpp:533
#7 UpdateArenaListSegmentPointers (gc=gc@entry=0x7ffff662f798, arenas=...) at /home/yksubu/trees/mozilla-central/js/src/gc/Compacting.cpp:557
#8 0x0000555557c8bb9d in js::gc::GCRuntime::updateCellPointers (this=this@entry=0x7ffff662f798, zone=zone@entry=0x7ffff65b4000, kinds=...) at /home/yksubu/trees/mozilla-central/js/src/gc/Compacting.cpp:676
#9 0x0000555557c86633 in js::gc::GCRuntime::updateAllCellPointers (this=0x7ffff662f798, trc=0x7fffffffc300, zone=0x7ffff65b4000) at /home/yksubu/trees/mozilla-central/js/src/gc/Compacting.cpp:744
#10 js::gc::GCRuntime::updateZonePointersToRelocatedCells (this=this@entry=0x7ffff662f798, zone=zone@entry=0x7ffff65b4000) at /home/yksubu/trees/mozilla-central/js/src/gc/Compacting.cpp:781
/snip
'''
Run with `--fuzzing-safe --no-threads --no-baseline --no-ion`, compile with `AR=ar sh ../configure --enable-debug --enable-debug-symbols --with-ccache --enable-nspr-build --enable-ctypes --enable-gczeal --enable-rust-simd --disable-tests`, tested on m-c rev fe38c21e5d5b.
Setting s-s to be safe.
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 engine crashes, which in a release build could mean a denial of service, but the text does not demonstrate exploitation beyond the debug crash.
What the attacker needed
Debug build of the engine; ability to run arbitrary JS in the engine
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 crash report for the JavaScript engine inside Firefox. A short script that forces the engine to run garbage collection and run out of memory makes it crash while it is moving objects around in memory. The report does not show how a normal web page could trigger this, so it is mainly useful to the engine developers.
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.