Read the docs
TI-2021-16601 Aliases CVE-2021-39216GHSA-v4cp-h94r-m7xf

Use after free passing `externref`s to Wasm in Wasmtime

Priority LOW 28CWE-416Published · Updated

Key facts

Attack vector
Local
Privileges required
Low
User interaction
None
Attack complexity
High
Impact type
—
Confidentiality · integrity · availability
None · High · High
Fix status
Fixed

Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.

Summary

Wasmtime is an open source runtime for WebAssembly & WASI. In Wasmtime from version 0.19.0 and before version 0.30.0 there was a use-after-free bug when passing `externref`s from the host to guest Wasm content. To trigger the bug, you have to explicitly pass multiple `externref`s from the host to a Wasm instance at the same time, either by passing multiple `externref`s as arguments from host code to a Wasm function, or returning multiple `externref`s to Wasm from a multi-value return function defined in the host. If you do not have host code that matches one of these shapes, then you are not impacted. If Wasmtime's `VMExternRefActivationsTable` became filled to capacity after passing the first `externref` in, then passing in the second `externref` could trigger a garbage collection. However the first `externref` is not rooted until we pass control to Wasm, and therefore could be reclaimed by the collector if nothing else was holding a reference to it or otherwise keeping it alive. Then, when control was passed to Wasm after the garbage collection, Wasm could use the first `externref`, which at this point has already been freed. We have reason to believe that the effective impact of this bug is relatively small because usage of `externref` is currently quite rare. The bug has been fixed, and users should upgrade to Wasmtime 0.30.0. If you cannot upgrade Wasmtime yet, you can avoid the bug by disabling reference types support in Wasmtime by passing `false` to `wasmtime::Config::wasm_reference_types`.

Why it matters now

EPSS 0.00307 23rd percentileScored 2026-11-07
Fix Fixed wasmtime (crates.io): 0.30.0wasmtime (PyPI): 0.30.0

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
bytecodealliancewasmtime0.19.0 – 0.29.0—No fix listedCNA
—wasmtime (crates.io)before 0.30.00.30.0Patch availableGHSA-v4cp-h94r-m7xf
—wasmtime (PyPI)before 0.30.00.30.0Patch availableGHSA-v4cp-h94r-m7xf
  • wasmtime Vendorbytecodealliance Affected 0.19.0 – 0.29.0 Fixed in — No fix listed CNA
  • wasmtime (crates.io) Vendor— Affected before 0.30.0 Fixed in 0.30.0 Patch available GHSA-v4cp-h94r-m7xf
  • wasmtime (PyPI) Vendor— Affected before 0.30.0 Fixed in 0.30.0 Patch available GHSA-v4cp-h94r-m7xf

CPE configurations NVD · 3

CPEVersionsRoleVendor
cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:*:*:*0.19.0 to before 0.30.0Vulnerablebytecodealliance
cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*34VulnerableFedoraproject
cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*35VulnerableFedoraproject
  • cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:*:*:* Versions 0.19.0 to before 0.30.0 Vulnerable ·bytecodealliance
  • cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:* Versions 34 Vulnerable ·Fedoraproject
  • cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* Versions 35 Vulnerable ·Fedoraproject

Remediation

  • Fix · GHSA-v4cp-h94r-m7xf wasmtime (crates.io) Fixed in 0.30.0 Advisory →
  • Fix · GHSA-v4cp-h94r-m7xf wasmtime (PyPI) Fixed in 0.30.0 Advisory →

Fixed in the same release

Records fixed by the same vendor advisory or release, as the CNA lists them.

  • Advisory ·

    bytecodealliance wasmtime — FEDORA-2021-1805eacb48

    3 records Highest priority Priority LOW 3 LOW

    Other records, highest priority first

    • TI-2021-16604 Wrong type for `Linker`-define functions when used across two `Engine`sPriority LOW 28
    • TI-2021-16603 Out-of-bounds read/write and invalid free with `externref`s and GC safepoints in WasmtimePriority LOW 28
  • Advisory ·

    bytecodealliance wasmtime — FEDORA-2021-68713440cb

    3 records Highest priority Priority LOW 3 LOW

    Other records, highest priority first

    • TI-2021-16604 Wrong type for `Linker`-define functions when used across two `Engine`sPriority LOW 28
    • TI-2021-16603 Out-of-bounds read/write and invalid free with `externref`s and GC safepoints in WasmtimePriority LOW 28

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-2021-39216
  2. 2026-10-03 Alias added: GHSA-v4cp-h94r-m7xf

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