CVE-2025-61670
Wasmtime has memory leak in C API with `externref` and `anyref` types
Also known as GHSA-vvp9-h8p2-xwfc, PYSEC-2025-268
Mitigation
- Upgrade wasmtime-bin to 37.0.2 or later.
- Upgrade wasmtime-c-api-impl to 37.0.2 or later.
Who should check
- Projects that depend on PyPI package wasmtime-bin (<= 37.0.0; <= 37.0.1)
- Projects that depend on crates.io package wasmtime-c-api-impl (>= 37.0.0, < 37.0.2)
- Anyone running bytecodealliance wasmtime >= 37.0.0, < 37.0.2
Vulnerability facts
- Affected
- wasmtime-bin <= 37.0.0; <= 37.0.1; wasmtime-c-api-impl >= 37.0.0, < 37.0.2
- Fixed in
- 37.0.2
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 1.0 (v4.0, CNA)CVSS:4.0/AV:A/AC:L/AT:P/PR:L/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:LOpen in CVSS calculator
Show all 11 CVSS metrics
- Attack vector: Adjacent network
- Attack complexity: Low
- Attack requirements: Present
- Privileges required: Low
- User interaction: Passive
- Confidentiality impact: None
- Integrity impact: None
- Availability impact: Low
- Confidentiality impact on other systems: None
- Integrity impact on other systems: None
- Availability impact on other systems: Low
- EPSS
- 0.29% chance of exploitation in 30 days (percentile 14, 2026-11-26)
- CWE
- CWE-772
- Modified
Description
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| PyPI wasmtime-bin | <= 37.0.0; <= 37.0.1 | 37.0.2 | osv |
| crates.io wasmtime-c-api-impl | >= 37.0.0, < 37.0.2 | 37.0.2 | osv |
| bytecodealliance wasmtime | >= 37.0.0, < 37.0.2 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2025-61670. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2025-61670.md Affected: wasmtime-bin <= 37.0.0; <= 37.0.1; wasmtime-c-api-impl >= 37.0.0, < 37.0.2 Fixed in: 37.0.2 Steps: 1. Search this machine and project for wasmtime-bin (PyPI), wasmtime-c-api-impl (crates.io), bytecodealliance wasmtime: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
FAQ
Is CVE-2025-61670 being exploited?
There is no confirmed exploitation: CVE-2025-61670 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.29% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2025-61670?
Low: CVSS 1.0 (v4.0, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.
Which versions are affected by CVE-2025-61670?
wasmtime-bin <= 37.0.0; <= 37.0.1; wasmtime-c-api-impl >= 37.0.0, < 37.0.2.
Is there a fix for CVE-2025-61670?
Yes. Fixed in 37.0.2. Upgrade wasmtime-bin to 37.0.2 or later. Upgrade wasmtime-c-api-impl to 37.0.2 or later.
How do I check if I'm affected by CVE-2025-61670?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.