{"cve":"CVE-2021-39216","nvd":{"published":"2021-09-17T20:15:07.703","modified":"2026-06-17T04:03:19.810","status":"Modified","description":"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`.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H","score":6.3},"cwes":["CWE-416"],"references":["https://crates.io/crates/wasmtime","https://github.com/bytecodealliance/wasmtime/commit/101998733b74624cbd348a2366d05760b40181f3","https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-v4cp-h94r-m7xf","https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WAVBRYDDUIY2ZR3K3FO4BVYJKIMJ5TP7/","https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/Z2Z33FTXFQ6EOINVEQIP4DFBG53G5XIY/"],"products":["bytecodealliance:wasmtime","fedoraproject:fedora"],"source":"nvd","synced_at":"2026-10-19T21:23:41.316049955+00:00"},"epss":{"cve":"CVE-2021-39216","score":0.00307,"percentile":0.23559,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-4873-36h9-wv49","url":"https://osv.dev/vulnerability/GHSA-4873-36h9-wv49","summary":"Out-of-bounds read/write and invalid free with `externref`s and GC safepoints in Wasmtime ","modified":"2026-07-08T06:28:06.902042715Z","packages":[{"ecosystem":"crates.io","name":"wasmtime","purl":"pkg:cargo/wasmtime","ranges":[">=0.26.0 <0.30.0"],"fixed":["0.30.0"]},{"ecosystem":"PyPI","name":"wasmtime","purl":"pkg:pypi/wasmtime","ranges":[">=0.26.0 <0.30.0"],"fixed":["0.30.0"]}]},{"id":"GHSA-q879-9g95-56mx","url":"https://osv.dev/vulnerability/GHSA-q879-9g95-56mx","summary":"Wrong type for `Linker`-define functions when used across two `Engine`s","modified":"2026-07-08T06:29:58.685225357Z","packages":[{"ecosystem":"crates.io","name":"wasmtime","purl":"pkg:cargo/wasmtime","ranges":["<0.30.0"],"fixed":["0.30.0"]},{"ecosystem":"PyPI","name":"wasmtime","purl":"pkg:pypi/wasmtime","ranges":["<0.30.0"],"fixed":["0.30.0"]}]},{"id":"GHSA-v4cp-h94r-m7xf","url":"https://osv.dev/vulnerability/GHSA-v4cp-h94r-m7xf","summary":"Use after free passing `externref`s to Wasm in Wasmtime","modified":"2026-07-08T06:29:18.419386524Z","packages":[{"ecosystem":"crates.io","name":"wasmtime","purl":"pkg:cargo/wasmtime","ranges":["<0.30.0"],"fixed":["0.30.0"]},{"ecosystem":"PyPI","name":"wasmtime","purl":"pkg:pypi/wasmtime","ranges":["<0.30.0"],"fixed":["0.30.0"]}]},{"id":"PYSEC-2021-320","url":"https://osv.dev/vulnerability/PYSEC-2021-320","summary":"","modified":"2024-03-15T00:05:20.369060Z","packages":[{"ecosystem":"PyPI","name":"wasmtime","purl":"pkg:pypi/wasmtime","ranges":["<0.30.0"],"fixed":["0.30.0"]}]},{"id":"PYSEC-2021-321","url":"https://osv.dev/vulnerability/PYSEC-2021-321","summary":"","modified":"2024-03-15T00:05:20.369060Z","packages":[{"ecosystem":"PyPI","name":"wasmtime","purl":"pkg:pypi/wasmtime","ranges":["<0.30.0"],"fixed":["0.30.0"]}]},{"id":"PYSEC-2021-322","url":"https://osv.dev/vulnerability/PYSEC-2021-322","summary":"","modified":"2024-03-15T00:05:20.369060Z","packages":[{"ecosystem":"PyPI","name":"wasmtime","purl":"pkg:pypi/wasmtime","ranges":["<0.30.0"],"fixed":["0.30.0"]}]},{"id":"RUSTSEC-2021-0110","url":"https://osv.dev/vulnerability/RUSTSEC-2021-0110","summary":"Multiple Vulnerabilities in Wasmtime","modified":"2024-03-15T00:05:20.369060Z","packages":[{"ecosystem":"crates.io","name":"wasmtime","purl":"pkg:cargo/wasmtime","ranges":[">=0.0.0-0 <0.30.0"],"fixed":["0.30.0"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}