CVE-2022-24791

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

Severity
HIGH
CVSS v3
8.1
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H · source cna
Exploit chance (EPSS)
1.179%
chance of exploitation in the next 30 days
higher than 68.2% of scored CVEs · 2026-11-17
CISA KEV
Not listed
Public exploit code
None public
Exploit references (NVD and CNA): 0
Metasploit modules: 0
Nuclei templates: 0

Weakness

CISA SSVC decision points

Exploitationnone
Automatableno
Technical impacttotal
Scored2025-04-23

Timeline

  1. 2022-03-31Published by the CNA23:00 UTC
  2. 2022-04-01GitHub advisory published (GHSA-gwc9-348x-qwv2)1 day after publication
  3. 2025-04-23CISA SSVC decision recorded1119 days after publication

The timeline shows what already happened. To be told when this CVE changes next, watch it from the API.

Exploit and advisory records

GitHub advisory GHSA-gwc9-348x-qwv2, affected packages:

PackageVulnerable versionsFixed in
crates.io wasmtimebefore 0.34.20.34.2
crates.io wasmtimefrom 0.35.0 before 0.35.20.35.2

Affected products

Products listed as vulnerable. Upgrade to the version under "Fixed in", or a later one.

ProductVulnerable versionsFixed in
bytecodealliance wasmtimefrom 0.34.0 before 0.34.2fixed in 0.34.2from 0.35.0 before 0.35.2fixed in 0.35.20.34.20.35.2

Products and versions as NVD and the vendor that published the CVE list them.

References

Get more CVE data from the API.

Free without a key or signup. Pro adds monitoring and higher limits: pricing.

Sources