Cloudanix VulnDB

CVE-2024-47763

Medium · 5.5

wasmtime has a runtime crash when combining tail calls with trapping imports

CVSS

5.5

EPSS

0.2%

Published

Oct 9, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A flaw in a WebAssembly runtime lets specially crafted code crash the host program, interrupting any service that runs such code.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Moderate
Impact
Denial Of Service
Component
Library
Class
Denial of service
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

A malicious WebAssembly module using tail-call instructions (return_call, return_call_indirect, return_call_ref) to an imported host function that captures a stack trace triggers an internal assert in Wasmtime's stack-walking code, resulting in a Rust panic that manifests as a deterministic process abort (or undefined behavior on older Rust versions).

Why it matters to the business

Services or applications embedding Wasmtime can be taken offline by untrusted WebAssembly code, causing availability loss; the issue affects any deployment that accepts arbitrary WASM modules or components and has not yet upgraded.

How an attack unfolds

An attacker supplies a WebAssembly module or component that exports a function performing a tail call into a host function (for example one that raises a trap). The entry trampoline appears to call the exit trampoline directly, violating the stack-walking assumption of at least one WASM frame and causing the runtime to abort.

How to fix it

Upgrade bytecodealliance/wasmtime to commit 70ceccd40ecf882908571933b996690f359f0021 or later; for org.apache.nifi:nifi upgrade to 1.3.0 or 0.7.4 (or later releases containing the fixed Wasmtime dependency).

How to confirm the fix worked

Confirm the Wasmtime version or commit hash in the running binary; execute a minimal test module exercising return_call to a trapping host function and verify the process no longer aborts.

Typical attack path

  1. Craft or obtain a WebAssembly module containing a tail-call to an imported host function that captures a stack trace
  2. Load the module into an unpatched Wasmtime instance
  3. Invoke the exported function to trigger the tail call
  4. Observe deterministic process abort

How to detect it

Review application and system logs for abrupt Wasmtime process terminations around the time of WebAssembly module loading or execution; correlate with any fuzzing or untrusted module ingestion activity.

What your security team should do

  • Prioritize upgrade of all Wasmtime deployments that accept untrusted modules
  • Add runtime monitoring for unexpected Wasmtime process exits
  • Restrict execution of untrusted WebAssembly until patched

The record

Wasmtime's implementation of WebAssembly tail calls combined with stack traces can result in a runtime crash in certain WebAssembly modules. The runtime crash may be undefined behavior if Wasmtime was compiled with Rust 1.80 or prior. The runtime crash is a deterministic process abort when Wasmtime is compiled with Rust 1.81 and later. [WebAssembly tail calls](https://github.com/webassembly/tail-call) are a proposal which relatively recently reached stage 4 in the [standardization process](https://github.com/WebAssembly/proposals/). Wasmtime first enabled support for tail calls by default [in Wasmtime 21.0.0](https://github.com/bytecodealliance/wasmtime/pull/8540), although that release contained a bug where it was only on-by-default for some configurations. In [Wasmtime 22.0.0](https://github.com/bytecodealliance/wasmtime/pull/8682) tail calls were enabled by default for all configurations. The specific crash happens when an exported function in a WebAssembly module (or component) performs a `return_call` (or `return_call_indirect` or `return_call_ref`) to an imported host function which captures a stack trace (for example, the host function raises a trap). In this situation, the stack-walking code previously assumed there was always at least one WebAssembly frame on the stack but with tail calls that is no longer true. With the tail-call proposal it's possible to have an entry trampoline appear as if it directly called the exit trampoline. This situation triggers an internal assert in the stack-walking code which raises a Rust `panic!()`. When Wasmtime is compiled with Rust versions 1.80 and prior this means that an `extern "C"` function in Rust is raising a `panic!()`. This is technically undefined behavior and typically manifests as a process abort when the unwinder fails to unwind Cranelift-generated frames. When Wasmtime is compiled with Rust versions 1.81 and later this panic becomes a deterministic process abort. Overall the impact of this issue is that this is a denial-of-service vector where a malicious WebAssembly module or component can cause the host to crash. There is no other impact at this time other than availability of a service as the result of the crash is always a crash and no more. This issue was discovered by routine fuzzing performed by the Wasmtime project via Google's OSS-Fuzz infrastructure. We have no evidence that it has ever been exploited by an attacker in the wild.

Affected packages

Ecosystem Package Introduced Fixed
crates.io wasmtime 12.0.0 21.0.2
crates.io wasmtime 21.0.0 21.0.2
crates.io wasmtime 22.0.0 22.0.1
crates.io wasmtime 23.0.0 23.0.3
crates.io wasmtime 24.0.0 24.0.1
crates.io wasmtime 25.0.0 25.0.2
Chainguard wash 0 0.34.1-r2
Chainguard wasmcloud 0 1.3.0-r1
Chainguard wizer 0 7.0.5-r1
Chainguard zed 0 0.156.0-r1
Debian:13 rust-wasmtime 0 21.0.2+dfsg-1
Debian:14 rust-wasmtime 0 21.0.2+dfsg-1
Ubuntu:24.04:LTS rust-wasmtime 0 No fix
Ubuntu:24.10 rust-wasmtime 0 No fix
Ubuntu:25.04 rust-wasmtime 0 No fix
Ubuntu:25.10 rust-wasmtime 0 No fix
Wolfi wash 0 0.34.1-r2
Wolfi wasmcloud 0 1.3.0-r1
Wolfi wizer 0 7.0.5-r1
Wolfi zed 0 0.156.0-r1
cargo wasmtime 12.0.0 21.0.2
cargo wasmtime 22.0.0 22.0.1
cargo wasmtime 23.0.0 23.0.3
cargo wasmtime 24.0.0 24.0.1
cargo wasmtime 25.0.0 25.0.2

Related vulnerabilities