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

- Priority: **Routine**
- Reason: Not severe (CVSS 6.4, network access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2022-07-20 · Modified: 2025-04-23
- Aliases: UBUNTU-CVE-2022-31146, GHSA-5fhj-g3p3-pq9g, RUSTSEC-2022-0100
- Record: https://cvemate.com/vulnerability/CVE-2022-31146 · JSON: https://cvemate.com/vulnerability/CVE-2022-31146/json

## Description

```text
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.
```

## Signals

- CVSS: 8.8 high (v3.1, NVD) CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- EPSS: 1.281%, percentile 71.015%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected

- bytecodealliance cranelift-codegen: ≥ 0.84.0, \< 0.85.2
- bytecodealliance wasmtime: ≥ 0.84.0, \< 0.85.2 \| ≥ 0.37.0, \< 0.38.2
- Crates.Io cranelift-codegen (Crates.Io): ≥ 0.84.0, \< 0.85.2
- Crates.Io wasmtime (Crates.Io): ≥ 0.37.0, \< 0.38.2 \| ≥ 0.0.0-0, \< 0.38.2
- ubuntu mozjs38 (Ubuntu): All versions (No fix recorded)
- ubuntu mozjs52 (Ubuntu): All versions (No fix recorded)
- ubuntu mozjs68 (Ubuntu): All versions (No fix recorded)
- ubuntu mozjs78 (Ubuntu): All versions (No fix recorded)
- ubuntu mozjs91 (Ubuntu): All versions (No fix recorded)
- ubuntu thunderbird (Ubuntu): All versions (No fix recorded)

## References

- <https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-5fhj-g3p3-pq9g>
- <https://github.com/WebAssembly/reference-types>
- <https://github.com/bytecodealliance/wasmtime/>
- <https://ubuntu.com/security/CVE-2022-31146>
- <https://github.com/bytecodealliance/wasmtime/commit/2154c63de94e0372bca5a596c3eaf90147c922d1>
- <https://www.cve.org/CVERecord?id=CVE-2022-31146>
- <https://nvd.nist.gov/vuln/detail/CVE-2022-31146>
- <https://github.com/bytecodealliance/wasmtime/commit/2ba4bce5cc719e5a74e571a534424614e62ecc41>
- <https://github.com/bytecodealliance/wasmtime>
- <https://rustsec.org/advisories/RUSTSEC-2022-0100.html>
- <https://crates.io/crates/wasmtime>

---

Data as of 2026-12-05T10:25:01.770Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
