# CVE-2022-24791: Use after free in Wasmtime

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.1
- **CVSS:** 8.1 (v3.1, CNA) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: High; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 1.16% (percentile 67, 2026-11-26)
- **CWE:** CWE-416
- **Aliases:** GHSA-gwc9-348x-qwv2, RUSTSEC-2022-0016, RUSTSEC-2022-0099
- **Published:** 2022-03-28T12:00:00.000Z
- **Modified:** 2026-10-12T18:00:03.412Z

## Who should check

- Projects that depend on crates.io package wasmtime (\< 0.34.2)
- Anyone running bytecodealliance wasmtime \< 0.34.2; \>= 0.35.0, \< 0.35.2

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

## Affected and fixed versions

- crates.io `wasmtime`: affected \< 0.34.2; fixed 0.34.2, 0.35.2 (osv)
- bytecodealliance wasmtime: \< 0.34.2; \>= 0.35.0, \< 0.35.2 (cvelist)

## Mitigation

- Upgrade wasmtime to one of 0.34.2, 0.35.2 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-24791. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-24791.md
Affected: wasmtime < 0.34.2
Fixed in: 0.34.2, 0.35.2

Steps:
1. Search this machine and project for wasmtime (crates.io), bytecodealliance wasmtime: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-24791 being exploited?

There is no confirmed exploitation: CVE-2022-24791 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.16% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-24791?

High: CVSS 8.1 (v3.1, scored by CNA). Remote, no login needed. The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2022-24791?

wasmtime \< 0.34.2.

### Is there a fix for CVE-2022-24791?

Yes. Fixed in 0.34.2, 0.35.2. Upgrade wasmtime to one of 0.34.2, 0.35.2 (or later in the same release line).

### How do I check if I'm affected by CVE-2022-24791?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-gwc9-348x-qwv2>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2022-24791>
- vendor: <https://rustsec.org/advisories/RUSTSEC-2022-0016.html>
- vendor: <https://rustsec.org/advisories/RUSTSEC-2022-0099.html>
- patch: <https://github.com/bytecodealliance/wasmtime/commit/666c2554ea0e1728c35aa41178cf235920db888a>
- other: <https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.epoch_interruption>
- other: <https://github.com/WebAssembly/reference-types>
- other: <https://github.com/bytecodealliance/wasmtime>
- other: <https://crates.io/crates/wasmtime>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-24791>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-gwc9-348x-qwv2> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/RUSTSEC-2022-0016> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/RUSTSEC-2022-0099> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2022-24791> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-24791>
