{"cve":"CVE-2021-39219","nvd":{"published":"2021-09-17T20:15:07.763","modified":"2026-06-17T04:03:20.250","status":"Modified","description":"Wasmtime is an open source runtime for WebAssembly & WASI. Wasmtime before version 0.30.0 is affected by a type confusion vulnerability. As a Rust library the `wasmtime` crate clearly marks which functions are safe and which are `unsafe`, guaranteeing that if consumers never use `unsafe` then it should not be possible to have memory unsafety issues in their embeddings of Wasmtime. An issue was discovered in the safe API of `Linker::func_*` APIs. These APIs were previously not sound when one `Engine` was used to create the `Linker` and then a different `Engine` was used to create a `Store` and then the `Linker` was used to instantiate a module into that `Store`. Cross-`Engine` usage of functions is not supported in Wasmtime and this can result in type confusion of function pointers, resulting in being able to safely call a function with the wrong type. Triggering this bug requires using at least two `Engine` values in an embedding and then additionally using two different values with a `Linker` (one at the creation time of the `Linker` and another when instantiating a module with the `Linker`). It's expected that usage of more-than-one `Engine` in an embedding is relatively rare since an `Engine` is intended to be a globally shared resource, so the expectation is that the impact of this issue is relatively small. The fix implemented is to change this behavior to `panic!()` in Rust instead of silently allowing it. Using different `Engine` instances with a `Linker` is a programmer bug that `wasmtime` catches at runtime. This bug has been patched and users should upgrade to Wasmtime version 0.30.0. If you cannot upgrade Wasmtime and are using more than one `Engine` in your embedding it's recommended to instead use only one `Engine` for the entire program if possible. An `Engine` is designed to be a globally shared resource that is suitable to have only one for the lifetime of an entire process. If using multiple `Engine`s is required then code should be audited to ensure that `Linker` is only used with one `Engine`.","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-843"],"references":["https://crates.io/crates/wasmtime","https://github.com/bytecodealliance/wasmtime/commit/b39f087414f27ae40c44449ed5d1154e03449bff","https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-q879-9g95-56mx","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-39219","score":0.00361,"percentile":0.29922,"date":"2026-11-01"},"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."]}