Skip to main content

CVE-2022-23636: CWE-824: Access of Uninitialized Pointer in bytecodealliance wasmtime

Medium
Published: Wed Feb 16 2022 (02/16/2022, 22:00:10 UTC)
Source: CVE
Vendor/Project: bytecodealliance
Product: wasmtime

Description

Wasmtime is an open source runtime for WebAssembly & WASI. Prior to versions 0.34.1 and 0.33.1, 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. A number of conditions listed in the GitHub Security Advisory must be true in order for an instance to be vulnerable to this issue. Maintainers 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. The bug has been fixed in 0.34.1 and 0.33.1 and users are encouraged to upgrade as soon as possible. If it is not possible to upgrade to version 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.

AI-Powered Analysis

AILast updated: 06/23/2025, 16:16:59 UTC

Technical Analysis

CVE-2022-23636 is a medium-severity vulnerability affecting the Wasmtime runtime, an open-source WebAssembly (Wasm) and WASI execution environment developed by the Bytecode Alliance. The flaw resides in the pooling instance allocator component of Wasmtime versions prior to 0.34.1 and 0.33.1. Specifically, when instantiating a Wasm module that defines an `externref` global, a failure during instance creation can lead to an invalid drop operation on a `VMExternRef` object via an uninitialized pointer. This is a classic case of CWE-824: Access of Uninitialized Pointer, which can cause undefined behavior including memory corruption. The vulnerability requires several conditions to be met: the module must use the `externref` reference types proposal, which is still not widely adopted; the Wasmtime `Store` must be configured with a resource limiter (not the default); and the failure triggering the bug must originate from system calls such as `mprotect` or `VirtualAlloc` on Windows. On Linux systems with the `uffd` feature enabled, the bug can only be triggered via resource limiter failures since `mprotect` calls are skipped. The bug has been fixed in Wasmtime versions 0.34.1 and 0.33.1. If upgrading is not feasible, disabling support for reference types by setting `Config::wasm_reference_types` to false will prevent loading modules that use `externref`, effectively mitigating the issue. No known exploits have been reported in the wild, and the impact is considered limited due to the uncommon use of `externref` and the specific configuration requirements needed to trigger the bug.

Potential Impact

For European organizations, the impact of this vulnerability is currently limited but should not be dismissed. Wasmtime is increasingly used in cloud-native environments, edge computing, and serverless platforms to run WebAssembly modules securely and efficiently. Organizations leveraging Wasmtime for sandboxing or running third-party Wasm code could face risks of memory corruption leading to potential denial of service or, in worst cases, arbitrary code execution if an attacker can craft malicious Wasm modules exploiting the uninitialized pointer access. However, the requirement for resource limiter configuration and the uncommon use of `externref` globals reduce the attack surface. Still, sectors with high adoption of WebAssembly runtimes—such as fintech, telecommunications, and critical infrastructure providers—could be more exposed, especially if they use Wasmtime in production with custom configurations. Additionally, the vulnerability might pose a risk in development and testing environments where experimental Wasm modules with `externref` are used. The absence of known exploits suggests a low immediate threat, but the potential for future exploitation exists as WebAssembly adoption grows.

Mitigation Recommendations

1. Upgrade Wasmtime to version 0.34.1 or 0.33.1 immediately to apply the official patch addressing this vulnerability. 2. If upgrading is not possible, disable the reference types proposal support by setting `Config::wasm_reference_types` to false in the Wasmtime configuration. This prevents loading modules that use `externref` globals, effectively mitigating the vulnerability. 3. Review and audit any Wasm modules that use `externref` globals to assess exposure. 4. Avoid enabling resource limiters on the Wasmtime `Store` unless necessary, or ensure they are configured securely and monitored. 5. Implement strict input validation and sandboxing controls around Wasmtime usage to limit the impact of malformed or malicious Wasm modules. 6. Monitor Wasmtime runtime logs and system calls related to memory protection failures (`mprotect`, `VirtualAlloc`) for anomalous behavior that could indicate exploitation attempts. 7. Stay informed about updates from the Bytecode Alliance and the Wasmtime project for any further advisories or patches. 8. Incorporate Wasmtime runtime version checks into CI/CD pipelines to prevent deployment of vulnerable versions.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-01-19T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9842c4522896dcbf25bb

Added to database: 5/21/2025, 9:09:22 AM

Last enriched: 6/23/2025, 4:16:59 PM

Last updated: 8/18/2025, 11:24:51 PM

Views: 17

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats