Skip to content
FlawDB
Sign in
Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

CVE-2022-31104

MEDIUM 4.8EPSS 77%

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

Also known as GHSA-jqwc-c49r-4w2x, RUSTSEC-2022-0095

Mitigation

  • Upgrade wasmtime to 0.38.1 or later.
  • Upgrade cranelift-codegen to 0.85.1 or later.

Who should check

  • Projects that depend on crates.io package wasmtime (< 0.38.1)
  • Projects that depend on crates.io package cranelift-codegen (< 0.85.1)
  • Anyone running bytecodealliance wasmtime wasmtime: < 0.38.1; cranelift-codegen: < 0.85.0

Vulnerability facts

Affected
wasmtime < 0.38.1; cranelift-codegen < 0.85.1
Fixed in
0.38.1, 0.85.1
Exploited in the wild
Not in CISA KEV
Public exploit / PoC
None known
Remote exploitation
Remote, no login needed
CVSS
4.8 (v3.1, CNA)CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:LOpen in CVSS calculator
Show all 8 CVSS metrics
  • Attack vector: Network
  • Attack complexity: High
  • Privileges required: None
  • User interaction: None
  • Scope: Unchanged
  • Confidentiality impact: None
  • Integrity impact: Low
  • Availability impact: Low
EPSS
1.64% chance of exploitation in 30 days (percentile 77, 2026-11-26)
CWE
CWE-682
Published
Modified

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.

Affected and fixed versions

Package / productAffectedFixedSource
crates.io wasmtime< 0.38.10.38.1osv
crates.io cranelift-codegen< 0.85.10.85.1osv
bytecodealliance wasmtime wasmtime: < 0.38.1; cranelift-codegen: < 0.85.0—cvelist

Check your systems with an agent

Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.

Check whether anything I run is affected by CVE-2022-31104. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-31104.md
Affected: wasmtime < 0.38.1; cranelift-codegen < 0.85.1
Fixed in: 0.38.1, 0.85.1

Steps:
1. Search this machine and project for wasmtime (crates.io), cranelift-codegen (crates.io), bytecodealliance wasmtime: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.

References

FAQ

Is CVE-2022-31104 being exploited?

There is no confirmed exploitation: CVE-2022-31104 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.64% chance of exploitation in the next 30 days (as of 2026-11-26).

How serious is CVE-2022-31104?

Medium: CVSS 4.8 (v3.1, scored by CNA). Remote, no login needed. The attack needs conditions outside the attacker's control, which makes it harder.

Which versions are affected by CVE-2022-31104?

wasmtime < 0.38.1; cranelift-codegen < 0.85.1.

Is there a fix for CVE-2022-31104?

Yes. Fixed in 0.38.1, 0.85.1. Upgrade wasmtime to 0.38.1 or later. Upgrade cranelift-codegen to 0.85.1 or later.

How do I check if I'm affected by CVE-2022-31104?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

Sponsors