CVE-2022-31146: Wasmtime vulnerable to Use After Free with `externref`s
6.4
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.33838%
CWE
Published
7/20/2022
Updated
1/27/2023
KEV Status
No
Technology
Rust
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| wasmtime | rust | >= 0.37.0, < 0.38.2 | 0.38.2 |
| cranelift-codegen | rust | >= 0.84.0, < 0.85.2 | 0.85.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from improper tracking of reference-type values during code generation. The commit diff shows critical changes to constant loading (load_constant64_full) and immediate value handling (imm rules) in the AArch64 backend. These functions were modified to add ImmExtend parameter handling, which is crucial for maintaining GC metadata. The original vulnerable versions lacked proper sign/zero extension tracking for reference-bearing values, causing regalloc2 to incorrectly elide stack maps. The patch explicitly adds extension type handling and proper value masking, confirming these were the problematic areas.