Cream Finance Hack
Incident Overview
The flash loan attack happened on CreamFinance for the second time. Funds were stolen for a total of 130,000,000 $USD.
The attacker:
- borrowed $500m DAI from Maker
- deposited to yDAI into yUSD Curve pool (yDAI/yUSDC/yUSDT/yTUSD)
- deposited $500m yUSD into yUSD Yean Vault
- minted $500m cryUSD by depositing minted yUSD Yearn Vault into Cream Finance
- flash borrowed $2b ETH using contract
- minted cETHER by depositing $2b ETH into Cream Finance
- borrowed $500m yUSD Yean Vault by using the $2b ETH as collateral
- minted $500m cryUSD by depositing the $500m yUSD Yean Vault back in Cream Finance
- transferred $500m cryUSD to his address, balance: $1b cryUSD
- borrowed $500m yUSD Yearn Vault by using the $2b ETH collateral
- minted $500m cryUSD by depositing the $500m yUSD Yearn Vault back in Cream Finance
- transferred $500m cryUSD to his address, balance: $1.5b cryUSD
- borrowed $500m yUSD Yearn Vault, debt $1.5b against a $2b collateral
- transferred $500m yUSD Yearn Vault to his address, balance: $1.5b cryUSD and $500m yUSD Yearn Vault
- bought $3m DUSD from Curve
- burnt $3m DUSD for the underlying yUSD Yearn Vault collateral, balance: $1.5b cryUSD and $503m yUSD Yearn Vault
- burnt $503m yUSD Yearn Vault shares for the underlying yUSD tokens, the total supply of yUSD Yearn Vault reduced to $8m
- transferred $8m yUSD to yUSD Yearn Vault. The yUSD balance becomes $16m while the total supply remains $8m. The price of yUSDVault share becomes $2
- contract's debt increased to $3b against $2b collateral
- using $3b of cryUSD collateral on his balance, borrowed $2b ETH
- balance: $2b ETH, $500m yUSD, and $1b in Cream collateral ($3b cryUSD collateral minus $2b ETH debt)
- ETH and yUSD were used to pay back the flash loans and utilize the remaining $1b collateral to drain tokens from Cream Finance
When retrieving the share price of the yUSD pool, Cream's lending pool uses its pricePerShare interface directly, and this interface is supplemented by the contract's collateral balance and the amount of collateral assets in the strategy pool. To calculate the price of a single share, divide the total number of shares by the number of shares outstanding. As a result, by simply moving the collateral to yUSD, the user can easily increase the price of a single share, allowing the collateral in the Cream loan pool to lend more funds.
The attacker's addresses:
https://etherscan.io/address/0x24354d31…cf866b
https://etherscan.io/address/0x921760e7…7fe253
Attacker contract address:
https://etherscan.io/address/0x961d2b69…8a330d
The transaction under the attack:
https://etherscan.io/tx/0x0fe25420…331c92
Incident Report
Protocol Information
What the Attacker Needed to Succeed
Understanding the prerequisites for this type of attack helps auditors identify protocols that are most at risk and helps developers build better defenses.
What Auditors Should Check
If you're auditing a protocol with similar architecture to Cream Finance, these are the critical security checks that could have prevented this incident (October 2021).
- Verify all logic paths related to Flash Loan Attack are guarded by proper access controls and input validation - see the Flash Loans Attacks attack class for patterns
- Review privileged functions (owner, admin, governance) for potential abuse vectors - centralization risks should be documented and bounded with timelocks or multi-sigs
Master these auditing techniques with hands-on labs and real exploit scenarios in the Smart Contract Hacking course.
Free TrialSecurity Audit History
- Trail of Bits Report
Post-Incident Timeline
-
2022-09-12
1000 $ETH was swapped for 80 $BTC and bridged using REN protocol from the attacker's second address
-
2023-03-23
The Cream Finance team tweeted about their thoughts and findings about the exploited funds. They firmly believe that TradeOgre DEX is actively complicit in laundering the exploited funds for the exploiter, said in the tweet.
Related Attack Classes
The technique used in this hack maps to these vulnerability classes in our security curriculum:
Sources & References
-
01
Source 1 https://archive.vn/Z5Lev
-
02
Source 2 https://archive.is/kZVAa
Learn to Prevent the Next Cream Finance
The Cream Finance hack is one of many attacks that skilled auditors are trained to detect before deployment. Master real exploit patterns and defense techniques with hands-on Web3 security training.