Wasmtime: Preemption and traps during bulk operations enable breaking internal VM state
What fixes it
- 46.0.2wasmtime, rustGitHub
- 47.0.3wasmtime, rustGitHub
- 46.0.2wasmtime, crates.ioOSV
cargo update -p wasmtime --precise 46.0.2 - 47.0.3wasmtime, crates.ioOSV
cargo update -p wasmtime --precise 47.0.3
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
Impact
Wasmtime's implementation of bulk-data-transfer WebAssembly instructions, such as memory.copy, contains a vulnerability when a preemption via epochs or fuel is combined with altering the store's state or cancelling a computation. To prevent these operations from taking too long Wasmtime injects fuel/epoch checks during these operations, but this enables embedders, and possible WebAssembly, to witness intermediate state in the middle of the operation. Examples of this include:
- When a non-nullable WebAssembly table is grown the new elements initially start as null and are filled in as part of a loop with preemption checks. If this computation is then cancelled this left the table in a grown-but-uninitialized state where subsequent usage via WebAssembly could possibly segfault. Loads from this table are assumed to not be null due to its type, but the runtime implementation was exposed through this cancellation at a preemption point.
- Embedders could mutate the store during an epoch callback, such as growing a WebAssembly linear memory. During a bulk
memory.copyoperation, however, the pointers being copied to/from weren't recomputed between preemption points. This meant that if the linear memory moved its base address it could be possible to have a preemption, the embedder manually grows memory, and then on resumption the copy operation uses invalid pointers. - Embedders could execute a GC during epoch callbacks. GC operations such as
array.copy, likememory.copyabove, maintained raw pointers internally in the operation which were not updated after the preemption point. This could lead to corruption of the GC heap.
All of these situations are examples of embedder-driven mutations of the Store or embedder-induced resumption of a Store after a computation was cancelled. These operations expose the internal state of these WebAssembly operations which is semantically incorrect and additionally can cause segfaults for example. Exposing these bugs, however, requires explicit patterns to be present in the embedding itself such as using Store::epoch_deadline_callback and mutating wasm options. Another example is to cancel one invocation (possibly in a table.grow) and then execute more wasm afterwards within the same store. Embeddings not using Store::epoch_deadline_callback or executing code after timeouts/fuel are not affected by this issue.
Patches
This issue is fixed in Wasmtime 46.0.2 and 47.0.3. In these versions Wasmtime reverts back to Wasmtime 45-and-earlier behavior for these operations to check fuel once before the operation and then not during the operation. This means that a very large memory.copy does not have preemption points in the middle of the operation any more, for example.
Workarounds
Embedders using Store::epoch_deadline_callback are safe if they only access the T in Store<T>. Embedders that do not continue using a store after a timeout or epoch deadline are also unaffected. Embedders which explicitly mutate the store in an epoch callback, or resume wasm after trapping have no workaround however. The embedding needs to be updated to account for this issue.
Text from GitHub Advisory Database
Affected versions 6
- wasmtime, rust>= 46.0.0, < 46.0.2GitHub
- wasmtime, rust>= 47.0.0, < 47.0.3GitHub
- wasmtimeaffected: >= 46.0.0, < 46.0.2CVE List
- wasmtimeaffected: >= 47.0.0, < 47.0.3CVE List
- wasmtime, crates.iofrom 46.0.0, fixed in 46.0.2OSV
- wasmtime, crates.iofrom 47.0.0, fixed in 47.0.3OSV
References 12
- github.com/bytecodealliance/wasmtime/commit/3ebfbe5af4927c157d6fcaca42b8dbb6d17b73fbFixvia CVE List
- github.com/bytecodealliance/wasmtime/commit/99b0bc39d447317a4102c056081c83a9a84a46e0Fixvia CVE List
- github.com/bytecodealliance/wasmtime/commit/a3eb27af01ba5a30320a90ea1405059cdfedd353Fixvia CVE List
- github.com/bytecodealliance/wasmtime/releases/tag/v46.0.2Fixvia CVE List
- github.com/bytecodealliance/wasmtime/releases/tag/v47.0.3Fixvia CVE List
- github.com/bytecodealliance/wasmtime/security/advisories/GHSA-2hw9-mc66-jc2qAdvisoryvia CVE List
- rustsec.org/advisories/RUSTSEC-2026-0223.htmlAdvisoryvia GitHub
- github.com/advisories/GHSA-2hw9-mc66-jc2qAdvisoryvia GitHub
- nvd.nist.gov/vuln/detail/CVE-2026-104855Referencevia GitHub
- github.com/bytecodealliance/wasmtime/pull/14041Referencevia CVE List
- github.com/bytecodealliance/wasmtime/pull/14043Referencevia CVE List
- github.com/bytecodealliance/wasmtime/pull/14045Referencevia CVE List