Read the docs
TI-2022-13148 Aliases CVE-2022-31104GHSA-jqwc-c49r-4w2x

Miscompilation of `i8x16.swizzle` and `select` with v128 inputs in Wasmtime

Priority LOW 29CWE-682Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
High
Impact type
—
Confidentiality · integrity · availability
Low · Low · Low
Fix status
Fixed

Attack profile from CVSS 3.1 · NVD. Fix status from CNA and GitHub.

Summary

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.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.01785 78th percentileScored 2026-11-07
Fix Fixed wasmtime (crates.io): 0.38.1cranelift-codegen (crates.io): 0.85.1

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Partial

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
bytecodealliancewasmtime wasmtime: < 0.38.1; cranelift-codegen: < 0.85.0—No fix listedCNA
—wasmtime (crates.io)before 0.38.10.38.1Patch availableGHSA-jqwc-c49r-4w2x
—cranelift-codegen (crates.io)before 0.85.10.85.1Patch availableGHSA-jqwc-c49r-4w2x
  • wasmtime Vendorbytecodealliance Affected wasmtime: < 0.38.1; cranelift-codegen: < 0.85.0 Fixed in — No fix listed CNA
  • wasmtime (crates.io) Vendor— Affected before 0.38.1 Fixed in 0.38.1 Patch available GHSA-jqwc-c49r-4w2x
  • cranelift-codegen (crates.io) Vendor— Affected before 0.85.1 Fixed in 0.85.1 Patch available GHSA-jqwc-c49r-4w2x

CPE configurations NVD · 2

CPEVersionsRoleVendor
cpe:2.3:a:bytecodealliance:cranelift-codegen:*:*:*:*:*:rust:*:*before 0.85.0Vulnerablebytecodealliance
cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:*before 0.38.1Vulnerablebytecodealliance
  • cpe:2.3:a:bytecodealliance:cranelift-codegen:*:*:*:*:*:rust:*:* Versions before 0.85.0 Vulnerable ·bytecodealliance
  • cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:* Versions before 0.38.1 Vulnerable ·bytecodealliance

Remediation

  • Fix · GHSA-jqwc-c49r-4w2x wasmtime (crates.io) Fixed in 0.38.1 Advisory →
  • Fix · GHSA-jqwc-c49r-4w2x cranelift-codegen (crates.io) Fixed in 0.85.1 Advisory →

Timeline

  1. 2026-10-02 Threatist record created from CVE-2022-31104
  2. 2026-10-03 Alias added: GHSA-jqwc-c49r-4w2x

References

  • TI-2023-11636 Guest-controlled out-of-bounds read/write on x86_64 in wasmtime CVSS 3.1CRITICAL 10.0
  • TI-2022-13189 Use After Free in Wasmtime CVSS 3.1HIGH 8.8
  • TI-2021-12298 Memory access due to code generation flaw in Cranelift module CVSS 3.1HIGH 8.8
  • TI-2022-13211 Cranelift vulnerable to miscompilation of constant values in division on AArch64 CVSS 3.1HIGH 7.5
  • TI-2023-12205 wasmtime is a fast and secure runtime for WebAssembly. CVSS 3.1MEDIUM 4.3

Sources