cve.bz

CVE-2021-39216 Use After Free

6.3 mediumEPSS 0.3%Fix available

Medium (6.3). EPSS 0.3% estimated probability of exploitation activity in the next 30 days. Fixed in wasmtime 0.30.0.

On this page
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`.

Severity

CVSS 3.1

6.3 medium
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
EPSS
0.3% (unchanged from 0.3% a week ago; 0.3% 30 days ago) estimated probability of exploitation activity in the next 30 days; 24th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CWE
CWE-416 Use After Free
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

  • wasmtime (crates.io): fixed in 0.30.0
  • wasmtime (PyPI): fixed in 0.30.0

Ask an AI about this CVE

Show the promptExplain CVE-2021-39216 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2021-39216?via=ask-ai-copy and https://cve.bz/cve/CVE-2021-39216?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2021-39216 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
bytecodealliance:wasmtimefrom 0.19.0 before 0.30.0
fedoraproject:fedora34
fedoraproject:fedora35

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-4873-36h9-wv49crates.iowasmtime>=0.26.0 <0.30.00.30.0
GHSA-4873-36h9-wv49PyPIwasmtime>=0.26.0 <0.30.00.30.0
GHSA-q879-9g95-56mxcrates.iowasmtime<0.30.00.30.0
GHSA-q879-9g95-56mxPyPIwasmtime<0.30.00.30.0
GHSA-v4cp-h94r-m7xfcrates.iowasmtime<0.30.00.30.0
GHSA-v4cp-h94r-m7xfPyPIwasmtime<0.30.00.30.0
PYSEC-2021-320PyPIwasmtime<0.30.00.30.0
PYSEC-2021-321PyPIwasmtime<0.30.00.30.0
PYSEC-2021-322PyPIwasmtime<0.30.00.30.0
RUSTSEC-2021-0110crates.iowasmtime>=0.0.0-0 <0.30.00.30.0

References

Check your stackJSON