# CVE-2021-39219: Wrong type for `Linker`-define functions when used across two `Engine`s

- Severity: Medium 6.3 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.36%, higher than 31% of CVEs (2026-12-01)
- Published: 2021-09-17T12:00:00.000Z
- Modified: 2026-11-09T11:00:02.603Z
- Also known as: GHSA-4873-36h9-wv49, GHSA-q879-9g95-56mx, GHSA-v4cp-h94r-m7xf, PYSEC-2021-320, PYSEC-2021-321, PYSEC-2021-322, RUSTSEC-2021-0110
- Related: CVE-2021-39216, CVE-2021-39218
- Weaknesses: CWE-125, CWE-416, CWE-590, CWE-787, CWE-843
- Assigned by: GitHub_M

## 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`.

(As written by CVE List.)

## Affected

- bytecodealliance wasmtime: <= 0.29.0; before 0.30.0
- wasmtime (crates.io): from 0.26.0 before 0.30.0; before 0.30.0; from 0.0.0-0 before 0.30.0
- wasmtime (PyPI): from 0.26.0 before 0.30.0; before 0.30.0; before 101998733b74624cbd348a2366d05760b40181f3; before 398a73f0dd862dbe703212ebae8e34036a18c11c; before b39f087414f27ae40c44449ed5d1154e03449bff
- fedoraproject fedora: 34; 35

## Every score

- GitHub_M: CVSS:3.1 6.3 Medium `CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:H`
- GitHub: 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`
- GitHub: CVSS:4.0 Medium `CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N`
- GitHub: CVSS:3.1 6.3 Medium `CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:H`
- GitHub: CVSS:4.0 Medium `CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N`
- GitHub: CVSS:4.0 Medium `CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N`
- RustSec Advisory Database: 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`
- NVD: 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`
- NVD: CVSS:2.0 3.3 Low `AV:L/AC:M/Au:N/C:N/I:P/A:P`

## References

- <https://crates.io/crates/wasmtime> (package, product, web)
- <https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-q879-9g95-56mx> (advisory, third-party-advisory, web)
- <https://github.com/bytecodealliance/wasmtime/commit/b39f087414f27ae40c44449ed5d1154e03449bff> (fix, patch, third-party-advisory, web)
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/Z2Z33FTXFQ6EOINVEQIP4DFBG53G5XIY/> (vendor-advisory)
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WAVBRYDDUIY2ZR3K3FO4BVYJKIMJ5TP7/> (vendor-advisory)
- <https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-4873-36h9-wv49> (advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-39218> (advisory)
- <https://github.com/bytecodealliance/wasmtime/commit/398a73f0dd862dbe703212ebae8e34036a18c11c> (fix, web)
- <https://github.com/bytecodealliance/wasmtime> (package)
- <https://github.com/bytecodealliance/wasmtime-py/compare/0.29.0...0.30.0> (web)
- <https://github.com/pypa/advisory-database/tree/main/vulns/wasmtime/PYSEC-2021-321.yaml> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WAVBRYDDUIY2ZR3K3FO4BVYJKIMJ5TP7> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/Z2Z33FTXFQ6EOINVEQIP4DFBG53G5XIY> (web)
- <https://rustsec.org/advisories/RUSTSEC-2021-0110.html> (advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-39219> (advisory)
- <https://github.com/pypa/advisory-database/tree/main/vulns/wasmtime/PYSEC-2021-322.yaml> (web)
- <https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-v4cp-h94r-m7xf> (advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-39216> (advisory)
- <https://github.com/bytecodealliance/wasmtime/commit/101998733b74624cbd348a2366d05760b40181f3> (fix, web)
- <https://github.com/pypa/advisory-database/tree/main/vulns/wasmtime/PYSEC-2021-320.yaml> (web)

## Sources

- CVE List: [CVE-2021-39219](https://www.cve.org/CVERecord?id=CVE-2021-39219), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-4873-36h9-wv49](https://github.com/advisories/GHSA-4873-36h9-wv49), CC-BY-4.0, modified 2026-07-08
- GitHub Advisory Database: [GHSA-q879-9g95-56mx](https://github.com/advisories/GHSA-q879-9g95-56mx), CC-BY-4.0, modified 2026-07-08
- GitHub Advisory Database: [GHSA-v4cp-h94r-m7xf](https://github.com/advisories/GHSA-v4cp-h94r-m7xf), CC-BY-4.0, modified 2026-07-08
- RustSec Advisory Database: [RUSTSEC-2021-0110](https://rustsec.org/advisories/RUSTSEC-2021-0110.html), CC0-1.0, modified 2026-11-09
- NVD: [CVE-2021-39219](https://nvd.nist.gov/vuln/detail/CVE-2021-39219), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2021-320](https://osv.dev/vulnerability/PYSEC-2021-320), CC-BY-4.0, modified 2024-03-15
- PyPA Advisory Database: [PYSEC-2021-321](https://osv.dev/vulnerability/PYSEC-2021-321), CC-BY-4.0, modified 2024-03-15
- PyPA Advisory Database: [PYSEC-2021-322](https://osv.dev/vulnerability/PYSEC-2021-322), CC-BY-4.0, modified 2024-03-15

---

Page: https://cve.day/CVE-2021-39219 · Whole record: https://cve.day/CVE-2021-39219.json · Rebuilt by cve.day 2026-11-25T22:58:04.036Z
