# CVE-2022-31146: Use After Free in Wasmtime

- Severity: Medium 6.4 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L`
- 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.28%, higher than 70% of CVEs (2026-12-01)
- Published: 2022-07-12T12:00:00.000Z
- Modified: 2026-10-12T18:00:06.108Z
- Also known as: GHSA-5fhj-g3p3-pq9g, RUSTSEC-2022-0100
- Weaknesses: CWE-416
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

Wasmtime is a standalone runtime for WebAssembly. There is a bug in the Wasmtime's code generator, Cranelift, where functions using reference types may be incorrectly missing metadata required for runtime garbage collection. This means that if a GC happens at runtime then the GC pass will mistakenly think these functions do not have live references to GC'd values, reclaiming them and deallocating them. The function will then subsequently continue to use the values assuming they had not been GC'd, leading later to a use-after-free. This bug was introduced in the migration to the `regalloc2` register allocator that occurred in the Wasmtime 0.37.0 release on 2022-05-20. This bug has been patched and users should upgrade to Wasmtime version 0.38.2. Mitigations for this issue can be achieved by disabling the reference types proposal by passing `false` to `wasmtime::Config::wasm_reference_types` or downgrading to Wasmtime 0.36.0 or prior.

(As written by CVE List.)

## Affected

- bytecodealliance wasmtime: >= 0.37.0, < 0.38.2; >= 0.84.0, < 0.85.2; from 0.37.0 before 0.38.2
- wasmtime (crates.io): from 0.37.0 before 0.38.2; from 0.0.0-0 before 0.38.2
- cranelift-codegen (crates.io): from 0.84.0 before 0.85.2
- bytecodealliance cranelift-codegen: from 0.84.0 before 0.85.2

## Every score

- GitHub_M: CVSS:3.1 6.4 Medium `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L`
- GitHub: CVSS:3.1 6.4 Medium `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L`
- NVD: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-5fhj-g3p3-pq9g> (mitigation, third-party-advisory, web)
- <https://github.com/WebAssembly/reference-types> (third-party-advisory, web)
- <https://github.com/bytecodealliance/wasmtime/> (product, third-party-advisory)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-31146> (advisory)
- <https://github.com/bytecodealliance/wasmtime/commit/2ba4bce5cc719e5a74e571a534424614e62ecc41> (web)
- <https://github.com/bytecodealliance/wasmtime> (package)
- <https://rustsec.org/advisories/RUSTSEC-2022-0100.html> (advisory, web)
- <https://crates.io/crates/wasmtime> (package)

## Sources

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

---

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