Skip to content

CVE-2024-47813 Wasmtime race condition could lead to WebAssembly control-flow integrity and type safety violations

LowCVSS 2.9 EPSS 0.15%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: partial
Technology
UbuntuDebian

Description

Wasmtime is an open source runtime for WebAssembly. Under certain concurrent event orderings, a wasmtime::Engine's internal type registry was susceptible to double-unregistration bugs due to a race condition, leading to panics and potentially type registry corruption. That registry corruption could, following an additional and particular sequence of concurrent events, lead to violations of WebAssembly's control-flow integrity (CFI) and type safety. Users that do not use wasmtime::Engine across multiple threads are not affected. Users that only create new modules across threads over time are additionally not affected. Reproducing this bug requires creating and dropping multiple type instances (such as wasmtime::FuncType or wasmtime::ArrayType) concurrently on multiple threads, where all types are associated with the same wasmtime::Engine. Wasm guests cannot trigger this bug. See the "References" section below for a list of Wasmtime types-related APIs that are affected. Wasmtime maintains an internal registry of types within a wasmtime::Engine and an engine is shareable across threads. Types can be created and referenced through creation of a wasmtime::Module, creation of wasmtime::FuncType, or a number of other APIs where the host creates a function (see "References" below). Each of these cases interacts with an engine to deduplicate type information and manage type indices that are used to implement type checks in WebAssembly's call_indirect function, for example. This bug is a race condition in this management where the internal type registry could be corrupted to trigger an assert or contain invalid state. Wasmtime's internal representation of a type has individual types (e.g. one-per-host-function) maintain a registration count of how many time it's been used. Types additionally have state within an engine behind a read-write lock such as lookup/deduplication information. The race here is a time-of-check versus time-of-use (TOCTOU) bug where one thread atomically decrements a type entry's registration count, observes zero registrations, and then acquires a lock in order to unregister that entry. However, between when this first thread observed the zero-registration count and when it acquires that lock, another thread could perform the following sequence of events: re-register another copy of the type, which deduplicates to that same entry, resurrecting it and incrementing its registration count; then drop the type and decrement its registration count; observe that the registration count is now zero; acquire the type registry lock; and finally unregister the type. Now, when the original thread finally acquires the lock and unregisters the entry, it is the second time this entry has been unregistered. This bug was originally introduced in Wasmtime 19's development of the WebAssembly GC proposal. This bug affects users who are not using the GC proposal, however, and affects Wasmtime in its default configuration even when the GC proposal is disabled. Wasmtime users using 19.0.0 and after are all affected by this issue. We have released the following Wasmtime versions, all of which have a fix for this bug: * 21.0.2 * 22.0.1 * 23.0.3 * 24.0.1 * 25.0.2. If your application creates and drops Wasmtime types on multiple threads concurrently, there are no known workarounds. Users are encouraged to upgrade to a patched release.

Upgrade path

8 packages: 4 fixed, 3 with no fix yet.

PackageAffectedFixed inStatus
ubuntu/rust-wasmtime(Ubuntu 24.04) All versions No fix listed No fix yet
ubuntu/rust-wasmtime(Ubuntu 26.04) All versions No fix listed No fix yet
ubuntu/rust-wasmtime(Ubuntu 26.10) All versions No fix listed No fix yet
crates.io wasmtime(crates.io) >= 19.0.0, < 21.0.2; >= 22.0.0, < 22.0.1; >= 23.0.0, < 23.0.3; >= 24.0.0, < 24.0.1 +1 more 21.0.2, 22.0.1, 23.0.3, 24.0.1, 25.0.2 Fixed
debian/rust-wasmtime(Debian 13) < 21.0.2+dfsg-1 21.0.2+dfsg-1 Fixed
debian/rust-wasmtime(Debian 14) < 21.0.2+dfsg-1 21.0.2+dfsg-1 Fixed
pypi wasmtime(PyPI) <= 19.0.0; <= 19.0.1; <= 19.0.2; <= 20.0.0 +79 more after 19.0.0, 19.0.1, 19.0.2, 20.0.0, 20.0.1, 20.0.2, 21.0.0, 21.0.1, 22.0.0, 23.0.0, 23.0.1, 23.0.2, 24.0.0, 25.0.0, 25.0.1 Fixed
bytecodealliance wasmtime = 19.0.0; = 19.0.1; = 19.0.2; = 20.0.0 +16 more No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
pypi wasmtime(PyPI) <= 19.0.0 No fix listed
pypi wasmtime(PyPI) <= 19.0.1 No fix listed
pypi wasmtime(PyPI) <= 19.0.2 No fix listed
pypi wasmtime(PyPI) <= 20.0.0 No fix listed
pypi wasmtime(PyPI) <= 20.0.1 No fix listed
pypi wasmtime(PyPI) <= 20.0.2 No fix listed
pypi wasmtime(PyPI) <= 21.0.0 No fix listed
pypi wasmtime(PyPI) <= 21.0.1 No fix listed
pypi wasmtime(PyPI) <= 22.0.0 No fix listed
pypi wasmtime(PyPI) <= 23.0.0 No fix listed
pypi wasmtime(PyPI) <= 23.0.1 No fix listed
pypi wasmtime(PyPI) <= 23.0.2 No fix listed
pypi wasmtime(PyPI) <= 24.0.0 No fix listed
pypi wasmtime(PyPI) <= 25.0.0 No fix listed
pypi wasmtime(PyPI) <= 25.0.1 No fix listed
pypi wasmtime(PyPI) = 0.0.1 No fix listed
pypi wasmtime(PyPI) = 0.0.2 No fix listed
pypi wasmtime(PyPI) = 0.11.0 No fix listed
pypi wasmtime(PyPI) = 0.12.0 No fix listed
pypi wasmtime(PyPI) = 0.15.0 No fix listed
pypi wasmtime(PyPI) = 0.15.1 No fix listed
pypi wasmtime(PyPI) = 0.16.0 No fix listed
pypi wasmtime(PyPI) = 0.16.1 No fix listed
pypi wasmtime(PyPI) = 0.17.0 No fix listed
pypi wasmtime(PyPI) = 0.18.0 No fix listed
Show 88 more
ProductAffected versionsFixed in
pypi wasmtime(PyPI) = 0.18.1 No fix listed
pypi wasmtime(PyPI) = 0.18.2 No fix listed
pypi wasmtime(PyPI) = 0.19.0 No fix listed
pypi wasmtime(PyPI) = 0.20.0 No fix listed
pypi wasmtime(PyPI) = 0.21.0 No fix listed
pypi wasmtime(PyPI) = 0.22.0 No fix listed
pypi wasmtime(PyPI) = 0.23.0 No fix listed
pypi wasmtime(PyPI) = 0.24.0 No fix listed
pypi wasmtime(PyPI) = 0.25.0 No fix listed
pypi wasmtime(PyPI) = 0.26.0 No fix listed
pypi wasmtime(PyPI) = 0.27.0 No fix listed
pypi wasmtime(PyPI) = 0.28.0 No fix listed
pypi wasmtime(PyPI) = 0.28.1 No fix listed
pypi wasmtime(PyPI) = 0.29.0 No fix listed
pypi wasmtime(PyPI) = 0.30.0 No fix listed
pypi wasmtime(PyPI) = 0.31.0 No fix listed
pypi wasmtime(PyPI) = 0.32.0 No fix listed
pypi wasmtime(PyPI) = 0.33.0 No fix listed
pypi wasmtime(PyPI) = 0.34.0 No fix listed
pypi wasmtime(PyPI) = 0.35.0 No fix listed
pypi wasmtime(PyPI) = 0.36.0 No fix listed
pypi wasmtime(PyPI) = 0.37.0 No fix listed
pypi wasmtime(PyPI) = 0.38.0 No fix listed
pypi wasmtime(PyPI) = 0.39.1 No fix listed
pypi wasmtime(PyPI) = 0.40.0 No fix listed
pypi wasmtime(PyPI) = 0.9.0 No fix listed
pypi wasmtime(PyPI) = 1.0.0 No fix listed
pypi wasmtime(PyPI) = 1.0.1 No fix listed
pypi wasmtime(PyPI) = 10.0.0 No fix listed
pypi wasmtime(PyPI) = 10.0.1 No fix listed
pypi wasmtime(PyPI) = 11.0.0 No fix listed
pypi wasmtime(PyPI) = 12.0.0 No fix listed
pypi wasmtime(PyPI) = 13.0.0 No fix listed
pypi wasmtime(PyPI) = 13.0.1 No fix listed
pypi wasmtime(PyPI) = 13.0.2 No fix listed
pypi wasmtime(PyPI) = 14.0.0 No fix listed
pypi wasmtime(PyPI) = 15.0.0 No fix listed
pypi wasmtime(PyPI) = 16.0.0 No fix listed
pypi wasmtime(PyPI) = 17.0.0 No fix listed
pypi wasmtime(PyPI) = 17.0.1 No fix listed
pypi wasmtime(PyPI) = 18.0.0 No fix listed
pypi wasmtime(PyPI) = 18.0.2 No fix listed
pypi wasmtime(PyPI) = 19.0.0 No fix listed
pypi wasmtime(PyPI) = 2.0.0 No fix listed
pypi wasmtime(PyPI) = 20.0.0 No fix listed
pypi wasmtime(PyPI) = 21.0.0 No fix listed
pypi wasmtime(PyPI) = 22.0.0 No fix listed
pypi wasmtime(PyPI) = 23.0.0 No fix listed
pypi wasmtime(PyPI) = 24.0.0 No fix listed
pypi wasmtime(PyPI) = 25.0.0 No fix listed
pypi wasmtime(PyPI) = 3.0.0 No fix listed
pypi wasmtime(PyPI) = 4.0.0 No fix listed
pypi wasmtime(PyPI) = 5.0.0 No fix listed
pypi wasmtime(PyPI) = 6.0.0 No fix listed
pypi wasmtime(PyPI) = 7.0.0 No fix listed
pypi wasmtime(PyPI) = 8.0.0 No fix listed
pypi wasmtime(PyPI) = 8.0.1 No fix listed
pypi wasmtime(PyPI) = 9.0.0 No fix listed
crates.io wasmtime(crates.io) >= 19.0.0, < 21.0.2 21.0.2
crates.io wasmtime(crates.io) >= 22.0.0, < 22.0.1 22.0.1
crates.io wasmtime(crates.io) >= 23.0.0, < 23.0.3 23.0.3
crates.io wasmtime(crates.io) >= 24.0.0, < 24.0.1 24.0.1
crates.io wasmtime(crates.io) >= 25.0.0, < 25.0.2 25.0.2
debian/rust-wasmtime(Debian:13) < 21.0.2+dfsg-1 21.0.2+dfsg-1
debian/rust-wasmtime(Debian:14) < 21.0.2+dfsg-1 21.0.2+dfsg-1
bytecodealliance wasmtime = >= 19.0.0, < 21.0.2 No fix listed
bytecodealliance wasmtime = >= 22.0.0, < 22.0.1 No fix listed
bytecodealliance wasmtime = >= 23.0.0, < 23.0.3 No fix listed
bytecodealliance wasmtime = >= 24.0.0, < 24.0.1 No fix listed
bytecodealliance wasmtime = >= 25.0.0, < 25.0.2 No fix listed
ubuntu/rust-wasmtime(Ubuntu:24.04) All versions No fix listed
bytecodealliance wasmtime = 19.0.0 No fix listed
bytecodealliance wasmtime = 19.0.1 No fix listed
bytecodealliance wasmtime = 19.0.2 No fix listed
bytecodealliance wasmtime = 20.0.0 No fix listed
bytecodealliance wasmtime = 20.0.1 No fix listed
bytecodealliance wasmtime = 20.0.2 No fix listed
bytecodealliance wasmtime = 21.0.0 No fix listed
bytecodealliance wasmtime = 21.0.1 No fix listed
bytecodealliance wasmtime = 22.0.0 No fix listed
bytecodealliance wasmtime = 23.0.0 No fix listed
bytecodealliance wasmtime = 23.0.1 No fix listed
bytecodealliance wasmtime = 23.0.2 No fix listed
bytecodealliance wasmtime = 24.0.0 No fix listed
bytecodealliance wasmtime = 25.0.0 No fix listed
bytecodealliance wasmtime = 25.0.1 No fix listed
ubuntu/rust-wasmtime(Ubuntu:26.04) All versions No fix listed
ubuntu/rust-wasmtime(Ubuntu:26.10) All versions No fix listed

References