VYPR
Low severityNVD Advisory· Published Mar 8, 2023· Updated Feb 25, 2025

CVE-2023-27477

CVE-2023-27477

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.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
wasmtimecrates.io
>= 1.0.0, < 4.0.14.0.1
wasmtimecrates.io
>= 5.0.0, < 5.0.15.0.1
wasmtimecrates.io
>= 6.0.0, < 6.0.16.0.1
cranelift-codegencrates.io
>= 0.88.0, < 0.91.10.91.1
cranelift-codegencrates.io
>= 0.92.0, < 0.92.10.92.1
cranelift-codegencrates.io
>= 0.93.0, < 0.93.10.93.1

Affected products

1

Patches

1
5dc2bbccbb36

Merge pull request from GHSA-xm67-587q-r2vw

https://github.com/bytecodealliance/wasmtimeAlex CrichtonMar 8, 2023via ghsa
3 files changed · +10 2
  • cranelift/codegen/src/isa/x64/lower/isle.rs+1 1 modified
    @@ -752,7 +752,7 @@ impl Context for IsleContext<'_, '_, MInst, X64Backend> {
         fn shuffle_0_31_mask(&mut self, mask: &VecMask) -> VCodeConstant {
             let mask = mask
                 .iter()
    -            .map(|&b| if b > 15 { b.wrapping_sub(15) } else { b })
    +            .map(|&b| if b > 15 { b.wrapping_sub(16) } else { b })
                 .map(|b| if b > 15 { 0b10000000 } else { b })
                 .collect();
             self.lower_ctx
    
  • cranelift/filetests/filetests/isa/x64/simd-lane-access-compile.clif+2 1 modified
    @@ -101,7 +101,8 @@ block0:
     ;   addb %al, (%rax)
     ;   addb %al, (%rax)
     ;   addb %al, (%rax)
    -;   addb %al, (%rcx, %rax)
    +;   addb %al, (%rbx)
    +;   addl %eax, (%rax)
     ;   addb %al, (%rax)
     ;   addb %al, (%rax)
     ;   addb %al, (%rax)
    
  • cranelift/filetests/filetests/runtests/simd-shuffle.clif+7 0 modified
    @@ -19,3 +19,10 @@ block0(v0: i8x16, v1: i8x16):
         return v2
     }
     ; run: %shuffle_zeros([1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16], [17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32]) == [4 1 0 0 5 7 13 12 24 14 25 5 3 0 18 6]
    +
    +function %shuffle1(i8x16) -> i8x16 {
    +block0(v0: i8x16):
    +    v1 = shuffle v0, v0, [8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23]
    +    return v1
    +}
    +; run: %shuffle1([0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]) == [8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7]
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

7

News mentions

0

No linked articles in our index yet.