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-37286 Overview
CVE-2020-37286 is a memory corruption vulnerability in the Vyper smart contract language compiler. The flaw affects versions from 0.1.0b4 before 0.3.0 and stems from an incorrect stack tip pointer when internal function calls appear inside tuples or nested calls. Contracts that use such calls as tuple elements, call arguments, or builtin arguments like concat or ecrecover can return corrupted values or pass wrong arguments to external calls. The vulnerability is classified under [CWE-787] (Out-of-bounds Write) and primarily impacts the integrity of compiled Ethereum Virtual Machine (EVM) bytecode produced by affected Vyper releases.
Critical Impact
Smart contracts compiled with vulnerable Vyper releases can silently return corrupted values or forward incorrect arguments to external calls, breaking contract integrity and enabling fund-loss scenarios.
Affected Products
- Vyper compiler versions 0.1.0b4 through versions earlier than 0.3.0
- Ethereum smart contracts compiled with affected Vyper releases that contain nested internal function calls
- Downstream decentralized applications (dApps) and protocols relying on bytecode produced by vulnerable compiler versions
Discovery Timeline
- 2026-10-21 - CVE-2020-37286 published to the National Vulnerability Database (NVD)
- 2026-10-22 - Last updated in the NVD database
Technical Details for CVE-2020-37286
Vulnerability Analysis
The vulnerability resides in Vyper's code generation path for internal function calls. When the compiler emits bytecode for an internal call, it tracks the top of the EVM stack to know where return values will be placed. In affected releases, the stack tip pointer is computed incorrectly when the internal call appears as part of a larger expression, such as a tuple element, an argument to another call, or an argument to builtins including concat and ecrecover.
The mismatch causes return data from the internal function to be written to the wrong stack offset. Subsequent operations then read values from locations that no longer hold the intended data. The result is memory corruption at the EVM abstraction level: contracts return corrupted values, pass wrong arguments to external calls, or misroute data to cryptographic primitives such as ecrecover.
Root Cause
The root cause is an off-by-one or stale stack tip calculation inside Vyper's internal call compilation routine. The compiler fails to account for intermediate values pushed by the surrounding expression context before invoking the internal function. Because the error is introduced at compile time, every deployment of an affected contract carries the corrupted bytecode. The issue is tracked under [CWE-787] because the flawed stack bookkeeping leads to writes that overwrite data outside the intended region of the EVM evaluation stack.
Attack Vector
Exploitation does not require a traditional network attacker. Any user who can invoke an affected contract function can trigger the corruption path, because the faulty bytecode is embedded in the deployed contract. In protocols that forward call arguments to external contracts, an attacker can supply inputs that cause the corrupted argument to transfer value, change authorization checks, or bypass signature verification through a malformed ecrecover invocation. See the Vyper GitHub Security Advisory and the VulnCheck Memory Corruption Advisory for additional technical context.
Detection Methods for CVE-2020-37286
Indicators of Compromise
- Deployed smart contracts whose compiler metadata reports a Vyper version between 0.1.0b4 and 0.2.x inclusive
- Transactions where internal view functions return values that do not match off-chain simulations of the same input
- External calls originating from Vyper contracts where argument values differ from the values computed in source code
Detection Strategies
- Audit contract source trees for internal function calls embedded in tuple expressions, nested call arguments, or arguments to concat and ecrecover
- Recompile existing contracts with Vyper 0.3.0 or later and compare the resulting bytecode and runtime behavior against the deployed version
- Run differential fuzzing against contracts suspected of containing the pattern to surface divergent return values
Monitoring Recommendations
- Monitor on-chain analytics for anomalous transfers originating from contracts compiled with pre-0.3.0 Vyper
- Alert when transactions trigger failed ecrecover paths or signature mismatches in contracts known to use nested internal calls
- Track dependency manifests in continuous integration (CI) to flag any build that pins Vyper to an affected version
How to Mitigate CVE-2020-37286
Immediate Actions Required
- Upgrade the Vyper toolchain to version 0.3.0 or later across all development, staging, and CI environments
- Recompile and redeploy any production contract that uses internal function calls inside tuples, nested calls, or builtins such as concat and ecrecover
- Pause or guard affected contracts with circuit breakers until migration to patched bytecode is complete
Patch Information
The fix is included in Vyper 0.3.0. The Vyper GitHub Security Advisory GHSA-2r3x-4mrv-mcxf documents the corrected stack tip handling. Because Ethereum contracts are immutable, patching requires redeployment of recompiled bytecode and migration of state or proxy upgrades through established governance procedures.
Workarounds
- Refactor source code to assign internal function results to intermediate local variables before using them in tuples, call arguments, or builtins
- Avoid passing internal function return values directly to concat, ecrecover, and external call arguments until recompilation with a fixed Vyper version is possible
- Add on-chain assertions that verify expected return values and halt execution when corruption is detected
# Pin a fixed Vyper version in project dependencies
pip install "vyper>=0.3.0"
vyper --version
vyper contracts/MyContract.vy -f bytecode > build/MyContract.bin
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

