CVE-2023-27477 wasmtime vulnerable to miscompilation of `i8x16.select` with the same inputs on x86_64

Low 3.1 Published Updated

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.

PackageAffectedFixed in
wasmtime crates.ioFrom 0.0.0-04.0.1, 5.0.1, 6.0.1
wasmtime crates.ioFrom 1.0.04.0.1
wasmtime crates.ioFrom 1.0.04.0.1
wasmtime crates.ioFrom 5.0.05.0.1
wasmtime crates.ioFrom 5.0.05.0.1
wasmtime crates.ioFrom 6.0.06.0.1
7 more packages
wasmtime crates.ioFrom 6.0.06.0.1
cranelift-codegen crates.ioFrom 0.88.00.91.1
cranelift-codegen crates.ioFrom 0.88.00.91.1
cranelift-codegen crates.ioFrom 0.92.00.92.1
cranelift-codegen crates.ioFrom 0.92.00.92.1
cranelift-codegen crates.ioFrom 0.93.00.93.1
cranelift-codegen crates.ioFrom 0.93.00.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.

Sources

Also known as AZL-25857, GHSA-xm67-587q-r2vw, RUSTSEC-2023-0093.

Is CVE-2023-27477 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free