Read the docs
TI-2025-38103 Aliases CVE-2025-61670GHSA-vvp9-h8p2-xwfc

Wasmtime has memory leak in C API with `externref` and `anyref` types

Priority LOW 6CWE-772Published · Updated

Key facts

Attack vector
Adjacent network
Privileges required
Low
User interaction
Passive
Attack complexity
Low
Attack requirements
Present
Impact type
Denial of service
Confidentiality · integrity · availability
None · None · Low
Fix status
Fixed

Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub. Impact type from CWE-772.

Summary

Wasmtime is a runtime for WebAssembly. Wasmtime 37.0.0 and 37.0.1 have memory leaks in the C/C++ API when using bindings for the `anyref` or `externref` WebAssembly values. This is caused by a regression introduced during the development of 37.0.0 and all prior versions of Wasmtime are unaffected. If `anyref` or `externref` is not used in the C/C++ API then embeddings are also unaffected by the leaky behavior. The `wasmtime` Rust crate is unaffected by this leak. Development of Wasmtime 37.0.0 included a refactoring in Rust of changing the old `ManuallyRooted<T>` type to a new `OwnedRooted<T>` type. This change was integrated into Wasmtime's C API but left the C API in a state which had memory leaks. Additionally the new ownership semantics around this type were not reflected into the C++ API, making it leak-prone. A short version of the change is that previously `ManuallyRooted<T>`, as the name implies, required manual calls to an "unroot" operation. If this was forgotten then the memory was still cleaned up when the `wasmtime_store_t` itself was destroyed eventually. Documentation of when to "unroot" was sparse and there were already situations prior to 37.0.0 where memory would be leaked until the store was destroyed anyway. All memory, though, was always bound by the store, and destroying the store would guarantee that there were no memory leaks. In migrating to `OwnedRooted<T>` the usage of the type in Rust changed. A manual "unroot" operation is no longer required and it happens naturally as a destructor of the `OwnedRooted<T>` type in Rust itself. These new resource ownership semantics were not fully integrated into the preexisting semantics of the C/C++ APIs in Wasmtime. A crucial distinction of `OwnedRooted<T>` vs `ManuallyRooted<T>` is that the `OwnedRooted<T>` type allocates host memory outside of the store. This means that if an `OwnedRooted<T>` is leaked then destroying a store does not release this memory and it's a permanent memory leak on the host. This led to a few distinct, but related, issues arising: A typo in the `wasmtime_val_unroot` function in the C API meant that it did not actually unroot anything. This meant that even if embedders faithfully call the function then memory will be leaked. If a host-defined function returned a `wasmtime_{externref,anyref}_t` value then the value was never unrooted. The C/C++ API no longer has access to the value and the Rust implementation did not unroot. This meant that any values returned this way were never unrooted. The goal of the C++ API of Wasmtime is to encode automatic memory management in the type system, but the C++ API was not updated when `OwnedRooted<T>` was added. This meant that idiomatic usage of the C++ API would leak memory due to a lack of destructors on values. These issues have all been fixed in a 37.0.2 release of Wasmtime. The implementation of the C and C++ APIs have been updated accordingly and respectively to account for the changes of ownership here. For example `wasmtime_val_unroot` has been fixed to unroot, the Rust-side implementation of calling an embedder-defined function will unroot return values, and the C++ API now has destructors on the `ExternRef`, `AnyRef`, and `Val` types. These changes have been made to the 37.0.x release branch in a non-API-breaking fashion. Changes to the 38.0.0 release branch (and `main` in the Wasmtime repository) include minor API updates to better accommodate the API semantic changes. The only known workaround at this time is to avoid using `externref` and `anyref` in the C/C++ API of Wasmtime. If avoiding those types is not possible then it's required for users to update to mitigate the leak issue.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00195 9th percentileScored 2026-11-07
Fix Fixed wasmtime (bytecodealliance): 37.0.2wasmtime-c-api-impl (crates.io): 37.0.2+1 more product

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Partial

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
bytecodealliancewasmtime37.0.0 to before 37.0.237.0.2Patch availableCNA
—wasmtime-c-api-impl (crates.io)37.0.0 to before 37.0.237.0.2Patch availableGHSA-vvp9-h8p2-xwfc
—wasmtime-bin (PyPI)before 37.0.237.0.2Patch availableGHSA-vvp9-h8p2-xwfc
  • wasmtime Vendorbytecodealliance Affected 37.0.0 to before 37.0.2 Fixed in 37.0.2 Patch available CNA
  • wasmtime-c-api-impl (crates.io) Vendor— Affected 37.0.0 to before 37.0.2 Fixed in 37.0.2 Patch available GHSA-vvp9-h8p2-xwfc
  • wasmtime-bin (PyPI) Vendor— Affected before 37.0.2 Fixed in 37.0.2 Patch available GHSA-vvp9-h8p2-xwfc

CPE configurations NVD · 2

CPEVersionsRoleVendor
cpe:2.3:a:bytecodealliance:wasmtime:37.0.0:*:*:*:*:rust:*:*37.0.0Vulnerablebytecodealliance
cpe:2.3:a:bytecodealliance:wasmtime:37.0.1:*:*:*:*:rust:*:*37.0.1Vulnerablebytecodealliance
  • cpe:2.3:a:bytecodealliance:wasmtime:37.0.0:*:*:*:*:rust:*:* Versions 37.0.0 Vulnerable ·bytecodealliance
  • cpe:2.3:a:bytecodealliance:wasmtime:37.0.1:*:*:*:*:rust:*:* Versions 37.0.1 Vulnerable ·bytecodealliance

Remediation

  • Fix · CNA wasmtime (bytecodealliance) Fixed in 37.0.2
  • Fix · GHSA-vvp9-h8p2-xwfc wasmtime-c-api-impl (crates.io) Fixed in 37.0.2 Advisory →
  • Fix · GHSA-vvp9-h8p2-xwfc wasmtime-bin (PyPI) Fixed in 37.0.2 Advisory →

Vendor assessments

Red Hat

Red Hat's page for this CVE →

Not affected: 1 product
  • Red Hat

Timeline

  1. 2026-10-02 Threatist record created from CVE-2025-61670
  2. 2026-10-03 Alias added: GHSA-vvp9-h8p2-xwfc

References

  • TI-2026-21632 Wasmtime is vulnerable to panic when dropping a `[Typed]Func::call_async` future CVSS 4.0MEDIUM 6.9
  • TI-2023-11636 Guest-controlled out-of-bounds read/write on x86_64 in wasmtime CVSS 3.1CRITICAL 10.0
  • TI-2022-18765 Wasmtime vulnerable to data leakage between instances in the pooling allocator CVSS 3.1HIGH 8.6
  • TI-2022-08604 Use after free in Wasmtime CVSS 3.1CRITICAL 9.8
  • TI-2022-18766 wasmtime_trap_code C API function has out of bounds write vulnerability CVSS 3.1CRITICAL 9.8
  • TI-2026-27209 Wasmtime with Winch compiler backend on aarch64 may allow a sandbox-escaping memory access CVSS 4.0CRITICAL 9.0
See all 40 →

Sources