5.6
MEDIUM
CVE-2022-31104
Wasmtime Cranelift SIMD Proposal Instruction Vulnerability
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.

INFO

Published Date :

June 28, 2022, 12:15 a.m.

Last Modified :

July 8, 2022, 6:29 p.m.

Remotely Exploitable :

Yes !

Impact Score :

3.4

Exploitability Score :

2.2
Affected Products

The following products are affected by CVE-2022-31104 vulnerability. Even if cvefeed.io is aware of the exact versions of the products that are affected, the information is not represented in the table below.

ID Vendor Product Action
1 Bytecodealliance wasmtime
2 Bytecodealliance cranelift-codegen
References to Advisories, Solutions, and Tools

Here, you will find a curated list of external links that provide in-depth information, practical solutions, and valuable tools related to CVE-2022-31104.

URL Resource
https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.wasm_simd Third Party Advisory
https://github.com/bytecodealliance/wasmtime/pull/4317 Issue Tracking Patch Third Party Advisory
https://github.com/bytecodealliance/wasmtime/pull/4318 Issue Tracking Patch Third Party Advisory
https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-jqwc-c49r-4w2x Mitigation Third Party Advisory
https://github.com/webassembly/simd Third Party Advisory
https://webassembly.github.io/spec/ Third Party Advisory

We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).

Results are limited to the first 15 repositories due to potential performance issues.

The following list is the news that have been mention CVE-2022-31104 vulnerability anywhere in the article.

The following table lists the changes that have been made to the CVE-2022-31104 vulnerability over time.

Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.

  • CVE Modified by [email protected]

    May. 14, 2024

    Action Type Old Value New Value
  • Initial Analysis by [email protected]

    Jul. 08, 2022

    Action Type Old Value New Value
    Added CVSS V2 NIST (AV:N/AC:M/Au:N/C:P/I:P/A:P)
    Added CVSS V3.1 NIST AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
    Changed Reference Type https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.wasm_simd No Types Assigned https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.wasm_simd Third Party Advisory
    Changed Reference Type https://github.com/bytecodealliance/wasmtime/pull/4317 No Types Assigned https://github.com/bytecodealliance/wasmtime/pull/4317 Issue Tracking, Patch, Third Party Advisory
    Changed Reference Type https://github.com/bytecodealliance/wasmtime/pull/4318 No Types Assigned https://github.com/bytecodealliance/wasmtime/pull/4318 Issue Tracking, Patch, Third Party Advisory
    Changed Reference Type https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-jqwc-c49r-4w2x No Types Assigned https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-jqwc-c49r-4w2x Mitigation, Third Party Advisory
    Changed Reference Type https://github.com/webassembly/simd No Types Assigned https://github.com/webassembly/simd Third Party Advisory
    Changed Reference Type https://webassembly.github.io/spec/ No Types Assigned https://webassembly.github.io/spec/ Third Party Advisory
    Added CPE Configuration OR *cpe:2.3:a:bytecodealliance:cranelift-codegen:*:*:*:*:*:rust:*:* versions up to (excluding) 0.85.0 *cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:* versions up to (excluding) 0.38.1
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days. Following chart shows the EPSS score history of the vulnerability.
CWE - Common Weakness Enumeration

While CVE identifies specific instances of vulnerabilities, CWE categorizes the common flaws or weaknesses that can lead to vulnerabilities. CVE-2022-31104 is associated with the following CWEs:

Common Attack Pattern Enumeration and Classification (CAPEC)

Common Attack Pattern Enumeration and Classification (CAPEC) stores attack patterns, which are descriptions of the common attributes and approaches employed by adversaries to exploit the CVE-2022-31104 weaknesses.

Exploit Prediction

EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days.

0.30 }} 0.02%

score

0.69130

percentile

CVSS31 - Vulnerability Scoring System
Attack Vector
Attack Complexity
Privileges Required
User Interaction
Scope
Confidentiality
Integrity
Availability