CVE-2022-31104 in Bytecodealliance Cranelift-Codegen and 1 more product
Wasmtime is a standalone runtime for WebAssembly. In affected versions wasmtime's implementation of the SIMD proposal for WebAssembly on x86_64 contained two distinct bugs in the instruction lowerings implemented in Cranelift. The aarch64 implementation of the simd proposal is not affected. The bugs were presented i...
Affects 2 products from 1 vendor. Facts below cite their sources.
Remotely exploitable over the network, high complexity, no authentication required, no user interaction needed, impact contained to the vulnerable component.
Affected products and versions
| Vendor | Product | Affected versions |
|---|---|---|
| Bytecodealliance | Cranelift-Codegen | < 0.85.0 |
| Bytecodealliance | Wasmtime | < 0.38.1 |
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. In affected versions wasmtime's implementation of the SIMD proposal for WebAssembly on x86_64 contained two distinct bugs in the instruction lowerings implemented in Cranelift. The aarch64 implementation of the simd proposal is not affected. The bugs were presented in the `i8x16.swizzle` and `select` WebAssembly instructions. The `select` instruction is only affected when the inputs are of `v128` type. The correspondingly affected Cranelift instructions were `swizzle` and `select`. The `swizzle` instruction lowering in Cranelift erroneously overwrote the mask input register which could corrupt a constant value, for example. This means that future uses of the same constant may see a different value than the constant itself. The `select` instruction lowering in Cranelift wasn't correctly implemented for vector types that are 128-bits wide. When the condition was 0 the wrong instruction was used to move the correct input to the output of the instruction meaning that only the low 32 bits were moved and the upper 96 bits of the result were left as whatever the register previously contained (instead of the input being moved from). The `select` instruction worked correctly if the condition was nonzero, however. This bug in Wasmtime's implementation of these instructions on x86_64 represents an incorrect implementation of the specified semantics of these instructions according to the WebAssembly specification. The impact of this is benign for hosts running WebAssembly but represents possible vulnerabilities within the execution of a guest program. For example a WebAssembly program could take unintended branches or materialize incorrect values internally which runs the risk of exposing the program itself to other related vulnerabilities which can occur from miscompilations. We have released Wasmtime 0.38.1 and cranelift-codegen (and other associated cranelift crates) 0.85.1 which contain the corrected implementations of these two instructions in Cranelift. If upgrading is not an option for you at this time, you can avoid the vulnerability by disabling the Wasm simd proposal. Additionally the bug is only present on x86_64 hosts. Other aarch64 hosts are not affected. Note that s390x hosts don't yet implement the simd proposal and are not affected.
Source: NIST NVD / MITRE CVE.
Record details
| CVE ID | CVE-2022-31104 |
|---|---|
| BreachSpider ID | BS-2022-GLOBAL-319196-M |
| CVSS vector | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L |
| Published | 2022-06-28 |
| Last modified | 2026-06-17 |
| Weakness (CWE) | |
| Source | NVD |
Weakness definitions
CWE-682: CWE-682
Related attack patterns (CAPEC)
CAPEC-128 Integer Attacks via CWE-682
CAPEC-129 Pointer Manipulation via CWE-682
Mapping is CWE to CAPEC per MITRE CAPEC 3.9.
Analysis AI-written, not human-reviewed
CVE-2022-31104 affects Wasmtime's implementation of the SIMD proposal for WebAssembly on x86_64, specifically in the `i8x16.swizzle` and `select` instructions. The aarch64 implementation is not affected. The vulnerability could allow for potential code execution or other unspecified impacts.
The attack vector involves crafting malicious WebAssembly modules that exploit the bugs in the `i8x16.swizzle` and `select` instructions, leading to potential code execution or other unspecified impacts in the Wasmtime runtime environment.
Questions
What is CVE-2022-31104?
CVE-2022-31104 affects Wasmtime's implementation of the SIMD proposal for WebAssembly on x86_64, specifically in the `i8x16.swizzle` and `select` instructions. The aarch64 implementation is not affected. The vulnerability could allow for potential code execution or other unspecified impacts.
What is the CVSS score for CVE-2022-31104?
CVE-2022-31104 has CVSS 5.6 (Medium). Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L. EPSS: 1.6%.
Is CVE-2022-31104 actively exploited?
No confirmed active exploitation of CVE-2022-31104 as of 2026-09-25.
How do I remediate CVE-2022-31104?
Priority: MEDIUM.
What systems are affected by CVE-2022-31104?
CVE-2022-31104 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.