CVE-2024-24563
📋 TL;DR
Vyper smart contract compiler fails to properly validate array index types, allowing signed integers (including negative values) to be used as array indexes. This can lead to unpredictable contract behavior, access to unauthorized array elements, or denial of service. All Vyper users compiling smart contracts for Ethereum are affected.
💻 Affected Systems
- Vyper
📦 What is this software?
Vyper by Vyperlang
⚠️ Risk & Real-World Impact
Worst Case
Smart contracts could be manipulated to access unauthorized memory locations, leading to theft of funds, contract takeover, or complete compromise of contract logic.
Likely Case
Most attempts to exploit will trigger bounds checking reverts, but edge cases could allow bypassing developer assumptions about array access restrictions.
If Mitigated
With proper input validation and bounds checking in smart contracts, the impact is reduced to potential unexpected reverts rather than security breaches.
🎯 Exploit Status
Exploitation requires crafting specific smart contract calls and depends on contract implementation details.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: None
Vendor Advisory: https://github.com/vyperlang/vyper/security/advisories/GHSA-52xq-j7v9-v4v2
Restart Required: No
Instructions:
No official patch exists. Monitor Vyper GitHub repository for updates and apply immediately when available.
🔧 Temporary Workarounds
Manual Type Checking
allAdd explicit type checking in smart contracts to ensure array indexes are unsigned integers
Bounds Validation
allImplement additional bounds checking in contract logic to validate array indexes
🧯 If You Can't Patch
- Audit all Vyper-compiled contracts for array indexing patterns and add explicit type validation
- Consider migrating critical contracts to alternative languages or compilers until Vyper is patched
🔍 How to Verify
Check if Vulnerable:
Check Vyper version with 'vyper --version'. All versions ≤0.3.10 are vulnerable.
Check Version:
vyper --version
Verify Fix Applied:
When patch is released, verify version is greater than 0.3.10
📡 Detection & Monitoring
Log Indicators:
- Unexpected contract reverts related to array bounds
- Unusual array access patterns in contract execution
Network Indicators:
- Multiple failed transactions to contracts with array operations
- Unusual gas consumption patterns for array operations
SIEM Query:
Monitor for contract calls with negative integer parameters to array-indexed functions
🔗 References
- https://github.com/vyperlang/vyper/blob/a1fd228cb9936c3e4bbca6f3ee3fb4426ef45490/vyper/codegen/core.py#L534-L541
- https://github.com/vyperlang/vyper/blob/c150fc49ee9375a930d177044559b83cb95f7963/vyper/semantics/types/subscriptable.py#L127-L137
- https://github.com/vyperlang/vyper/security/advisories/GHSA-52xq-j7v9-v4v2
- https://github.com/vyperlang/vyper/blob/a1fd228cb9936c3e4bbca6f3ee3fb4426ef45490/vyper/codegen/core.py#L534-L541
- https://github.com/vyperlang/vyper/blob/c150fc49ee9375a930d177044559b83cb95f7963/vyper/semantics/types/subscriptable.py#L127-L137
- https://github.com/vyperlang/vyper/security/advisories/GHSA-52xq-j7v9-v4v2