LiveActive security incident?Get immediate response
CVE Record

CVE-2022-31104: Miscompilation of `i8x16.swizzle` and `select` with v128 inputs in Wasmtime

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.

MediumCVSS 4.8Not KEV-listedUpdated
Glexia's TakeAutomated analysismoderate

Security readout for executives and security teams

Plain-English summary

This is a Wasmtime/Cranelift bug where some WebAssembly SIMD operations can compute the wrong result on x86_64 hosts. The host running Wasm is described as largely unaffected, but guest programs may behave incorrectly, which can create downstream integrity or availability issues inside the guest workload.

Executive priority

Treat as a targeted medium-priority runtime correctness issue. It is most urgent for services executing third-party or security-sensitive Wasm on x86_64 with SIMD enabled. Routine patching is appropriate unless guest misexecution could affect business-critical decisions.

Technical view

Affected x86_64 SIMD lowerings for `i8x16.swizzle` and `select` with `v128` inputs miscompile WebAssembly semantics. `swizzle` can corrupt a reused mask register; `select` can leave upper 96 bits stale when the condition is zero. aarch64 is not affected; s390x lacked SIMD support in the cited context.

Likely exposure

Exposure is limited to deployments using affected Wasmtime or Cranelift versions on x86_64 with the WebAssembly SIMD proposal enabled, especially where untrusted or complex guest Wasm is executed.

Exploitation context

The bundle states KEV is false and provides no cited evidence of active exploitation. The concern is guest-code misexecution, not a described host escape. Impact depends on whether guest logic can be harmed by incorrect branches or values.

Researcher notes

The advisory frames impact as incorrect WebAssembly semantics in guest execution. Validation should focus on version, architecture, SIMD enablement, and guest dependence on vector operations. Do not assume host compromise from the provided sources.

Mitigation direction

  • Upgrade Wasmtime to 0.38.1 or later.
  • Upgrade cranelift-codegen and associated Cranelift crates to 0.85.1 or later.
  • Disable Wasm SIMD when upgrading is not immediately possible.
  • Prioritize x86_64 hosts running guest WebAssembly with SIMD enabled.
  • Track the Bytecode Alliance advisory for any revised guidance.

Validation and detection

  • Inventory Wasmtime and Cranelift versions in source, lockfiles, and build artifacts.
  • Confirm whether affected workloads run on x86_64 hosts.
  • Check whether Wasm SIMD is enabled in runtime configuration.
  • Identify guest workloads that rely on WebAssembly SIMD or `v128` operations.
  • Re-run application regression tests after upgrading or disabling SIMD.
Prepared
Confidence
high
Sources
8

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-682: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2022-31104 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
Medium
CVSS
4.8 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
0Timeline events
0ADP providers
7Source links

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
4.8CVSS 3.1MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L2.22.5Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

4.8Medium
CVSS 3.1 vector shape for CVE-2022-31104Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone
Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
bytecodealliancewasmtimewasmtime: < 0.38.1, cranelift-codegen: < 0.85.0Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-682 · source CWE mapping

Incorrect Calculation

Incorrect Calculation represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.