Home Web3 SecurityCrypto Hacks & Exploits Cream Finance Exploit – Oct 27, 2021-Detailed Analysis

Cream Finance Exploit – Oct 27, 2021-Detailed Analysis

by ImmuneBytes
Cream Finance Exploit – Oct 27, 2021-Detailed Analysis


On October 27, 2021, Cream Finance, a prominent decentralized lending protocol on the Ethereum blockchain, experienced a critical exploit that resulted in a massive security breach.

This breach led to the theft of over $136 million worth of crypto assets from the C.R.E.A.M. v1 lending markets. Notably, the stolen assets comprised largely of ERC-20 coins and C.R.E.A.M. Liquidity Protocol tokens.

In this report, we will delve into the background of Cream Finance, shed light on its prior vulnerabilities, provide detailed insights into the recent exploit, examine its root cause, and discuss the subsequent remedial actions taken by Cream Finance.

What is Cream Finance?

Cream Finance operates as a decentralized lending and borrowing protocol on the Ethereum blockchain. Its primary function is to enable users to lend out their assets and earn interest or borrow assets by keeping collateral.

Over time, Cream Finance has become a significant player in the Decentralized Finance (DeFi) space.

History of Cream Finance Exploits

Cream Finance hasn’t had a smooth run throughout its journey. The year 2021 saw Cream Finance at the receiving end of multiple attacks:

February 13, 2021: Alpha Homora, a leverage liquidity protocol, suffered a flash loan attack that targeted Cream Finance’s Iron Bank Service. The attack led to a loss of $37 million from Alpha Homora.

August 3, 2021: A reentrancy attack was executed against Cream Finance. This attack involved a bug in the smart contract, allowing the attacker to loop withdrawal requests. The primary exploit resulted in the loss of 462,079,976 AMP tokens and 2,804.96 ETH.

The recurrence of these attacks underlines Cream Finance’s vulnerabilities and challenges in maintaining users’ trust.

Key Details of the Exploit

Initial Breach

The attacker initiated the exploit by borrowing a staggering $500 million DAI from MakerDao. The subsequent chain of actions involved leveraging Yearn vaults, Curve pools, and finally, exploiting Cream Finance’s lending system.

Vulnerability Exploited

The attacker identified and exploited a flaw in the platform’s lending system. This vulnerability allowed the attacker to manipulate Cream Finance’s assets and tokens, draining a significant portion of its liquidity.

Addresses Involved:

  1. Address A: 0x961d2b694d9097f35cfffa363ef98823928a330d
  2. Address B: 0xf701426b8126bc60530574cecdcb365d47973284
  3. Attacker’s Address: 0x24354d31bc9d90f62fe5f2454709c32049cf866b
  4. Additional involved addresses: 0x921760e71fb58dcc8DE902cE81453E9e3D7fe253 and 0x70747df6AC244979A2ae9CA1e1A82899d02bbea4.

Detailed Analysis of the Exploit

Address A (0x961d2b694d9097f35cfffa363ef98823928a330d):

  • Borrowed $500 million DAI from MakerDao.
  • Deposited the DAI into the yDAI Yearn vault, obtaining 500 yDAI.
  • Deposited the yDAI into yUSD Curve pool to attain yUSD.
  • Deposited the yUSD into the yUSD Yearn vault, boosting its balance to $511 million.
  • Supplied yUSDVault into C.R.E.A.M., receiving $500 million cryUSD. Address B (0xf701426b8126bc60530574cecdcb365d47973284):
  • Borrowed $2 billion Ethereum via a flash loan.
  • Deposited the Ethereum into C.R.E.A.M., securing $2 billion cEther as collateral.
  • Borrowed $500 million yUSDVault using the cEther collateral.
  • Repeated this process, borrowing and transferring funds to Address A, increasing its balance.
  • Used Address A to purchase $3 million DUSD from Curve, then burned the DUSD to unlock underlying collateral.
  • Managed a manipulation to make C.R.E.A.M. believe the value of assets in Address A was doubled. Used this inflated collateral to borrow more assets.

Final Transaction Flow

The attacker, having manipulated the perceived value of assets, borrowed $2 billion ETH using the inflated collateral in Address A.

After repaying the flash loans with ETH and yUSD, the attacker leveraged the remaining collateral to withdraw about $136 million from C.R.E.A.M.

End Results

The attacker’s primary address, 0x24354d31bc9d90f62fe5f2454709c32049cf866b, accumulated the stolen funds post-hack. The assets were then redistributed between two addresses: 0x921760e71fb58dcc8DE902cE81453E9e3D7fe253 and 0x70747df6AC244979A2ae9CA1e1A82899d02bbea4.

The following tokens were stolen:

Token NameToken ValueUSD PriceToken Value USD
Total Losses:$136,731,849.88

Root Cause and Attack Flow

Attack Transaction

The starting point of this exploit can be traced back to the transaction:

Attack Mechanics and Sequence

  1. Flash Mint: Attacker initiates a flash mint of $500 million DAI from MakerDAO.
  2. Yearn 4-Curve Pool: Deposits the DAI into Yearn 4-Curve pool.
  3. Yearn yUSD Vault: The Yearn 4-Curve from the previous step is then deposited into Yearn yUSD vault.
  4. Cream yUSD Market: The yUSD from the previous step is deposited into Cream’s yUSD market.
  5. AAVE v2: Borrows over 500,000 Ether using a flash loan from AAVE v2.
  6. Ether Deposit: From a secondary smart contract (Account 2), the attacker deposits this Ether into Cream’s ETH market.
  7. yUSD Borrow and Deposit: The attacker borrows yUSD from Account 2 and deposits it into Account 1 as collateral. This action is performed twice.
  8. yUSD Transfer: The attacker then borrows yUSD from Account 2 and transfers it to Account 1.
  9. yUSD Vault Withdrawal: The attacker withdraws Yearn 4-Curve from yUSD vault.
  10. Manipulating the Oracle: The attacker sends $10 million of Yearn 4-Curve to yUSD vault, exploiting the hybrid oracle and manipulating the price.
  11. Liquidity Drain: The attacker borrows all available liquidity using Account 1.
  12. Swaps: Converts stolen funds into DAI and WETH.
  13. Flash Loan Repayment: Withdraws DAI from Yearn 4-Curve to repay the DAI flash mint and the AAVE ETH flash loan.
  14. Profit Securing: The attacker ensures all profits are secure.

Root Causes

  1. Manipulatable Hybrid Oracle: At step 10, the attacker exploits a vulnerability in the easily manipulatable hybrid Oracle system.
  2. Uncapped Token Supply: In steps 7 and 8, the uncapped supply of a token allows the attacker to trick the protocol. By supplying the same asset multiple times, the system believes that much higher collateral is available.

Detailed Attack Dynamics

yUSD Contract Mechanism: The yUSD contract’s exchange rate is guided by the ratio of 4-Curve tokens that the yUSD vault can access, compared to the total yUSD tokens in circulation. By sending more Yearn 4-Curve tokens to the vault, the attacker artificially doubles the value of 4-Curve tokens accessible to yUSD. This manipulates the reported exchange rate of the vault, subsequently altering the value the Oracle reports for the yUSD token.

Aftermath of Increased Exchange Rate
  • Account 1: $3 billion in collateral and no borrowing.
  • Account 2: $2 billion in collateral, $3 billion in debt, effectively insolvent.
  • The attacker has debts of $2 billion in ETH and $500 million in DAI.
  • The attacker possesses an excess of $500 million in value, enough to drain the protocol.
Repayment and Profit

Post-manipulation, the attacker borrows back the supplied ETH to repay the AAVE flash loan. The remaining over-collateralized collateral (approx. $1 billion) allows the attacker to borrow and drain the last $130 million of liquid collateral in the protocol’s lending markets.

After converting the stolen collateral to sufficient DAI and ETH to clear flash borrowing, the exploit gets completed.

The profits from this attack were divided between two wallets, suggesting a possible collaboration between two attackers.

Remedies Taken by Cream Finance

In the aftermath of the exploit, Cream Finance adopted multiple strategies to contain the damage and prevent further exploits:

  • Suspended all interactions with Ethereum v1 markets.
  • Locked crTokens on Cream Ethereum v1 markets, making further transfers of crTokens impossible.
  • Stopped supply/borrowing of all wrappable tokens, including all PancakeSwap LP tokens.
  • Initiated a dialogue with the attacker, urging the return of users’ funds and offering a bug bounty for cooperation.


The recurring attacks on Cream Finance emphasize the nascent nature of DeFi platforms and the inherent vulnerabilities that exist within smart contracts.

While the immediate remedial actions taken by Cream Finance were commendable, the series of events underscores the importance of comprehensive security measures in the rapidly evolving world of decentralized finance.

You may also like