Skip to main content
Menu
Advisories

Wasmtime may not properly enforce async-entrypoint requirement

GHSA-VCG5-Q8M5-8379Published Updated GitHub

Description

A Store in Wasmtime has insufficient checks when mixing async-style and sync-style calls into WebAssembly when the store otherwise does not require async calls to be performed. This can lead to arbitrary host code being suspended and moved across threads, which can be unsound with !Send local variables for example, or internal panics within the runtime itself due to unexpected scenarios being hit.

Impact

This bug can lead to panics within the runtime in certain scheduling situations. This bug can additionally lead to unsoundness in arbitrary host code if !Send variables, such as Rc<T>, are present on the stack. Wasmtime typically statically disallows this at compile time, but the missing checks for this issue failed to check this condition.

This bug is not controllable from guest-code, however, and requires the host to manually re-enter WebAssembly from host functions via sync-style APIs while originally calling WebAssembly via async-style APIs. This vulnerability requires this specific shape of embedder code to be written or otherwise this is inapplicable. If an embedder doesn't use async at all, then they are unaffected.

All preexisting versions of Wasmtime after 42.0.0 are affected by this issue.

Patches

Wasmtime 48.0.6 and 49.0.3 have been released fixing this issue.

Workarounds

If the store otherwise requires async entrypoints to be used, such as an async host function being defined, will correctly require all entrypoints to use async.

Affected versions

References

GitHub · bytecodealliance/wasmtime