CVE-2022-39354: Evm Incorrect Is_static Parameter For Custom Vulnerability

MODERATE
Advisory Identifier: GHSA-hhc4-47rh-cr34
CVSS 5.9
CWE-670
Published
Advisory Summary

CVE-2022-39354 is a MODERATE (CVSS 5.9) incorrect is_static parameter for custom vulnerability (CWE-670: Always-Incorrect Control Flow Implementation) affecting Evm libraries in the crates.io ecosystem. The issue involves incorrect is_static parameter for custom stateful precompiles in sputnikvm (evm). Remediation is available by upgrading affected packages to version 0.36.0.

CVE-2022-39354 at a Glance

CVE Identifier CVE-2022-39354
GHSA Identifier GHSA-hhc4-47rh-cr34
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-670: Always-Incorrect Control Flow Implementation
Affected Product Evm
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2022-39354

To remediate this vulnerability, upgrade all affected Evm dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

evm fixed: 0.36.0
Upgrade evm to 0.36.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for evm

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-39354, inspect your project dependencies for Evm:

inspect dependencies for evm

Analyze the terminal output to locate any version of Evm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.36.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-670: Always-Incorrect Control Flow Implementation, where the code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated. In Evm, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact 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. Previously, the passed `is_static` parameter was incorrect -- it was only set to `true` if the call comes 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`. The maintainers estimate the usage is low. However, for those affected, it can lead to possible incorrect state transitions. ### Patches PR: https://github.com/rust-blockchain/evm/pull/133 Released in v0.36.0. Older patch versions can be released on request if anyone needs them. Simply contact @sorpaas by email to request it. ### For more information If you have any questions or comments about this advisory: * Open an issue in [evm repo](https://github.com/rust-blockchain/evm) * Email Wei at [wei@that.world](mailto:wei@that.world)

CVE-2022-39354 Affected Evm Versions

1 component(s)
Fixed Versions:
0.36.0
Product / Package Ecosystem Affected Versions Fixed Version
evm
crates.io
< 0.36.0
0.36.0

References

Frequently Asked Questions

What is CVE-2022-39354?
CVE-2022-39354 is a security vulnerability in Evm involving Incorrect is_static parameter for custom stateful precompiles in SputnikVM (evm) under CWE-670: Always-Incorrect Control Flow Implementation.
Which Evm versions are affected?
Affected versions include releases prior to 0.36.0 across affected packages: evm.
What version fixes CVE-2022-39354?
Upgrading to 0.36.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is evm affected?
Yes, evm is affected in releases prior to 0.36.0. Upgrade your dependency to 0.36.0 or later.
What is the CVSS score of CVE-2022-39354?
CVE-2022-39354 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2022-39354?
CVE-2022-39354 is classified under CWE-670: Always-Incorrect Control Flow Implementation (The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.).
How can I check crates.io dependencies for CVE-2022-39354?
Run the dependency tree command: 'inspect dependencies for evm'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hhc4-47rh-cr34",
  "modified" : "2022-10-25T22:27:21Z",
  "published" : "2022-10-25T22:27:21Z",
  "aliases" : [ "CVE-2022-39354" ],
  "summary" : "Incorrect is_static parameter for custom stateful precompiles in SputnikVM (evm)",
  "details" : "### Impact\n\nA 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. Previously, the passed `is_static` parameter was incorrect -- it was only set to `true` if the call comes from a **direct** `STATICCALL` opcode. However, once a static call context is entered, it should stay static. \n\nThe issue only impacts custom precompiles that actually uses `is_static`. The maintainers estimate the usage is low. However, for those affected, it can lead to possible incorrect state transitions.\n\n### Patches\n\nPR: https://github.com/rust-blockchain/evm/pull/133\nReleased in v0.36.0.\n\nOlder patch versions can be released on request if anyone needs them. Simply contact @sorpaas by email to request it.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [evm repo](https://github.com/rust-blockchain/evm)\n* Email Wei at [wei@that.world](mailto:wei@that.world)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.36.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.35.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rust-blockchain/evm/security/advisories/GHSA-hhc4-47rh-cr34"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39354"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rust-blockchain/evm/pull/133"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rust-blockchain/evm"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2022-0083.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-670" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-25T22:27:21Z",
    "nvd_published_at" : "2022-10-25T19:15:00Z"
  }
}