CVE-2022-31146 in Bytecodealliance Cranelift-Codegen and 1 more product
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 func...
Affects 2 products from 1 vendor. Facts below cite their sources.
Remotely exploitable over the network, low complexity, low privileges required, no user interaction needed, impact contained to the vulnerable component, full confidentiality impact, full integrity impact, full availability impact.
Affected products and versions
| Vendor | Product | Affected versions |
|---|---|---|
| Bytecodealliance | Cranelift-Codegen | ≥ 0.84.0, < 0.85.2 |
| Bytecodealliance | Wasmtime | ≥ 0.37.0, < 0.38.2 |
A product listed here is affected only at the versions shown. Use the free check to test the exact version you run.
Fix and vendor advisory
No official vendor advisory link on record. See the CVE record.
Exploitation
| CISA known-exploited | Not in the CISA KEV catalog |
|---|---|
| Public exploit | Not confirmed |
Official 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.
Source: NIST NVD / MITRE CVE.
Record details
| CVE ID | CVE-2022-31146 |
|---|---|
| BreachSpider ID | BS-2022-GLOBAL-067008-H |
| CVSS vector | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| Published | 2022-07-21 |
| Last modified | 2026-06-17 |
| Weakness (CWE) | |
| Source | NVD |
Weakness definitions
CWE-416: Use After Free
Software references memory after it has been freed, leading to corruption, crashes, or code execution.
Analysis AI-written, not human-reviewed
A critical bug in Wasmtime's code generator, Cranelift, can lead to incorrect garbage collection, potentially causing memory corruption and application crashes.
The vulnerability arises from functions using reference types in WebAssembly modules, which may be incorrectly missing metadata required for runtime garbage collection. This can lead to the garbage collector reclaiming and deallocating memory that is still in use.
Questions
What is CVE-2022-31146?
A critical bug in Wasmtime's code generator, Cranelift, can lead to incorrect garbage collection, potentially causing memory corruption and application crashes.
What is the CVSS score for CVE-2022-31146?
CVE-2022-31146 has CVSS 8.8 (High). Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. EPSS: 1.2%.
Is CVE-2022-31146 actively exploited?
No confirmed active exploitation of CVE-2022-31146 as of 2026-09-25.
How do I remediate CVE-2022-31146?
Priority: IMMEDIATE.
What systems are affected by CVE-2022-31146?
CVE-2022-31146 affects Bytecodealliance Cranelift-Codegen, Wasmtime.
For developers and AI agents
Run this check from your own code or agent
REST API
curl -s https://breachspider.com/api/v1/assets/correlate-cves \
-H "Authorization: Bearer $BREACHSPIDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"assets":[{"asset_id":"dev-1","vendor":"Bytecodealliance","product":"Cranelift-Codegen","version":"1.0"}]}'
MCP for AI agents
# hosted: add as a connector
https://mcp.breachspider.com/mcp
# local
pipx install breachspider-mcp
Free trial: 14 days, 750 device checks, no card.
Page facts from NVD, MITRE, CISA and vendor advisories, record last modified 2026-06-17.