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

- Severity: High 8.1 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.18%, higher than 68% of CVEs (2026-12-01)
- Published: 2022-03-28T12:00:00.000Z
- Modified: 2026-10-12T18:00:03.412Z
- Also known as: GHSA-gwc9-348x-qwv2, RUSTSEC-2022-0016, RUSTSEC-2022-0099
- Weaknesses: CWE-416
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact total
- Assigned by: GitHub_M

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

(As written by CVE List.)

## Affected

- bytecodealliance wasmtime: < 0.34.2; >= 0.35.0, < 0.35.2; from 0.34.0 before 0.34.2; from 0.35.0 before 0.35.2
- wasmtime (crates.io): before 0.34.2; from 0.35.0 before 0.35.2; from 0.34.0 before 0.34.2; from 0.0.0-0 before 0.34.2

## Every score

- GitHub_M: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- GitHub: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:2.0 6.8 Medium `AV:N/AC:M/Au:N/C:P/I:P/A:P`

## References

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

## Sources

- CVE List: [CVE-2022-24791](https://www.cve.org/CVERecord?id=CVE-2022-24791), CVE Terms of Use, modified 2025-04-23
- GitHub Advisory Database: [GHSA-gwc9-348x-qwv2](https://github.com/advisories/GHSA-gwc9-348x-qwv2), CC-BY-4.0, modified 2025-05-02
- RustSec Advisory Database: [RUSTSEC-2022-0016](https://rustsec.org/advisories/RUSTSEC-2022-0016.html), CC0-1.0, modified 2026-10-12
- RustSec Advisory Database: [RUSTSEC-2022-0099](https://rustsec.org/advisories/RUSTSEC-2022-0099.html), CC0-1.0, modified 2026-10-12
- NVD: [CVE-2022-24791](https://nvd.nist.gov/vuln/detail/CVE-2022-24791), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-24791 · Whole record: https://cve.day/CVE-2022-24791.json · Rebuilt by cve.day 2026-11-25T22:58:10.353Z
