CVE-2023-27477 wasmtime vulnerable to miscompilation of `i8x16.select` with the same inputs on x86_64
An off-by-one error in Wasmtime's Cranelift backend causes incorrect results for specific SIMD instructions on x86_64 platforms.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-27477?
CVE-2023-27477 is a low-severity vulnerability in bytecodealliance wasmtime, published on 8 Mar 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
wasmtime is a fast and secure runtime for WebAssembly. Wasmtime's code generation backend, Cranelift, has a bug on x86_64 platforms for the WebAssembly `i8x16.select` instruction which will produce the wrong results when the same operand is provided to the instruction and some of the selected indices are greater than 16. There is an off-by-one error in the calculation of the mask to the `pshufb` instruction which causes incorrect results to be returned if lanes are selected from the second vector. This codegen bug has been fixed in Wasmtiem 6.0.1, 5.0.1, and 4.0.1. Users are recommended to upgrade to these updated versions. If upgrading is not an option for you at this time, you can avoid this miscompilation by disabling the Wasm simd proposal. Additionally the bug is only present on x86_64 hosts. Other platforms such as AArch64 and s390x are not affected.
Weakness: CWE-193
Which versions are affected by CVE-2023-27477?
13 open source packages ship an affected version, including wasmtime and cranelift-codegen. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
wasmtime crates.io | From 0.0.0-0 | 4.0.1, 5.0.1, 6.0.1 |
wasmtime crates.io | From 1.0.0 | 4.0.1 |
wasmtime crates.io | From 1.0.0 | 4.0.1 |
wasmtime crates.io | From 5.0.0 | 5.0.1 |
wasmtime crates.io | From 5.0.0 | 5.0.1 |
wasmtime crates.io | From 6.0.0 | 6.0.1 |
7 more packages
wasmtime crates.io | From 6.0.0 | 6.0.1 |
cranelift-codegen crates.io | From 0.88.0 | 0.91.1 |
cranelift-codegen crates.io | From 0.88.0 | 0.91.1 |
cranelift-codegen crates.io | From 0.92.0 | 0.92.1 |
cranelift-codegen crates.io | From 0.92.0 | 0.92.1 |
cranelift-codegen crates.io | From 0.93.0 | 0.93.1 |
cranelift-codegen crates.io | From 0.93.0 | 0.93.1 |
Products include Bytecodealliance Cranelift-Codegen, Bytecodealliance Wasmtime.
How do I fix CVE-2023-27477?
Upgrade wasmtime to a fixed version for your release line: 4.0.1, 5.0.1 or 6.0.1.
Is CVE-2023-27477 being exploited?
There is no known exploitation of CVE-2023-27477 in the wild and no public exploit code.
Other vulnerabilities in bytecodealliance wasmtime
- CVE-2023-26489 Guest-controlled out-of-bounds read/write on x86_64 in wasmtime
- CVE-2021-32629 Memory access due to code generation flaw in Cranelift module
- CVE-2022-31146 Use After Free in Wasmtime
- CVE-2022-31169 Cranelift vulnerable to miscompilation of constant values in division on AArch64
- CVE-2022-31104 Miscompilation of `i8x16.swizzle` and `select` with v128 inputs in Wasmtime
Sources
Also known as AZL-25857, GHSA-xm67-587q-r2vw, RUSTSEC-2023-0093.