Summary
Workarounds
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 Engines is required then code should be audited to ensure that Linker is only used with one Engine.
For more information
If you have any questions or comments about this advisory:
- Reach out to us on the Bytecode Alliance Zulip chat
- Open an issue in the
bytecodealliance/wasmtimerepository
Impact
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.
An object is accessed using a type that is incompatible with its actual type, causing the runtime to interpret memory incorrectly. Typical impact: memory safety violations, unexpected behavior, or code execution.
CVE-2021-39219 has a CVSS score of 6.3 (Medium). The vector is requires local access, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.30.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
This bug has been patched and users should upgrade to Wasmtime version 0.30.0.
Frequently Asked Questions
- What is CVE-2021-39219? CVE-2021-39219 is a medium-severity type confusion vulnerability in wasmtime (rust), affecting versions < 0.30.0. It is fixed in 0.30.0. An object is accessed using a type that is incompatible with its actual type, causing the runtime to interpret memory incorrectly.
- How severe is CVE-2021-39219? CVE-2021-39219 has a CVSS score of 6.3 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of wasmtime are affected by CVE-2021-39219? wasmtime (rust) versions < 0.30.0 is affected.
- Is there a fix for CVE-2021-39219? Yes. CVE-2021-39219 is fixed in 0.30.0. Upgrade to this version or later.
- Is CVE-2021-39219 exploitable, and should I be worried? Whether CVE-2021-39219 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2021-39219 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2021-39219?
- Upgrade
wasmtimeto 0.30.0 or later - Upgrade
wasmtimeto 0.30.0 or later
- Upgrade