CVEfocus › CVE database › CVE-2022-24791

CVE-2022-24791Use after free in Wasmtime

CVSS 8.1 HighEPSS 1.2% (higher than 67% of CVEs)Published 2022-03-31Updated 2025-04-23Assigner: GitHub_M

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

CWE-416

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

2Fixed
16Will not fix

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.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 24.04thunderbirdWill 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.04firefoxFixed1:1snap1-0ubuntu1UBUNTU-CVE-2022-24791
Ubuntu 22.04mozjs78Will 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.04mozjs91Will 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.04thunderbirdWill 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.04firefoxWill 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.04mozjs52Will 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.04mozjs68Will 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.04thunderbirdWill 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.04firefoxWill 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.04mozjs38Will 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.04mozjs52Will 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.04thunderbirdWill 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.04firefoxWill 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.04thunderbirdWill 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.04firefoxWill 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.04thunderbirdWill 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 librarywasmtimeFixed0.34.2RUSTSEC-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.

References

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.