GHSA-hc7m-r6v8-hg9q

Suggest an improvement
Source
https://github.com/advisories/GHSA-hc7m-r6v8-hg9q
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/11/GHSA-hc7m-r6v8-hg9q/GHSA-hc7m-r6v8-hg9q.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-hc7m-r6v8-hg9q
Aliases
Published
2025-11-12T21:36:29Z
Modified
2025-11-13T22:02:14Z
Severity
  • 1.8 (Low) CVSS_V3 - CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:N/I:L/A:N CVSS Calculator
Summary
Wasmtime provides unsound API access to a WebAssembly shared linear memory
Details

Impact

Wasmtime's Rust embedder API contains an unsound interaction where a WebAssembly shared linear memory could be viewed as a type which provides safe access to the host (Rust) to the contents of the linear memory. This is not sound for shared linear memories, which could be modified in parallel, and this could lead to a data race in the host.

Wasmtime has a wasmtime::Memory type which represents linear memories in a WebAssembly module. Wasmtime also has wasmtime::SharedMemory, however, which represents shared linear memories introduced in the WebAssembly threads proposal. The API of SharedMemory does not provide accessors which return &[u8] in Rust, for example, as that's not a sound type signature when other threads could be modifying memory. The wasmtime::Memory type, however, does provide this API as it's intended to be used with non-shared memories where static knowledge is available that no concurrent or parallel reads or writes are happening. This means that it's not sound to represent a shared linear memory with wasmtime::Memory and it must instead be represented with wasmtime::SharedMemory.

There were two different, erroneous, methods of creating a wasmtime::Memory which represents a shared memory however:

  1. The <code>wasmtime::Memory::new</code> constructor takes a MemoryType which could be shared. This function did not properly reject shared memory types and require usage of <code>SharedMemory::new</code> instead.
  2. Capturing a core dump with WebAssembly would expose all linear memories a wasmtime::Memory. This means that a core dump would perform an unsynchronized read of shared linear memory, possibly leading to data races.

This is a bug in Wasmtime's safe Rust API. It should not be possible to cause unsoundness with Wasmtime's embedding API if unsafe is not used. Embeddings which do not use the wasm threads proposal nor created shared memories nor actually share shared memories across threads are unaffected. Only if shared memories are created across threads might an embedding be affected.

Patches

Patch releases have been issued for all supported versions of Wasmtime, notably: 24.0.5, 36.0.3, 37.0.3, and 38.0.4. These releases reject creation of shared memories via Memory::new and shared memories are now excluded from core dumps.

Workarounds

Embeddings affected by this issue should use SharedMemory::new instead of Memory::new to create shared memories. Affected embeddings should also disable core dumps if they are unable to upgrade. Note that core dumps are disabled by default but the wasm threads proposal (and shared memory) is enabled by default. It's recommended to upgrade to a patched version of Wasmtime, however.

Database specific
{
    "severity": "LOW",
    "cwe_ids": [
        "CWE-362"
    ],
    "nvd_published_at": "2025-11-12T22:15:49Z",
    "github_reviewed_at": "2025-11-12T21:36:29Z",
    "github_reviewed": true
}
References

Affected packages

crates.io / wasmtime

Package

Affected ranges

Type
SEMVER
Events
Introduced
38.0.0
Fixed
38.0.4

crates.io / wasmtime

Package

Affected ranges

Type
SEMVER
Events
Introduced
37.0.0
Fixed
37.0.3

crates.io / wasmtime

Package

Affected ranges

Type
SEMVER
Events
Introduced
26.0.0
Fixed
36.0.3

crates.io / wasmtime

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
24.0.5