
Cloud Vulnerability DB
A community-led vulnerabilities database
Vyper, a Pythonic Smart Contract Language for the Ethereum Virtual Machine (EVM), contained a critical vulnerability in versions 0.2.15, 0.2.16, and 0.3.0 where named re-entrancy locks were allocated incorrectly. Each function using a named re-entrancy lock received a unique lock regardless of the key, allowing cross-function re-entrancy in contracts compiled with the susceptible versions. The vulnerability was discovered on July 30th, 2023, and was patched in version 0.3.1 (GitHub Advisory, Vyper Report).
The vulnerability stemmed from improper implementation of the re-entrancy guard mechanism. The compiler was allocating a new storage slot for each @nonreentrant decorator instance, regardless of the key value, instead of reusing the same slot for identical keys. This implementation error meant that functions sharing the same nonreentrant key would each get their own independent lock, effectively nullifying cross-function re-entrancy protection. The bug was introduced in PR#2391 of version 0.2.15 when the re-entrancy key allocation logic was moved to the front-end pass, removing the crucial check that ensured only one lock was allocated per nonreentrant key (Vyper Report).
The vulnerability primarily affected smart contracts that relied on named re-entrancy protection across multiple functions, particularly those handling native ETH transactions. Several Curve.Fi liquidity pools were exploited due to this vulnerability, resulting in significant financial losses. The most notable impacts included the draining of multiple pools: pETH/ETH (~$11M), msETH/ETH (~$3.4M), alETH/ETH (~$22.6M), and CRV/ETH (~$24.7M) (Curve Report).
The vulnerability was patched in Vyper version 0.3.1 through two PRs: #2439 and #2514, which corrected the storage slot allocation for re-entrancy locks. For affected contracts, the primary mitigation is to upgrade to Vyper version 0.3.1 or higher. For contracts that cannot be upgraded, there are no direct workarounds, though following the Checks-Effects-Interactions pattern where possible can help prevent re-entrancy attacks (GitHub Advisory).
The vulnerability led to significant discussion in the DeFi community, particularly after the Curve.Fi exploits. The Vyper team acknowledged the bug on Twitter and has since announced several security initiatives, including competitive audits, bug bounty programs, and the formation of the Vyper Security Alliance. The team is also expanding to include dedicated security engineering roles and collaborating with multiple audit firms to review past versions (Vyper Report).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."