CVE-2022-31104
Last modified
CVE-2022-31104 is a medium-severity vulnerability rated 5.6/10 on the CVSS scale. 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. EPSS estimates a 1.63% chance of exploitation in the next 30 days.
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.
Metrics
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
Weakness Enumeration
Affected Software
| Vendor | Product | Versions |
|---|---|---|
| Bytecodealliance | Cranelift-Codegen | < 0.85.0 |
| Bytecodealliance | Wasmtime | < 0.38.1 |
References
- https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.wasm_simdThird Party Advisory
- https://github.com/bytecodealliance/wasmtime/pull/4317Issue Tracking, Patch, Third Party Advisory
- https://github.com/bytecodealliance/wasmtime/pull/4318Issue Tracking, Patch, Third Party Advisory
- https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-jqwc-c49r-4w2xMitigation, Third Party Advisory
- https://github.com/webassembly/simdThird Party Advisory
- https://webassembly.github.io/spec/Third Party Advisory
- https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.wasm_simdThird Party Advisory
- https://github.com/bytecodealliance/wasmtime/pull/4317Issue Tracking, Patch, Third Party Advisory
- https://github.com/bytecodealliance/wasmtime/pull/4318Issue Tracking, Patch, Third Party Advisory
- https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-jqwc-c49r-4w2xMitigation, Third Party Advisory
- https://github.com/webassembly/simdThird Party Advisory
- https://webassembly.github.io/spec/Third Party Advisory
Timeline
- Published
- Last Modified
- Status
- Modified
Frequently Asked Questions
What is CVE-2022-31104?
How severe is CVE-2022-31104?
How do I fix CVE-2022-31104?
How Strix Helps
- How Strix found a critical auth bypass in etcdStrix autonomously discovered a critical authentication bypass in etcd, later designated CVE-2026-33413.
- Autonomous PentestingAI agents that find and validate exploitable vulnerabilities like this one across your applications.
- PR ReviewsPentest every pull request so vulnerable code is caught before it ships to production.
- AI Penetration TestingHow AI-driven penetration testing continuously covers your attack surface.
Related CVEs from 2022
- CVE-2022-31099rulex is a new, portable, regular expression language. When …6.5
- CVE-2022-3110An issue was discovered in the Linux kernel through 5.16-rc6…5.5
- CVE-2022-31100rulex is a new, portable, regular expression language. When …6.5
- CVE-2022-31101prestashop/blockwishlist is a prestashop extension which add…8.8
- CVE-2022-31102Argo CD is a declarative, GitOps continuous delivery tool fo…6.1
- CVE-2022-31103lettersanitizer is a DOM-based HTML email sanitizer for in-b…7.5
- CVE-2022-31105Argo CD is a declarative, GitOps continuous delivery tool fo…9.6
- CVE-2022-31106Underscore.deep is a collection of Underscore mixins that op…9.8
- CVE-2022-31107Grafana is an open-source platform for monitoring and observ…7.5
- CVE-2022-31108Mermaid is a JavaScript based diagramming and charting tool …6.1
- CVE-2022-31109laminas-diactoros is a PHP package containing implementation…6.1
- CVE-2022-3111An issue was discovered in the Linux kernel through 5.16-rc6…5.5
Are you affected by CVE-2022-31104?
Run a free Strix scan to check your systems for this vulnerability.
Scan your code nowSource: NVD / NIST
