CVE-2022-24791: bytecodealliance wasmtime Use After Free
Vulnerability summary
CVE-2022-24791 is a critical (CVSS 9.8) Use After Free vulnerability in bytecodealliance wasmtime. EPSS estimates a 1.18% chance of exploitation in the next 30 days, higher than 67.2% of scored vulnerabilities.
Timeline
- 31-03-2022PublishedVulnerability first disclosed.
- 23-04-2025Last modifiedVulnerability information updated.
Description
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).
CVSS metrics
5 scores · 4 sources · 2 versions- CVE.orgCNA8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:HDiffers
- OSV · UbuntuEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:HDiffers
- OSV · Crates.ioEcosystem advisory · calculated8.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:HDiffers
EPSS trend
Probability
1.18%
Chance of exploitation in the next 30 days
Percentile
67%
Versus all other CVEs
30-day change
0.00 pp
From 1.18% on 20-09-2026
Known exploited
Compare KEV catalogsNot in any of the 3 tracked catalogs.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root causeAffected systems
Ubuntu7 products
- firefox< 1:1snap1-0ubuntu1
- mozjs38All versions (No fix recorded)
- mozjs52All versions (No fix recorded)
- mozjs68All versions (No fix recorded)
- mozjs78All versions (No fix recorded)
Bytecodealliance1 product
- wasmtime< 0.34.2 | ≥ 0.34.0, < 0.34.2 | ≥ 0.35.0, < 0.35.2
Crates.Io1 product
- wasmtime< 0.34.2 | ≥ 0.35.0, < 0.35.2
Opensuse1 product
- cargo-audit-advisory-db&distro=openSUSE Tumbleweed< 20220420-1.1
4 vendors · 10 products
References
12 links- github.com/bytecodealliance/wasmtime/security/advisories/GHSA-gwc9-348x-qwv2X Refsource CONFIRMREPORTWEBMitigationThird Party Advisory
- github.com/bytecodealliance/wasmtime/commit/666c2554ea0e1728c35aa41178cf235920db888aX Refsource MISCREPORTWEBPatchThird Party Advisory
Show all 12 references
- crates.io/crates/wasmtimePACKAGE