CVE-2022-31146
Use After Free in Wasmtime
Also known as GHSA-5fhj-g3p3-pq9g, RUSTSEC-2022-0100
Mitigation
- Upgrade wasmtime to 0.38.2 or later.
- Upgrade cranelift-codegen to 0.85.2 or later.
Who should check
- Projects that depend on crates.io package wasmtime (>= 0.37.0, < 0.38.2)
- Projects that depend on crates.io package cranelift-codegen (>= 0.84.0, < 0.85.2)
- Anyone running bytecodealliance wasmtime >= 0.37.0, < 0.38.2; >= 0.84.0, < 0.85.2
Vulnerability facts
- Affected
- wasmtime >= 0.37.0, < 0.38.2; cranelift-codegen >= 0.84.0, < 0.85.2
- Fixed in
- 0.38.2, 0.85.2
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, login needed
- CVSS
- 6.4 (v3.1, CNA)CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:LOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: High
- Privileges required: Low
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: High
- Integrity impact: Low
- Availability impact: Low
- EPSS
- 1.15% chance of exploitation in 30 days (percentile 67, 2026-11-26)
- CWE
- CWE-416
- Modified
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| crates.io wasmtime | >= 0.37.0, < 0.38.2 | 0.38.2 | osv |
| crates.io cranelift-codegen | >= 0.84.0, < 0.85.2 | 0.85.2 | osv |
| bytecodealliance wasmtime | >= 0.37.0, < 0.38.2; >= 0.84.0, < 0.85.2 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2022-31146. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2022-31146.md Affected: wasmtime >= 0.37.0, < 0.38.2; cranelift-codegen >= 0.84.0, < 0.85.2 Fixed in: 0.38.2, 0.85.2 Steps: 1. Search this machine and project for wasmtime (crates.io), cranelift-codegen (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.
References
Vendor advisories
FAQ
Is CVE-2022-31146 being exploited?
There is no confirmed exploitation: CVE-2022-31146 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.15% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2022-31146?
Medium: CVSS 6.4 (v3.1, scored by CNA). Remote, login needed. The attack needs conditions outside the attacker's control, which makes it harder.
Which versions are affected by CVE-2022-31146?
wasmtime >= 0.37.0, < 0.38.2; cranelift-codegen >= 0.84.0, < 0.85.2.
Is there a fix for CVE-2022-31146?
Yes. Fixed in 0.38.2, 0.85.2. Upgrade wasmtime to 0.38.2 or later. Upgrade cranelift-codegen to 0.85.2 or later.
How do I check if I'm affected by CVE-2022-31146?
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.