CVE-2022-24791Use after free in Wasmtime
Wasmtime is a standalone JIT-style runtime for WebAssembly, using Cranelift. There is a use after free vulnerability in Wasmtime when both running Wasm that uses externrefs and enabling epoch interruption in Wasmtime. If you are not explicitly enabling epoch interruption (it is disabled by default) then you are not affected. If you are explicitly disabling the Wasm reference types proposal (it is enabled by default) then you are also not affected. The use after free is caused by Cranelift failing to emit stack maps when there are safepoints inside cold blocks. Cold blocks occur when epoch interruption is enabled. Cold blocks are emitted at the end of compiled functions, and change the order blocks are emitted versus defined. This reordering accidentally caused Cranelift to skip emitting some stack maps because it expected to emit the stack maps in block definition order, rather than block emission order. When Wasmtime would eventually collect garbage, it would fail to find live references on the stack because of the missing stack maps, think that they were unreferenced garbage, and therefore reclaim them. Then after the collection ended, the Wasm code could use the reclaimed-too-early references, which is a use after free. Patches have been released in versions 0.34.2 and 0.35.2, which fix the vulnerability. All Wasmtime users are recommended to upgrade to these patched versions. If upgrading is not an option for you at this time, you can avoid the vulnerability by either: disabling the Wasm reference types proposal, config.wasm_reference_types(false); or by disabling epoch interruption if you were previously enabling it. config.epoch_interruption(false).
What to do
Fixed builds are available from Ubuntu, crates.io: see the table below for the fixed version per release.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | UBUNTU-CVE-2022-24791 | |
| Ubuntu 22.04 | firefox | Fixed | 1:1snap1-0ubuntu1 | UBUNTU-CVE-2022-24791 |
| Ubuntu 22.04 | mozjs78 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | UBUNTU-CVE-2022-24791 | |
| Ubuntu 22.04 | mozjs91 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | UBUNTU-CVE-2022-24791 | |
| Ubuntu 22.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | UBUNTU-CVE-2022-24791 | |
| Ubuntu 20.04 | firefox | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | ||
| Ubuntu 20.04 | mozjs52 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | UBUNTU-CVE-2022-24791 | |
| Ubuntu 20.04 | mozjs68 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | UBUNTU-CVE-2022-24791 | |
| Ubuntu 20.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | ||
| Ubuntu 18.04 | firefox | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | ||
| Ubuntu 18.04 | mozjs38 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | UBUNTU-CVE-2022-24791 | |
| Ubuntu 18.04 | mozjs52 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | UBUNTU-CVE-2022-24791 | |
| Ubuntu 18.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | ||
| Ubuntu 16.04 | firefox | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | ||
| Ubuntu 16.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | ||
| Ubuntu 14.04 | firefox | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | ||
| Ubuntu 14.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine The wasmtime code appears to be vendored into firefox/thunderbird/mozjs etc | ||
| crates.io library | wasmtime | Fixed | 0.34.2 | RUSTSEC-2022-0099 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- bytecodealliance wasmtime: affected: < 0.34.2, >= 0.35.0, < 0.35.2
References
- https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-gwc9-348x-qwv2
- https://github.com/bytecodealliance/wasmtime/commit/666c2554ea0e1728c35aa41178cf235920db888a
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.