Skip to content
Memory corruption Disclosed report Advanced

Crash [@ CoerceInPlace_JitEntry]

A crafted WebAssembly module caused a crash in the JIT entry coercion code when run on a 32-bit build. The reporter did not establish what an attacker could gain beyond the crash itself.

Gary Kwong Follow

Originally disclosed on Mozilla

  • Fixed in 3 days
  • Paid in 5 days
  • Disclosed after 3 days
Text
Created attachment 9168672
stack

'''js
var module = new WebAssembly.Module(wasmTextToBinary('\
  (memory 1) \
  (export "store" (func $func0)) \
  (func $func0 \
    (param $var0 i32) \
    (param $var1 i64) \
    local.get $var0 \
    local.get $var1 \
    i64.store16 offset=16 \
  ) \
'));
for (let i = 0; i < 10; i++) {
  try {
    for (let i = 0; i < 1; i++) {
      x = new WebAssembly.Instance(module);
    }
    for (let i = 0; i < 1; i++) {};
    x.exports["store"]();
  } catch (e) {}
}
'''

Compiled using GCC 9.3.0 and Clang 9 with:

`'CC="clang -m32 -msse2 -mfpmath=sse"' PKG_CONFIG_PATH=<path to your>/pkgconfig AR=ar 'CXX="clang++ -m32 -msse2 -mfpmath=sse"' sh ./configure --target=i686-pc-linux --enable-debug --with-ccache --enable-gczeal --enable-debug-symbols --disable-tests`

Run with:

`--fuzzing-safe --no-threads --no-baseline --no-ion`

Tested on m-c rev d51942b1e2d8. This seems 32-bit only.

Will try to get a bisect soon. I did not set any Cranelift flags. Weird memory addresses are on the stack so setting s-s and sec-bounty? as a start.

:bbouvier seems afk (according to status), so setting needinfo? from :cfallin and :lth prior to the bisection result.

The original report as published on Mozilla's Bugzilla, by Gary Kwong. 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 browser process crashes; the report does not claim memory corruption or code execution, and the issue appears limited to 32-bit builds.

What the attacker needed

32-bit build; victim loads attacker page

How it was found

  1. Build a 32-bit debug browser with the listed compiler flags.
  2. Run it with the listed fuzzing-safe flags.
  3. Load a page that builds the WebAssembly module and calls its exported store function in a loop.
  4. Observe the crash in the JIT entry coercion 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.

WebAssembly lets a web page run compiled code inside the browser. Here a specially shaped module made the browser's internal conversion step crash, but the report only shows a crash, not a way to take over the machine.

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 Gary Kwong

View all

42 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.