Skip to main content

CVE-2022-39354: CWE-670: Always-Incorrect Control Flow Implementation in rust-blockchain evm

Medium
Published: Tue Oct 25 2022 (10/25/2022, 00:00:00 UTC)
Source: CVE
Vendor/Project: rust-blockchain
Product: evm

Description

SputnikVM, also called evm, is a Rust implementation of Ethereum Virtual Machine. A custom stateful precompile can use the `is_static` parameter to determine if the call is executed in a static context (via `STATICCALL`), and thus decide if stateful operations should be done. Prior to version 0.36.0, the passed `is_static` parameter was incorrect -- it was only set to `true` if the call came from a direct `STATICCALL` opcode. However, once a static call context is entered, it should stay static. The issue only impacts custom precompiles that actually uses `is_static`. For those affected, the issue can lead to possible incorrect state transitions. Version 0.36.0 contains a patch. There are no known workarounds.

AI-Powered Analysis

AILast updated: 06/22/2025, 14:51:11 UTC

Technical Analysis

CVE-2022-39354 is a vulnerability identified in SputnikVM, also known as evm, which is a Rust-based implementation of the Ethereum Virtual Machine (EVM). The vulnerability stems from an incorrect handling of the `is_static` parameter within custom stateful precompiles. The `is_static` parameter is intended to indicate whether a call is executed in a static context, specifically when invoked via the `STATICCALL` opcode, which restricts state modifications. Prior to version 0.36.0 of the evm product, the `is_static` parameter was only set to true if the call originated directly from a `STATICCALL` opcode. However, the correct behavior requires that once a static call context is entered, all subsequent calls within that context should also be considered static. This flaw means that custom precompiles relying on the `is_static` parameter could incorrectly perform stateful operations during what should be static calls, leading to improper state transitions within the blockchain environment. The impact is limited to custom precompiles that utilize the `is_static` parameter, and the vulnerability does not affect the core EVM functionality itself. The issue was addressed in version 0.36.0 of the evm product, which corrected the control flow logic to properly propagate the static context. There are no known workarounds for this vulnerability, and no known exploits have been reported in the wild. The vulnerability is classified under CWE-670, which relates to always-incorrect control flow implementation, highlighting the logical error in managing call context state.

Potential Impact

For European organizations utilizing blockchain solutions based on SputnikVM or other Rust-based EVM implementations that incorporate custom stateful precompiles, this vulnerability could lead to incorrect state transitions within their smart contract executions. This may result in unintended modifications to blockchain state, potentially undermining the integrity and reliability of decentralized applications (dApps) or blockchain services. Financial services, supply chain management, and identity verification platforms leveraging these technologies could face risks of transaction inconsistencies or state corruption. Although there are no known exploits in the wild, the logical flaw could be exploited by malicious actors who craft specific transactions to manipulate state transitions improperly. This could lead to loss of trust, financial discrepancies, or operational disruptions. Given the increasing adoption of blockchain technologies in Europe, especially in fintech hubs and innovation centers, the vulnerability poses a moderate risk to organizations relying on affected versions of the evm product. The absence of a workaround means that timely patching is critical to prevent potential exploitation.

Mitigation Recommendations

European organizations should prioritize upgrading all deployments of SputnikVM (evm) to version 0.36.0 or later, where the issue has been patched. Since no workarounds exist, patch management is the primary mitigation strategy. Additionally, organizations should audit their smart contracts and custom precompiles to identify any reliance on the `is_static` parameter and verify that their logic aligns with the corrected behavior. Implementing rigorous testing and validation of smart contract state transitions in static call contexts can help detect anomalies caused by this vulnerability. For environments where immediate patching is not feasible, organizations should consider restricting or monitoring the use of custom precompiles that depend on `is_static` to limit exposure. Integrating blockchain transaction monitoring tools that can detect unusual state changes or transaction patterns may provide early warning signs of exploitation attempts. Finally, maintaining close collaboration with blockchain platform vendors and following security advisories will ensure timely awareness of any emerging threats related to this vulnerability.

Need more detailed analysis?Get Pro

Technical Details

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

Threat ID: 682d9846c4522896dcbf494f

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

Last enriched: 6/22/2025, 2:51:11 PM

Last updated: 8/15/2025, 12:23:04 PM

Views: 11

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