Just on July 30, the blockchain technology and cryptocurrency industry encountered a serious crisis. Some decentralized finance (DeFi) protocols developed using the Vyper programming language were attacked by hackers using vulnerabilities, resulting in the theft of tens of millions of dollars in digital assets. These attacked protocols include Curve Finance, Alchemix, PEGd, Metronome, etc., involving a variety of stablecoins and tokens. This incident caused panic and doubts in the community, and also exposed the shortcomings and challenges of blockchain technology and the cryptocurrency industry in terms of security, reliability and sustainability.

图片

process

At 22:04 on July 30, PETH/ETH was attacked.

It was revealed that JPEG'd was attacked and the loss was at least about 10 million US dollars. The root cause of the JPEG'd attack was reentrancy. The attacker added liquidity by reentrying the add_liquidity function when calling the remove_liquidity function to remove liquidity. Since the balance was updated before reentry into the add_liquidity function, an error occurred in the price calculation.

图片

At 22:50, msETH-ETH was attacked.

At 23:34 alETH-ETH was attacked.

0:44 minutes vyper official release

Vyper versions 0.2.15, 0.2.16, and 0.3.0 are affected by a reentrancy lock failure, and the investigation is ongoing.

图片

0:45 Curve Finance tweets

Some stable pools (alETH/msETH/pETH) using Vyper 0.2.15 are under attack due to a reentrancy lock failure. Currently, Curve is assessing the situation and other pools are safe. In addition, Curve further stated that “the dangerous combination is an affected version of Vyper and the use of pure ETH.”

图片

03:08 minutes

CRV-ETH was attacked, and the CRV on the chain dropped to a minimum of about 0.08. However, since the price of AAVE is taken from Chainlink, fortunately Chainlink adopted the weighted quotation logic of "CEXs + DEXs" and quoted the lowest price of $0.59, which made the founder of Curve Michael Egorov's position in AAVE has not been liquidated. Otherwise, a series of liquidations will be enough to destroy the entire Defi industry.

图片

You can imagine what it would be like to wake up the next morning and find that the entire Defi is gone. You originally wanted to earn some stable income by mining, but when you woke up, you found that the mine had collapsed.

subsequent impact

So far, a total of four protocols have been affected by this vulnerability, namely CurveFinance, Alchemix, PEGd, and Metronome. The total amount of losses from these protocols is approximately $70 million, which includes a variety of stablecoins and tokens. The specific amount of loss is as follows:

Curve Finance: approximately $25 million, mainly due to attacks on the CRV/ETH pool.

Alchemix: about $19 million, mainly due to the attack on the ALCX/ETH pool.

·PEGd: About 15 million US dollars, mainly due to the attack on the PEG/ETH pool.

·Metronome: About 11 million US dollars, mainly due to the attack on the MET/ETH pool.

Curve Finance TVL decreased by 43.6% in 24 hours and currently stands at $1.84 billion; Convex Finance TVL decreased by 48.5% in 24 hours and currently stands at $14.9 billion

Vyper compiler vulnerability

The Vyper compiler vulnerability refers to a reentrancy lock failure problem that exists in certain versions of the Vyper programming language. Vyper is a contract programming language designed specifically for the Ethereum Virtual Machine (EVM), which is considered a safer, simpler, and more readable language. Many DeFi protocols use Vyper to develop smart contracts to implement various financial functions.

Reentrancy locks are a mechanism to prevent reentrancy attacks. A re-entrancy attack means that when one contract calls another contract, before the first contract is completed, the second contract calls the first contract again, causing the first contract to be executed multiple times, and may cause data or Funds have been tampered with or stolen. Reentrant locking is implemented by setting a state variable. When a contract is called, this variable is set to the locked state. When the contract is executed, this variable is set to the unlocked state. In this way, if another contract attempts to call this contract again during the execution of a contract, it will be rejected, thus preventing reentrancy attacks.

The Vyper compiler vulnerability means that in some versions of Vyper, the state variables of the reentrancy lock are not set and restored correctly, causing the reentrancy lock to become invalid, thus making some contracts developed using Vyper vulnerable to reentrancy attacks. According to analysis by the BlockSec team, the vulnerability is related to an option in Vyper called "use_eth", which allows the contract to accept Ethereum (ETH) as a method of payment or storage of value. If a contract uses this option and interacts with a pool containing wrapped ether (WETH), the contract may be vulnerable to a reentrancy attack.

图片

This vulnerability is relatively hidden and common. It is hidden in the internal logic of the Vyper compiler and is not easily discovered by developers or users. It is common in multiple versions of Vyper and affects multiple DeFi protocols and pools. This vulnerability has led to the theft of tens of millions of dollars in digital assets by hackers, causing huge losses to DeFi protocols and users. At the same time, it has hit the confidence and trust of DeFi protocols and users in the Vyper programming language and blockchain technology, and has had a negative impact on blockchain technology and the cryptocurrency industry.

The impact this time is far from fully apparent, and perhaps a bigger storm is brewing.