Wasmtime has host panic with `fd_renumber` WASIp1 function
bytecodealliance wasmtime
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| wasmtime-wasi crates.io |
|
|
| wasmtime crates.io |
bytecodealliance wasmtime
| Product | Affected | Fixed in |
|---|---|---|
| wasmtime-wasi crates.io |
|
|
| wasmtime crates.io |
≥ 10.0.0 · < 24.0.4≥ 33.0.0 · < 33.0.2≥ 34.0.0 · < 34.0.2≥ 25.0.0 · < 33.0.2
|
Wasmtime is a runtime for WebAssembly. Prior to versions 24.0.4, 33.0.2, and 34.0.2, a bug in Wasmtime's implementation of the WASIp1 set of import functions can lead to a WebAssembly guest inducing a panic in the host (embedder). The specific bug is triggered by calling `path_open` after calling `fd_renumber` with either two equal argument values or a second argument being equal to a previously-closed file descriptor number value. The corrupt state introduced in `fd_renumber` will lead to the subsequent opening of a file descriptor to panic. This panic cannot introduce memory unsafety or allow WebAssembly to break outside of its sandbox, however. There is no possible heap corruption or memory unsafety from this panic. This bug is in the implementation of Wasmtime's `wasmtime-wasi` crate which provides an implementation of WASIp1. The bug requires a specially crafted call to `fd_renumber` in addition to the ability to open a subsequent file descriptor. Opening a second file descriptor is only possible when a preopened directory was provided to the guest, and this is common amongst embeddings. A panic in the host is considered a denial-of-service vector for WebAssembly embedders and is thus a security issue in Wasmtime. This bug does not affect WASIp2 and embedders using components. In accordance with Wasmtime's release process, patch releases are available as 24.0.4, 33.0.2, and 34.0.2. Users of other release of Wasmtime are recommended to move to a supported release of Wasmtime. Embedders who are using components or are not providing guest access to create more file descriptors (e.g. via a preopened filesystem directory) are not affected by this issue. Otherwise, there is no workaround at this time, and affected embeddings are recommended to update to a patched version which will not cause a panic in the host.
From the CVE record · GitHub_M
A bug in Wasmtime's WASIp1 file-descriptor handling lets a WebAssembly guest trigger a host panic by making a crafted `fd_renumber` call followed by `path_open`. This requires the guest to be able to open another file descriptor, such as through a preopened directory. The panic can deny service but cannot break the WebAssembly sandbox or cause memory unsafety; WASIp2 components are not affected.
Engineers running affected versions of the crates.io `wasmtime` or `wasmtime-wasi` packages should check embeddings that provide guests with access to open file descriptors.