Skip to content

← Public intelligence

crates.io package

wasmtime

Open actionable advisories and recorded vendor fixes. This public package view has no inventory attached and cannot establish whether your deployment is affected. A vendor fix never resolves your finding; verify your installed version and the source guidance.

Open advisories

62 actionable advisories, newest first. Withdrawn advisories and news are excluded. Coverage is partial.

  1. Low, CVSS 2.2crates.ioPublished

    Miscompilation of wasm i64x2.shr_s instruction with constant input on x86_64

    CVE-2023-41880 · GHSA-gw5p-q8mj-p7gh

    Affected
    • crates.io wasmtime >= 10.0.0, < 10.0.2; >= 11.0.0, < 11.0.2; >= 12.0.0, < 12.0.2
    Fixed in
    11.0.210.0.212.0.2· Vendor fix available
    Issue
    Impact Wasmtime versions from 10.0.0 to 12.0.1 contain a miscompilation of the WebAssembly i64x2.shrs instruction on x8664 platforms when the shift amount is a constant value that is larger than 32. Only x8664 is affected so all other targets are not affected by this. The miscompilation results in the instruction producing an incorrect result, namely the low 32-bits of the second lane of the vector are derived from the low 32-bits of the second lane of the input vector instead of the high 32-bits. The primary impact of this issue is that any WebAssembly program using the i64x2.shrs with a constant shift amount larger than 32 may produce an incorrect result. This issue is not an escape from the WebAssembly sandbox. Execution of WebAssembly guest programs will still behave correctly with respect to memory sandboxing and isolation from the host. Wasmtime considers non-spec-compliant behavior as a security issue nonetheless. This issue was discovered through fuzzing of Wasmtime's code…

    Recommended action: Upgrade to 12.0.2, 11.0.2 or 10.0.2 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  2. Low, CVSS 3.9crates.ioPublished

    Undefined Behavior in Rust runtime functions

    CVE-2023-30624 · GHSA-ch89-5g45-qwc7

    Affected
    • crates.io wasmtime < 6.0.2; >= 7.0.0, < 7.0.1; >= 8.0.0, < 8.0.1
    Fixed in
    7.0.18.0.16.0.2· Vendor fix available
    Issue
    Impact Wasmtime's implementation of managing per-instance state, such as tables and memories, contains LLVM-level undefined behavior. This undefined behavior was found to cause runtime-level issues when compiled with LLVM 16 which causes some writes, which are critical for correctness, to be optimized away. Vulnerable versions of Wasmtime compiled with Rust 1.70, which is currently in beta, or later are known to have incorrectly compiled functions. Versions of Wasmtime compiled with the current Rust stable release, 1.69, and prior are not known at this time to have any issues, but can theoretically exhibit potential issues. The underlying problem is that Wasmtime's runtime state for an instance involves a Rust-defined structure called Instance which has a trailing VMContext structure after it. This VMContext structure has a runtime-defined layout that is unique per-module. This representation cannot be expressed with safe code in Rust so unsafe code is required to maintain this…

    Recommended action: Upgrade to 8.0.1, 7.0.1 or 6.0.2 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  3. Critical, CVSS 9.9crates.ioPublished

    wasmtime vulnerable to guest-controlled out-of-bounds read/write on x86_64

    CVE-2023-26489 · GHSA-ff4p-7xrq-q5r8

    Affected
    • crates.io wasmtime >= 0.37.0, < 4.0.1; >= 5.0.0, < 5.0.1; >= 6.0.0, < 6.0.1
    Fixed in
    5.0.16.0.14.0.1· Vendor fix available
    Issue
    Impact Wasmtime's code generator, Cranelift, has a bug on x8664 targets where address-mode computation mistakenly would calculate a 35-bit effective address instead of WebAssembly's defined 33-bit effective address. This bug means that, with default codegen settings, a wasm-controlled load/store operation could read/write addresses up to 35 bits away from the base of linear memory. Wasmtime's default sandbox settings provide up to 6G of protection from the base of linear memory to guarantee that any memory access in that range will be semantically correct. Due to this bug, however, addresses up to 0xffffffff 8 + 0x7ffffffc = 36507222004 = ~34G bytes away from the base of linear memory are possible from guest code. This means that the virtual memory 6G away from the base of linear memory up to ~34G away can be read/written by a malicious module. This out of bounds read/write is not semantically correct and poses a threat as an arbitrary read/write within ~34G of linear memory away…

    Recommended action: Upgrade to 6.0.1, 5.0.1 or 4.0.1 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  4. Low, CVSS 3.1crates.ioPublished

    wasmtime vulnerable to miscompilation of i8x16.select with the same inputs on x86_64

    CVE-2023-27477 · GHSA-xm67-587q-r2vw

    Affected
    • crates.io wasmtime >= 1.0.0, < 4.0.1; >= 5.0.0, < 5.0.1; >= 6.0.0, < 6.0.1
    Fixed in
    5.0.16.0.14.0.1· Vendor fix available
    Issue
    Impact Wasmtime's code generation backend, Cranelift, has a bug on x8664 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. The impact of this miscompilation is that the WebAssembly instruction can produce incorrect results for the i8x16.select instruction. This should have no effect on embedders and does not represent a sandbox escape, for example. Guest programs, however, may behave unexpectedly due to the incorrect result of this instruction. In extreme cases if a guest program is handling untrusted input then the guest program may deviate from its intended execution, for example calling an imported host function with different arguments than intended. This…

    Recommended action: Upgrade to 6.0.1, 5.0.1 or 4.0.1 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  5. High, CVSS 8.6crates.ioPublished

    Wasmtime may have data leakage between instances in the pooling allocator

    CVE-2022-39393 · GHSA-wh6w-3828-g9qf

    Affected
    • crates.io wasmtime >= 2.0.0, < 2.0.2; < 1.0.2
    Fixed in
    1.0.22.0.2· Vendor fix available
    Issue
    Impact There is a bug in Wasmtime's implementation of it's pooling instance allocator where when a linear memory is reused for another instance the initial heap snapshot of the prior instance can be visible, erroneously to the next instance. The pooling instance allocator in Wasmtime works by preallocating virtual memory for a fixed number of instances to reside in and then new instantiations pick a slot to use. Most conventional modules additionally have an initial copy-on-write "heap image" which is mapped in Wasmtime into the linear memory slot. When a heap slot is deallocated Wasmtime resets all of its contents back to the initial state but it does not unmap the image in case the next instance is an instantiation of the same module. The bug in Wasmtime occurs when a slot in the pooling allocator previously was used for a module with a heap image, meaning that its current state of memory contains the initial heap contents of that module. If the next instantiation within that slot…

    Recommended action: Upgrade to 2.0.2 or 1.0.2 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  6. Medium, CVSS 5.9crates.ioPublished

    Wasmtime out of bounds read/write with zero-memory-pages configuration

    CVE-2022-39392 · GHSA-44mr-8vmm-wjhg

    Affected
    • crates.io wasmtime >= 2.0.0, < 2.0.2; < 1.0.2
    Fixed in
    1.0.22.0.2· Vendor fix available
    Issue
    Impact There is a bug in Wasmtime's implementation of its pooling instance allocator when the allocator is configured to give WebAssembly instances a maximum of zero pages of memory. In this configuration the virtual memory mapping for WebAssembly memories did not meet the compiler-required configuration requirements for safely executing WebAssembly modules. Wasmtime's default settings require virtual memory page faults to indicate that wasm reads/writes are out-of-bounds, but the pooling allocator's configuration would not create an appropriate virtual memory mapping for this meaning out of bounds reads/writes can successfully read/write memory unrelated to the wasm sandbox within range of the base address of the memory mapping created by the pooling allocator. This bug can only be triggered by setting InstanceLimits::memorypages to zero. This is expected to be a very rare configuration since this means that wasm modules cannot allocate any pages of linear memory. All wasm modules…

    Recommended action: Upgrade to 2.0.2 or 1.0.2 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  7. Medium, CVSS 5.9crates.ioPublished

    Cranelift vulnerable to miscompilation of constant values in division on AArch64

    CVE-2022-31169 · GHSA-7f6x-jwh5-m9r4

    Affected
    • crates.io wasmtime < 0.38.2
    Fixed in
    0.38.2· Vendor fix available
    Issue
    Impact There was a bug in Wasmtime's code generator, Cranelift, for AArch64 targets where constant divisors could result in incorrect division results at runtime. The translation rules for constants did not take into account whether sign- or zero-extension should happen, which resulted in an incorrect value being placed into a register when a division was encountered. For example, a constant 32-bit unsigned divisor of 0xfffffffe would be incorrectly sign-extended to 64-bits to 0xfffffffffffffffe. Any kind of division of operands smaller than 64 bits is implemented with a 64-bit division instruction which would then result in an incorrect result because the divisor was larger than expected. The impact of this bug is that programs executing within the WebAssembly sandbox would not behave according to the WebAssembly specification. This means that it is hypothetically possible for execution within the sandbox to go awry and WebAssembly programs could produce unexpected results. This…

    Recommended action: Upgrade to 0.38.2 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  8. Medium, CVSS 6.4crates.ioPublished

    Wasmtime vulnerable to Use After Free with externrefs

    CVE-2022-31146 · GHSA-5fhj-g3p3-pq9g

    Affected
    • crates.io wasmtime >= 0.37.0, < 0.38.2
    Fixed in
    0.38.2· Vendor fix available
    Issue
    There is a bug in Wasmtime's code generator, Cranelift, where functions using reference types may be incorrectly missing metadata required for runtime garbage collection (GC). This means that if a GC happens at runtime then the collector will mistakenly think some Wasm stack frames do not have live references to garbage collected values and therefore reclaim and deallocate them. The function can then subsequently continue to use the values, leading later to use-after-free bugs. This bug was introduced in Cranelift's migration to the regalloc2 register allocator in the Wasmtime 0.37.0 release on 2022-05-20. This bug has been patched and users should upgrade to Wasmtime version 0.38.2. Mitigations for this issue can be achieved by doing one of: Disabling the reference types proposal by passing false to wasmtime::Config::wasmreferencetypes. Downgrading to Wasmtime 0.36.0 or prior.

    Recommended action: Upgrade to 0.38.2 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  9. Medium, CVSS 4.8crates.ioPublished

    Miscompilation of i8x16.swizzle and select with v128 inputs

    CVE-2022-31104 · GHSA-jqwc-c49r-4w2x

    Affected
    • crates.io wasmtime < 0.38.1
    Fixed in
    0.38.1· Vendor fix available
    Issue
    Impact Wasmtime's implementation of the SIMD proposal for WebAssembly on x8664 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…

    Recommended action: Upgrade to 0.38.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  10. High, CVSS 8.1crates.ioPublished

    Use after free in Wasmtime

    CVE-2022-24791 · GHSA-gwc9-348x-qwv2

    Affected
    • crates.io wasmtime < 0.34.2; >= 0.35.0, < 0.35.2
    Fixed in
    0.34.20.35.2· Vendor fix available
    Issue
    There is a use after free vulnerability in Wasmtime when both running Wasm that uses externrefs and enabling epoch interruption in Wasmtime. If you are not explicitly enabling epoch interruption (it is disabled by default) then you are not affected. If you are explicitly disabling the Wasm reference types proposal (it is enabled by default) then you are also not affected. The use after free is caused by Cranelift failing to emit stack maps when there are safepoints inside cold blocks. Cold blocks occur when epoch interruption is enabled. Cold blocks are emitted at the end of compiled functions, and change the order blocks are emitted versus defined. This reordering accidentally caused Cranelift to skip emitting some stack maps because it expected to emit the stack maps in block definition order, rather than block emission order. When Wasmtime would eventually collect garbage, it would fail to find live references on the stack because of the missing stack maps, think that they were…

    Recommended action: Upgrade to 0.35.2 or 0.34.2 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  11. Medium, CVSS 5.1crates.ioPublished

    Invalid drop of partially-initialized instances in the pooling instance allocator for modules with defined externref globals

    CVE-2022-23636 · GHSA-88xq-w8cq-xfg7

    Affected
    • crates.io wasmtime >= 0.34.0, <= 0.34.0; < 0.33.1
    Fixed in
    0.34.10.33.1· Vendor fix available
    Issue
    Impact There exists a bug in the pooling instance allocator in Wasmtime's runtime where a failure to instantiate an instance for a module that defines an externref global will result in an invalid drop of a VMExternRef via an uninitialized pointer. As instance slots may be reused between consecutive instantiations, the value of the uninitialized pointer may be from a previous instantiation and therefore under the control of an attacker via a module's initial values for its globals. If the attacker can somehow determine an address under their control inside the mapped memory representing the instance pool, it is possible to trick the runtime to call dropinplace on a trait object under the attacker's control and therefore cause remote code execution. Exploiting the bug to cause remote code execution would be very difficult as attackers cannot determine the addresses of globals from code executing within the WebAssembly VM and the memory space for the instance pool cannot be statically…

    Recommended action: Upgrade to 0.34.1 or 0.33.1 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  12. Medium, CVSS 5.8crates.ioAmendedPublished

    Use after free passing externrefs to Wasm in Wasmtime

    CVE-2021-39216 · GHSA-4873-36h9-wv49

    Affected
    • crates.io wasmtime < 0.30.0
    Fixed in
    0.30.0· Vendor fix available
    Issue
    Impact There was a use-after-free bug when passing `externref`s from the host to guest Wasm content. To trigger the bug, you have to explicitly pass multiple `externref`s from the host to a Wasm instance at the same time, either by * passing multiple `externref`s as arguments from host code to a Wasm function, * or returning multiple `externref`s to Wasm from a multi-value return function defined in the host. If you do not have host code that matches one of these shapes, then you are not impacted. If Wasmtime's `VMExternRefActivationsTable` became filled to capacity after passing the first `externref` in, then passing in the second `externref` could trigger a garbage collection. However the first `externref` is not rooted until we pass control to Wasm, and therefore could be reclaimed by the collector if nothing else was holding a reference to it or…

    Recommended action: Upgrade to 0.30.0 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)osv.dev (2)osv.dev (3)Source checked Evidence →