CVE-2021-41153: Evm Specification Non-compliance Vulnerability

HIGH
Advisory Identifier: GHSA-pvh2-pj76-4m96
CVSS 8.7
CWE-670
Published
Advisory Summary

CVE-2021-41153 is a HIGH (CVSS 8.7) specification non-compliance vulnerability (CWE-670: Always-Incorrect Control Flow Implementation) affecting Evm libraries in the crates.io ecosystem. The issue involves specification non-compliance in jumpi. Remediation is available by upgrading affected packages to version 0.31.0.

CVE-2021-41153 at a Glance

CVE Identifier CVE-2021-41153
GHSA Identifier GHSA-pvh2-pj76-4m96
Severity HIGH
CVSS v3.1 Base Score 8.7
CWE Classification CWE-670: Always-Incorrect Control Flow Implementation
Affected Product Evm
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 8.7

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:C/C:H/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 Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2021-41153

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.31.0
Upgrade evm to 0.31.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-2021-41153, 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.31.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 In `evm` crate `< 0.31.0`, `JUMPI` opcode's condition is checked after the destination validity check. However, according to Geth and OpenEthereum, the condition check should happen before the destination validity check. ### Patches This is a **high** severity security advisory if you use `evm` crate for Ethereum mainnet. In this case, you should update your library dependency immediately to on or after `0.31.0`. This is a **low** severity security advisory if you use `evm` crate in Frontier or in a standalone blockchain, because there's no security exploit possible with this advisory. It is **not** recommended to update to on or after `0.31.0` until all the normal chain upgrade preparations have been done. If you use Frontier or other `pallet-evm` based Substrate blockchain, please ensure to update your `spec_version` before updating this. For other blockchains, please make sure to follow a hard-fork process before you update this. ### Workarounds If you are dependent on an older version of `evm` and cannot update due to API interface changes, please contact Wei by email (wei@that.world), who will be happy to help you to publish patch releases for older `evm` versions. ### References Fix PR: https://github.com/rust-blockchain/evm/pull/67 ### For more information If you have any questions or comments about this advisory: * Open an issue in the `evm` repo. ### Special thanks Special thanks to @rakita for reporting this issue.

CVE-2021-41153 Affected Evm Versions

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

References

Frequently Asked Questions

What is CVE-2021-41153?
CVE-2021-41153 is a security vulnerability in Evm involving Specification non-compliance in JUMPI under CWE-670: Always-Incorrect Control Flow Implementation.
Which Evm versions are affected?
Affected versions include releases prior to 0.31.0 across affected packages: evm.
What version fixes CVE-2021-41153?
Upgrading to 0.31.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.31.0. Upgrade your dependency to 0.31.0 or later.
What is the CVSS score of CVE-2021-41153?
CVE-2021-41153 has a CVSS v3.1 base score of 8.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2021-41153?
CVE-2021-41153 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-2021-41153?
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-pvh2-pj76-4m96",
  "modified" : "2021-10-25T20:07:57Z",
  "published" : "2021-10-19T15:28:35Z",
  "aliases" : [ "CVE-2021-41153" ],
  "summary" : "Specification non-compliance in JUMPI",
  "details" : "### Impact \n\nIn `evm` crate `< 0.31.0`, `JUMPI` opcode's condition is checked after the destination validity check. However, according to Geth and OpenEthereum, the condition check should happen before the destination validity check.\n\n### Patches\n\nThis is a **high** severity security advisory if you use `evm` crate for Ethereum mainnet. In this case, you should update your library dependency immediately to on or after `0.31.0`.\n\nThis is a **low** severity security advisory if you use `evm` crate in Frontier or in a standalone blockchain, because there's no security exploit possible with this advisory. It is **not** recommended to update to on or after `0.31.0` until all the normal chain upgrade preparations have been done. If you use Frontier or other `pallet-evm` based Substrate blockchain, please ensure to update your `spec_version` before updating this. For other blockchains, please make sure to follow a hard-fork process before you update this.\n\n### Workarounds\n\nIf you are dependent on an older version of `evm` and cannot update due to API interface changes, please contact Wei by email (wei@that.world), who will be happy to help you to publish patch releases for older `evm` versions.\n\n### References\n\nFix PR: https://github.com/rust-blockchain/evm/pull/67\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in the `evm` repo.\n\n### Special thanks\n\nSpecial thanks to @rakita for reporting this issue.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.31.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rust-blockchain/evm/security/advisories/GHSA-pvh2-pj76-4m96"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41153"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rust-blockchain/evm/pull/67"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rust-blockchain/evm"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-670" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-18T21:06:02Z",
    "nvd_published_at" : "2021-10-18T21:15:00Z"
  }
}