Summary
Workarounds
If it is not possible to upgrade to 0.34.1 or 0.33.1 of the wasmtime crate, it is recommend that support for the reference types proposal be disabled by passing false to Config::wasm_reference_types.
Doing so will prevent modules that use externref from being loaded entirely.
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/wasmtime repository
Impact
There exists a bug in the pooling instance allocator in Wasmtime's runtime where a failure to instantiate an instance for a module that defines an externref global will result in an invalid drop of a VMExternRef via an uninitialized pointer.
As instance slots may be reused between consecutive instantiations, the value of the uninitialized pointer may be from a previous instantiation and therefore under the control of an attacker via a module's initial values for its globals. If the attacker can somehow determine an address under their control inside the mapped memory representing the instance pool, it is possible to trick the runtime to call drop_in_place on a trait object under the attacker's control and therefore cause remote code execution.
Exploiting the bug to cause remote code execution would be very difficult as attackers cannot determine the addresses of globals from code executing within the WebAssembly VM and the memory space for the instance pool cannot be statically determined. Operating system mitigations, such as address space layout randomization, would additionally increase the difficulty for attackers to determine useful executable code to target with an exploit. It is also very unlikely that attackers will be able to directly influence the conditions that trigger the bug as described below.
When the conditions to trigger the bug are met, however, it is much easier to exploit this bug to cause a denial of service by crashing the host with an invalid memory read.
The following engine configuration (via Config) is required to be impacted by this bug:
- support for the reference types proposal must be enabled (this is the default for
Config). - a pooling allocation strategy must be configured via Config::allocation_strategy, which is not the default allocation strategy.
A module must be instantiated with all the following characteristics:
- The module defines at least one table or memory.
- The module defines at least one
externrefglobal.
During instantiation, one of the following must occur to cause the instantiation to fail:
- a call to
mprotectorVirtualAllocfails (e.g. out-of-memory conditions). - a resource limiter was configured in the associated
Store(via Store::limiter or Store::limiter_async) and the limiter returnsfalsefrom the initial call tomemory_growingortable_growing. Stores do not have a resource limiter set by default.
This results in a partially-initialized instance being dropped and that attempts to drop the uninitialized VMExternRef representing the defined externref global.
We have reason to believe that the effective impact of this bug is relatively small because the usage of externref is still uncommon and without a resource limiter configured on the Store, which is not the default configuration, it is only possible to trigger the bug from an error returned by mprotect or VirtualAlloc.
Note that on Linux with the uffd feature enabled, it is only possible to trigger the bug from a resource limiter as the call to mprotect is skipped; if no resource limiter is used, then this configuration is not vulnerable.
CVE-2022-23636 has a CVSS score of 5.1 (Medium). The vector is requires local access, no privileges required, and no user interaction. 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.34.1, 0.33.1); 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
The bug has been fixed in 0.34.1 and 0.33.1; users are encouraged to upgrade as soon as possible.
Frequently Asked Questions
- What is CVE-2022-23636? CVE-2022-23636 is a medium-severity security vulnerability in wasmtime (rust), affecting versions = 0.34.0. It is fixed in 0.34.1, 0.33.1.
- How severe is CVE-2022-23636? CVE-2022-23636 has a CVSS score of 5.1 (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-2022-23636? wasmtime (rust) versions = 0.34.0 is affected.
- Is there a fix for CVE-2022-23636? Yes. CVE-2022-23636 is fixed in 0.34.1, 0.33.1. Upgrade to this version or later.
- Is CVE-2022-23636 exploitable, and should I be worried? Whether CVE-2022-23636 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-2022-23636 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-2022-23636?
- Upgrade
wasmtimeto 0.34.1 or later - Upgrade
wasmtimeto 0.33.1 or later
- Upgrade