CVE-2018-18920: Py evm Py-EVM Is Vulnerable To Arbitrary Vulnerability

HIGH
Advisory Identifier: GHSA-vqgp-4jgj-5j64
CVSS 8.8
CWE-119
Published
Advisory Summary

CVE-2018-18920 is a HIGH (CVSS 8.8) py-evm is vulnerable to arbitrary vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Py evm libraries in the PyPI ecosystem. The issue involves py-evm is vulnerable to arbitrary bytecode injection. Remediation is available in the latest vendor maintenance releases.

CVE-2018-18920 at a Glance

CVE Identifier CVE-2018-18920
GHSA Identifier GHSA-vqgp-4jgj-5j64
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product Py evm
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.8

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

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

How to Fix CVE-2018-18920

To remediate this vulnerability, upgrade all affected Py 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.

py-evm fixed: Latest secure release
pip install py-evm>=Latest secure release
Verify Direct and Transitive Dependencies

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

pip show py-evm

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2018-18920, inspect your installed packages using pip:

pip show py-evm

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

Note: The pip show py-evm command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. In Py 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

Py-EVM v0.2.0-alpha.33 allows attackers to make a vm.execute_bytecode call that triggers computation._stack.values with '"stack": [100, 100, 0]' where b'\x' was expected, resulting in an execution failure because of an invalid opcode. This is reportedly related to "smart contracts can be executed indefinitely without gas being paid."

CVE-2018-18920 Affected Py evm Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
py-evm
PyPI
≤ 0.2.0a33

References

Frequently Asked Questions

What is CVE-2018-18920?
CVE-2018-18920 is a security vulnerability in Py evm involving Py-EVM is vulnerable to arbitrary bytecode injection under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Py evm versions are affected?
Affected versions include releases prior to current release patches across affected packages: py-evm.
What version fixes CVE-2018-18920?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is py-evm affected?
Yes, py-evm is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2018-18920?
CVE-2018-18920 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2018-18920?
CVE-2018-18920 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check PyPI dependencies for CVE-2018-18920?
Run the dependency tree command: 'pip show py-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-vqgp-4jgj-5j64",
  "modified" : "2026-06-05T17:53:32Z",
  "published" : "2018-11-21T22:23:04Z",
  "aliases" : [ "CVE-2018-18920" ],
  "summary" : "Py-EVM is vulnerable to arbitrary bytecode injection",
  "details" : "Py-EVM v0.2.0-alpha.33 allows attackers to make a vm.execute_bytecode call that triggers computation._stack.values with '\"stack\": [100, 100, 0]' where b'\\x' was expected, resulting in an execution failure because of an invalid opcode. This is reportedly related to \"smart contracts can be executed indefinitely without gas being paid.\"",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "py-evm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.2.0a33"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-18920"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ethereum/py-evm/issues/1448"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-vqgp-4jgj-5j64"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ethereum/py-evm"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/evm-py/PYSEC-2018-155.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/py-evm/PYSEC-2018-96.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://twitter.com/AlexanderFisher/status/1060923428641878019"
  }, {
    "type" : "WEB",
    "url" : "https://twitter.com/NettaLab/status/1060889400102383617"
  }, {
    "type" : "WEB",
    "url" : "https://www.reddit.com/r/ethereum/comments/9vkk2g/netta_labs_claim_to_have_found_a_vulnerability_in/e9d3wyx"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:58:10Z",
    "nvd_published_at" : null
  }
}