Use after free in Wasmtime
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · NVD. Fix status from CNA and GitHub. Impact type from CWE-416 and the CVSS impact.
Summary
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).
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| bytecodealliance | wasmtime | before 0.34.2; 0.35.0 to before 0.35.2 | 0.34.2, 0.35.2 | Patch available | CNA |
| — | wasmtime (crates.io) | before 0.34.2 | 0.34.2 | Patch available | GHSA-gwc9-348x-qwv2 |
| — | wasmtime (crates.io) | 0.35.0 to before 0.35.2 | 0.35.2 | Patch available | GHSA-gwc9-348x-qwv2 |
- wasmtime Vendorbytecodealliance Affected before 0.34.2; 0.35.0 to before 0.35.2 Fixed in 0.34.2, 0.35.2 Patch available CNA
- wasmtime (crates.io) Vendor— Affected before 0.34.2 Fixed in 0.34.2 Patch available GHSA-gwc9-348x-qwv2
- wasmtime (crates.io) Vendor— Affected 0.35.0 to before 0.35.2 Fixed in 0.35.2 Patch available GHSA-gwc9-348x-qwv2
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:* | 0.34.0 to before 0.34.2; 0.35.0 to before 0.35.2 | Vulnerable | bytecodealliance |
- cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:* Versions 0.34.0 to before 0.34.2; 0.35.0 to before 0.35.2 Vulnerable ·bytecodealliance
Remediation
- Fix · CNA wasmtime (bytecodealliance) Fixed in 0.34.2, 0.35.2
- Fix · GHSA-gwc9-348x-qwv2 wasmtime (crates.io) Fixed in 0.34.2 Advisory →
- Fix · GHSA-gwc9-348x-qwv2 wasmtime (crates.io) Fixed in 0.35.2 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2022-24791
- 2026-10-03 Alias added: GHSA-gwc9-348x-qwv2
References
Advisory 2
More bytecodealliance Wasmtime vulnerabilities
- TI-2026-21632 Wasmtime is vulnerable to panic when dropping a `[Typed]Func::call_async` future CVSS 4.0MEDIUM 6.9
- TI-2023-11636 Guest-controlled out-of-bounds read/write on x86_64 in wasmtime CVSS 3.1CRITICAL 10.0
- TI-2022-18765 Wasmtime vulnerable to data leakage between instances in the pooling allocator CVSS 3.1HIGH 8.6
- TI-2022-18766 wasmtime_trap_code C API function has out of bounds write vulnerability CVSS 3.1CRITICAL 9.8
- TI-2026-27209 Wasmtime with Winch compiler backend on aarch64 may allow a sandbox-escaping memory access CVSS 4.0CRITICAL 9.0
- TI-2026-27193 Wasmtime miscompiled guest heap access enables sandbox escape on aarch64 Cranelift CVSS 4.0CRITICAL 9.0
Sources
- CVE-2022-24791 · CVE Program
- CVE-2022-24791 · NVD
- FIRST EPSS
- GHSA-gwc9-348x-qwv2 · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences