CVE-2021-29511: Evm Memory Over-allocation Vulnerability

MODERATE
Advisory Identifier: GHSA-4jwq-572w-4388
CVSS 6.5
CWE-787 CWE-770
Published
Advisory Summary

CVE-2021-29511 is a MODERATE (CVSS 6.5) memory over-allocation vulnerability (CWE-787: Out-of-bounds Write) affecting Evm libraries in the crates.io ecosystem. The issue involves memory over-allocation in evm crate. Remediation is available by upgrading affected packages to version 0.25.1, 0.26.1, 0.21.1, 0.22.1, 0.23.1, 0.24.1.

CVE-2021-29511 at a Glance

CVE Identifier CVE-2021-29511
GHSA Identifier GHSA-4jwq-572w-4388
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-787: Out-of-bounds Write
Affected Product Evm
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

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

How to Fix CVE-2021-29511

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.25.1
Upgrade evm to 0.25.1
evm fixed: 0.26.1
Upgrade evm to 0.26.1
evm fixed: 0.21.1
Upgrade evm to 0.21.1
evm-core fixed: 0.21.1
Upgrade evm-core to 0.21.1
evm fixed: 0.22.1
Upgrade evm to 0.22.1
evm fixed: 0.23.1
Upgrade evm to 0.23.1
evm fixed: 0.24.1
Upgrade evm to 0.24.1
evm-core fixed: 0.22.1
Upgrade evm-core to 0.22.1
evm-core fixed: 0.23.1
Upgrade evm-core to 0.23.1
evm-core fixed: 0.24.1
Upgrade evm-core to 0.24.1
evm-core fixed: 0.25.1
Upgrade evm-core to 0.25.1
evm-core fixed: 0.26.1
Upgrade evm-core to 0.26.1
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-29511, 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.25.1), 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-787: Out-of-bounds Write, where the product writes data past the end, or before the beginning, of the intended buffer. 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 Prior to the patch, when executing specific EVM opcodes related to memory operations that use `evm_core::Memory::copy_large`, the crate can over-allocate memory when it is not needed, making it possible for an attacker to perform denial-of-service attack. ### Patches The flaw was corrected in commit `19ade85`. Users should upgrade to `==0.21.1, ==0.23.1, ==0.24.1, ==0.25.1, >=0.26.1`. ### Workarounds None. Please upgrade your `evm` crate version ### References Fix commit: https://github.com/rust-blockchain/evm/commit/19ade858c430ab13eb562764a870ac9f8506f8dd ### 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](mailto:wei@that.world)

CVE-2021-29511 Affected Evm Versions

12 component(s)
Fixed Versions:
0.25.10.26.10.21.10.22.10.23.10.24.1
Product / Package Ecosystem Affected Versions Fixed Version
evm
crates.io
≥ 0.25.0
< 0.25.1
All 1 versions
0.25.0
0.25.1
evm
crates.io
≥ 0.26.0
< 0.26.1
All 1 versions
0.26.0
0.26.1
evm
crates.io
< 0.21.1
0.21.1
evm-core
crates.io
< 0.21.1
0.21.1
evm
crates.io
≥ 0.22.0
< 0.22.1
All 1 versions
0.22.0
0.22.1
evm
crates.io
≥ 0.23.0
< 0.23.1
All 1 versions
0.23.0
0.23.1
evm
crates.io
≥ 0.24.0
< 0.24.1
All 1 versions
0.24.0
0.24.1
evm-core
crates.io
≥ 0.22.0
< 0.22.1
All 1 versions
0.22.0
0.22.1
evm-core
crates.io
≥ 0.23.0
< 0.23.1
All 1 versions
0.23.0
0.23.1
evm-core
crates.io
≥ 0.24.0
< 0.24.1
All 1 versions
0.24.0
0.24.1
evm-core
crates.io
≥ 0.25.0
< 0.25.1
All 1 versions
0.25.0
0.25.1
evm-core
crates.io
≥ 0.26.0
< 0.26.1
All 1 versions
0.26.0
0.26.1

References

Frequently Asked Questions

What is CVE-2021-29511?
CVE-2021-29511 is a security vulnerability in Evm involving Memory over-allocation in evm crate under CWE-787: Out-of-bounds Write.
Which Evm versions are affected?
Affected versions include releases prior to 0.25.1, 0.26.1, 0.21.1, 0.22.1, 0.23.1, 0.24.1 across affected packages: evm, evm-core.
What version fixes CVE-2021-29511?
Upgrading to 0.25.1, 0.26.1, 0.21.1, 0.22.1, 0.23.1, 0.24.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is evm affected?
Yes, evm is affected in releases prior to 0.25.1, 0.26.1, 0.21.1, 0.22.1, 0.23.1, 0.24.1. Upgrade your dependency to 0.25.1, 0.26.1, 0.21.1, 0.22.1, 0.23.1, 0.24.1 or later.
Is evm-core affected?
Yes, evm-core is affected in releases prior to 0.21.1, 0.22.1, 0.23.1, 0.24.1, 0.25.1, 0.26.1. Upgrade your dependency to 0.21.1, 0.22.1, 0.23.1, 0.24.1, 0.25.1, 0.26.1 or later.
What is the CVSS score of CVE-2021-29511?
CVE-2021-29511 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-29511?
CVE-2021-29511 is classified under CWE-787: Out-of-bounds Write (The product writes data past the end, or before the beginning, of the intended buffer.).
How can I check crates.io dependencies for CVE-2021-29511?
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-4jwq-572w-4388",
  "modified" : "2024-01-30T23:55:38Z",
  "published" : "2024-01-30T23:55:38Z",
  "aliases" : [ "CVE-2021-29511" ],
  "summary" : "Memory over-allocation in evm crate",
  "details" : "### Impact\nPrior to the patch, when executing specific EVM opcodes related to memory operations that use `evm_core::Memory::copy_large`, the crate can over-allocate memory when it is not needed, making it possible for an attacker to perform denial-of-service attack.\n\n### Patches\nThe flaw was corrected in commit `19ade85`. Users should upgrade to `==0.21.1, ==0.23.1, ==0.24.1, ==0.25.1, >=0.26.1`.\n\n### Workarounds\nNone. Please upgrade your `evm` crate version\n\n### References\nFix commit: https://github.com/rust-blockchain/evm/commit/19ade858c430ab13eb562764a870ac9f8506f8dd\n\n### For more information\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](mailto:wei@that.world)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.21.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.21.0"
    }
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.21.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.21.0"
    }
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.22.0"
      }, {
        "fixed" : "0.22.1"
      } ]
    } ],
    "versions" : [ "0.22.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.23.0"
      }, {
        "fixed" : "0.23.1"
      } ]
    } ],
    "versions" : [ "0.23.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.24.0"
      }, {
        "fixed" : "0.24.1"
      } ]
    } ],
    "versions" : [ "0.24.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.25.0"
      }, {
        "fixed" : "0.25.1"
      } ]
    } ],
    "versions" : [ "0.25.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.26.0"
      }, {
        "fixed" : "0.26.1"
      } ]
    } ],
    "versions" : [ "0.26.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.22.0"
      }, {
        "fixed" : "0.22.1"
      } ]
    } ],
    "versions" : [ "0.22.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.23.0"
      }, {
        "fixed" : "0.23.1"
      } ]
    } ],
    "versions" : [ "0.23.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.24.0"
      }, {
        "fixed" : "0.24.1"
      } ]
    } ],
    "versions" : [ "0.24.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.25.0"
      }, {
        "fixed" : "0.25.1"
      } ]
    } ],
    "versions" : [ "0.25.0" ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "evm-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.26.0"
      }, {
        "fixed" : "0.26.1"
      } ]
    } ],
    "versions" : [ "0.26.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rust-blockchain/evm/security/advisories/GHSA-4jwq-572w-4388"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29511"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rust-blockchain/evm/commit/19ade858c430ab13eb562764a870ac9f8506f8dd"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770", "CWE-787" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-30T23:55:38Z",
    "nvd_published_at" : "2021-05-12T18:15:00Z"
  }
}