CVE-2022-31146 json
Use After Free in Wasmtime
published 2022-07-12 4 y ago modified 2026-10-12 27 d ago also GHSA-5fhj-g3p3-pq9g , RUSTSEC-2022-0100 , EUVD-2022-6243
- cvss
- 6.4
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 1.3%
- EPSS 1.3% chance of exploitation in 30 days, percentile 69%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- crates.io wasmtime 0.38.2
- crates.io cranelift-codegen 0.85.2
- bytecodealliance cranelift-codegen 0.85.2
- bytecodealliance wasmtime 0.38.2
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- partial
- Assessed
- 18 mo ago
Exploit prediction
1.25% chance of exploitation in the next 30 days, higher than 69% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 6.4 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L |
| NVD | 3.1 | 8.8 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 3.1 | 6.4 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| crates.io | wasmtime | >=0.37.0, <0.38.2 >=0.0.0-0, <0.38.2 |
0.38.2 |
| crates.io | cranelift-codegen | >=0.84.0, <0.85.2 |
0.85.2 |
Affected products
- bytecodealliance wasmtime
Classification
- Weakness
-
- CWE-416 Use After Free
References
-
github.com
/bytecodealliance/wasmtime/commit/2ba4bce5cc719e5a74e571a534424614e62ecc41
web
-
github.com
/bytecodealliance/wasmtime/security/advisories/GHSA-5fhj-g3p3-pq9g
web, mitigation, third-party-advisory
-
github.com
/WebAssembly/reference-types
web, third-party-advisory
-
github.com
/bytecodealliance/wasmtime/
product, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2022-31146
advisory
-
github.com
/bytecodealliance/wasmtime
package
-
rustsec.org
/advisories/RUSTSEC-2022-0100.html
web, advisory
-
crates.io
/crates/wasmtime
package
Sources
- CVE List CVE-2022-31146
- GitHub Advisory GHSA-5fhj-g3p3-pq9g
- NVD CVE-2022-31146
- OSV RUSTSEC-2022-0100
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.