
foreword
first level titleforewordOn the evening of October 27th, Beijing time, the Ethereum DeFi protocol Cream Finance was attacked again, with a loss of up to 130 million US dollars.secondary title
analyze
basic information
basic information
text
Attacker: 0x24354D31bC9D90F62FE5f2454709C32049cf866b
Attack contract 2: 0xf701426b8126BC60530574CEcDCb365D47973284
process
secondary title
process
1. The attacker invokes the 0x67c354b5 function of the attack contract 1 0x961D to start the entire attack process. First, borrow 500M DAI through MakerDAO’s flash loan, then pledge and exchange it into yDAI, and add liquidity to yDAI in Curve ySwap to obtain the ySwap Token certificate, which is then used to The pledge is converted into yUSD, and finally deposit yUSD in Cream to obtain crYUSD;
2. Then the attack contract 1 0x961D calls the flashLoanAAVE() function of the attack contract 2 0xf701, and first borrows 524102 WETH through AAVE flash loan, of which 6000 WETH is transferred to the attack contract 1 0x961D, and the remaining WETH is deposited into Cream to obtain crETH. Then lent 446758198 yUSD from Cream for three times, and after the first two loans, deposited it into Cream again to obtain crYUSD and transferred it to the attack contract 1 0x961D, and transferred the lent yUSD directly to the attack contract 1 0x961D for the third time for later redemption ;3. The flashLoanAAVE() function then calls the 0x0ed1ecb1 function of the attack contract 1 0x961D, completes the exchange of WETH => USDC => DUSD through UniswapV3 and Curve, redeems 3022172 yUSD with 383317 DUSD through the YVaultPeak contract, and adds the second attack The 446758198 yUSD transferred from contract 2 0xf701 is redeemed in ySwap for about 450228633 ySwap Token certificates.
4. Finally, redeem each asset into DAI and return the flash loan.
detail
secondary title
The cause of this attack is multi-dimensional, and it also reflects many other problems. For example, the Cream protocol allows yUSD to be deposited and lent repeatedly (the assets counted in Cream can far exceed its actual circulation), ySwap’s Vouchers can be transferred directly to yUSD (the direct cause of the sharp increase in the value of mortgaged assets in Cream), etc.
Summarize
first level title
Summarize