Skip to main content
Vulnerability Database/CVE-2020-37287

CVE-2020-37287: Vyper Compiler Buffer Overflow Vulnerability

CVE-2020-37287 is a call stack corruption flaw in Vyper compiler affecting versions before 0.2.6. It causes incorrect function outputs when complex types are passed as arguments. This post covers technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2020-37287 Overview

CVE-2020-37287 is a call stack corruption vulnerability in the Vyper smart contract compiler affecting versions before 0.2.6. The compiler incorrectly assumed every subtype of a complex argument occupies 32 bytes. When contracts pass multi-dimensional arrays or structs with non-base members to internal or external functions, the receiving function reads corrupted values from the stack. The flaw silently produces incorrect function outputs rather than reverting, which undermines contract integrity assumptions on the Ethereum Virtual Machine (EVM).

Critical Impact

Smart contracts compiled with vulnerable Vyper versions can return attacker-influenced or logically invalid outputs, enabling integrity attacks against on-chain financial logic.

Affected Products

  • Vyper compiler versions prior to 0.2.6
  • Smart contracts compiled with vulnerable Vyper versions that pass multi-dimensional arrays as function arguments
  • Smart contracts compiled with vulnerable Vyper versions that pass structs containing non-base members as function arguments

Discovery Timeline

  • 2026-10-21 - CVE-2020-37287 published to the National Vulnerability Database (NVD)
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2020-37287

Vulnerability Analysis

The vulnerability resides in Vyper's argument-handling logic for complex types. Vyper transpiles contract source code into EVM bytecode and must manage how function arguments are laid out when calls occur between internal or external functions. The compiler used a fixed 32-byte assumption for the size of each subtype within a complex argument. This assumption holds for base scalar types but breaks for multi-dimensional arrays and structs whose members are themselves aggregates. As a result, the generated code miscalculates stack offsets, producing a call stack corruption classified under CWE-131: Incorrect Calculation of Buffer Size. The receiving function then operates on misaligned data, yielding incorrect outputs without raising an error.

Root Cause

The root cause is an incorrect size calculation in the compiler's internal representation of complex argument types. Vyper computed element strides using a constant 32-byte width instead of recursively computing the size of nested subtypes. Nested structures and multi-dimensional arrays therefore occupy more space than the compiler accounted for.

Attack Vector

Exploitation does not require memory corruption on a traditional operating system. Instead, an attacker invokes a vulnerable contract function with crafted complex arguments that trigger the miscalculation. The call executes on the EVM and returns corrupted values that downstream logic treats as authoritative. In decentralized finance contexts, this can produce incorrect balance updates, price computations, or access decisions. No authentication is required because public contract methods are callable by any Ethereum account.

// No verified proof-of-concept code is published for this issue.
// Refer to the GitHub Security Advisory for technical specifics.

Detection Methods for CVE-2020-37287

Indicators of Compromise

  • On-chain transactions where function return values diverge from values predicted by the contract's documented logic
  • Deployed bytecode produced by Vyper compiler versions earlier than 0.2.6
  • Internal or external function signatures that accept multi-dimensional arrays or structs with aggregate members

Detection Strategies

  • Inventory all Vyper-compiled contracts and extract the compiler version from source repositories or build metadata
  • Perform static analysis on contract ABIs to flag functions accepting complex nested types, which are candidates for the defect
  • Replay historical transactions in a forked environment and compare outputs against a contract recompiled with Vyper 0.2.6 or later

Monitoring Recommendations

  • Alert on deployments of new contracts whose embedded compiler metadata indicates a pre-0.2.6 Vyper build
  • Monitor developer CI/CD pipelines for pinned Vyper versions below 0.2.6 and surface them in software bill of materials (SBOM) reports
  • Track upstream advisories such as the GitHub Security Advisory GHSA-4v7v-gqf9-ww2g for related compiler defects

How to Mitigate CVE-2020-37287

Immediate Actions Required

  • Upgrade the Vyper compiler toolchain to version 0.2.6 or later across all development and build environments
  • Recompile and redeploy any production contract that passes multi-dimensional arrays or non-base struct members between functions
  • Audit financial contracts for anomalous historical behavior that may indicate prior exploitation of corrupted outputs

Patch Information

The maintainers fixed the issue in Vyper 0.2.6 by correctly computing subtype sizes for complex arguments. Review the VulnCheck Advisory on Call Stack Corruption and the GitHub Security Advisory GHSA-4v7v-gqf9-ww2g for upstream remediation details.

Workarounds

  • Refactor affected contracts to pass only base scalar types or single-dimensional arrays until recompilation with a fixed Vyper version is possible
  • Flatten nested structs into separate scalar arguments to avoid triggering the miscalculated stack layout
  • Add runtime assertions that validate expected return values from functions handling complex arguments
bash
# Upgrade Vyper to a fixed release
pip install --upgrade "vyper>=0.2.6"
vyper --version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.