Skip to main content

CVE-2022-31169: CWE-682: Incorrect Calculation in bytecodealliance wasmtime

Medium
Published: Thu Jul 21 2022 (07/21/2022, 13:50:11 UTC)
Source: CVE
Vendor/Project: bytecodealliance
Product: wasmtime

Description

Wasmtime is a standalone runtime for WebAssembly. There is a bug in Wasmtime's code generator, Cranelift, for AArch64 targets where constant divisors can result in incorrect division results at runtime. This affects Wasmtime prior to version 0.38.2 and Cranelift prior to 0.85.2. This issue only affects the AArch64 platform. Other platforms are not affected. The translation rules for constants did not take into account whether sign or zero-extension should happen which resulted in an incorrect value being placed into a register when a division was encountered. The impact of this bug is that programs executing within the WebAssembly sandbox would not behave according to the WebAssembly specification. This means that it is hypothetically possible for execution within the sandbox to go awry and WebAssembly programs could produce unexpected results. This should not impact hosts executing WebAssembly but does affect the correctness of guest programs. This bug has been patched in Wasmtime version 0.38.2 and cranelift-codegen 0.85.2. There are no known workarounds.

AI-Powered Analysis

AILast updated: 06/23/2025, 01:21:50 UTC

Technical Analysis

CVE-2022-31169 is a vulnerability in the Wasmtime WebAssembly runtime, specifically in its code generator component Cranelift, affecting AArch64 (ARM 64-bit) platforms. Wasmtime is a standalone runtime designed to execute WebAssembly (Wasm) modules in a sandboxed environment. The issue arises from incorrect handling of constant divisors during code generation for division operations. The root cause is that the translation rules for constants did not properly account for whether sign-extension or zero-extension should be applied when loading constants into registers. This results in incorrect values being placed into registers during division instructions, causing the division results to be incorrect at runtime. This bug affects Wasmtime versions prior to 0.38.2 and Cranelift versions prior to 0.85.2 on AArch64 platforms only; other architectures are not impacted. The consequence is that WebAssembly programs running within the Wasmtime sandbox on affected versions and platforms may produce incorrect computational results, violating the WebAssembly specification's expected behavior. Importantly, this does not compromise the host system's security or stability but impacts the integrity and correctness of guest Wasm programs. No known exploits exist in the wild, and no workarounds are available. The issue has been fixed in Wasmtime 0.38.2 and Cranelift 0.85.2.

Potential Impact

For European organizations utilizing Wasmtime on AArch64 hardware—such as ARM-based servers, edge devices, or cloud infrastructure—this vulnerability can lead to incorrect execution of WebAssembly applications. This undermines the integrity of computations performed within Wasmtime sandboxes, potentially causing erroneous business logic, data corruption, or flawed decision-making processes in applications relying on Wasm modules. While the host environment remains secure, the reliability of guest applications is compromised, which could affect sectors relying on Wasm for secure, portable code execution such as fintech, IoT, and cloud-native services. The impact is particularly relevant for organizations adopting ARM-based infrastructure due to performance or cost benefits. Since Wasmtime is often used in emerging cloud and edge computing scenarios, incorrect execution could disrupt services or analytics pipelines. However, the absence of known exploits and the requirement for specific platform and version conditions limit immediate widespread risk. Nonetheless, the integrity impact on guest applications is significant in contexts where precise computation is critical.

Mitigation Recommendations

European organizations should prioritize upgrading Wasmtime to version 0.38.2 or later and Cranelift to 0.85.2 or later on all AArch64 systems. Given the lack of workarounds, patching is the primary mitigation. Organizations should audit their environments to identify any Wasmtime deployments on ARM64 hardware, including cloud instances, edge devices, and development environments. For environments where immediate patching is challenging, consider isolating or restricting execution of untrusted Wasm modules until updates can be applied. Additionally, implement rigorous testing and validation of Wasm workloads post-upgrade to ensure computational correctness. Monitoring for anomalous application behavior that could indicate incorrect Wasm execution is advisable. For new deployments, prefer architectures not affected by this vulnerability if Wasmtime is used and patching is delayed. Finally, maintain awareness of Wasmtime and Cranelift releases and subscribe to vendor security advisories to promptly address future vulnerabilities.

Need more detailed analysis?Get Pro

Technical Details

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

Threat ID: 682d9844c4522896dcbf3900

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

Last enriched: 6/23/2025, 1:21:50 AM

Last updated: 7/28/2025, 4:59:55 PM

Views: 12

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