GoPlus Security 🚦 (@GoPlusSecurity): ResupplyFi Protocol Attack Analysis: $9.6M Exploit on Ethereum
Estimated coin impact
Scores are not price-change percentages. High impact means a score of +70 or more, or -70 or less.
ResupplyFi Protocol Attack Analysis: $9.6M Exploit on Ethereum On June 26, @ResupplyFi was exploited on #ETH, resulting in approximately $9.6M in losses and significant volatility in $reUSD. Vulnerability Analysis The vulnerability lies in the "borrow" function's validation logic of the exploited contract. The "exchangeRate" parameter calculation depends on the amount of crvUSD held by "cvcrvUSD.controller". Attackers manipulated the exchangeRate calculation by transferring crvUSD to the controller contract, causing validation errors during borrowing operations. Security Recommendations When implementing numerical validations in smart contracts: Avoid dependencies on external dynamic on-chain data (e.g., dynamic token prices, account token balances) Carefully reason through and verify validation logic and numerical calculation logic Reduce attack vectors through robust design patterns Attack Details Attacker Addresses: 0x6d9f6e900ac2ce6770fd9f04f98b7b0fc355e2ea 0x886f786618623fffb2be59830a47661ae6492e16 Attack Contracts: 0xf90da523a7c19a0a3d8d4606242c46f1ee459dc7 0x151aa63dbb7c605e7b0a173ab7375e1450e79238 Exploited Contract: 0x57ab1e0003f623289cd798b1824be09a793e4bec (reUSD) Attack Transaction: https://etherscan.io/tx/0xffbbd492e0605a8bb6d490c3cd879e87ff60862b0684160d08fd5711e7a872d3 Attack Process Breakdown Step 1: Flash loan 4,000 USDC Step 2: Swap 4,000 USDC for 3,999 crvUSD Step 3: Transfer 2,000 crvUSD to cvcrvUSD.controller Step 4: Call cvcrvUSD.mint function to mint 1e-18 cvcrvUSD, depositing 2+1e-18 crvUSD Step 5: Add collateral tokens to msg.sender's lending position (1e-18 cvcrvUSD) Step 6: Borrow entire 10,000,000 reUSD from ResupplyPair contract The Critical Flaw The attack succeeds due to a manipulation in the borrow function execution: → Before executing "_borrow" and "_isSolvent" checks, "exchangeRateInfo" gets updated → The updated "exchangeRate" equals 0 due to manipulation → With numerator = 1e36 and denominator > 2e36, the calculated exchangeRate rounds down to 0 → The "total_assets" (crvUSD amount held by cvcrvUSD.controller) increases due to Step 3's transfer → This results in "_ltv = 0" in the solvency check, causing validation to always return true Step 7: Exchange reUSD for scrvUSD, then redeem crvUSD through redeem function Step 8: Convert crvUSD to USD and WETH, repay flash loan of 4,000 USDC Step 9: Extract all profits Key Takeaway This exploit demonstrates the critical importance of secure oracle implementations and the dangers of relying on manipulatable external data sources in DeFi protocols. The attacker essentially broke the protocol's accounting system by artificially inflating the controller's balance, making the system believe collateral was worth more than it actually was. This analysis is provided by GoPlus Security for educational purposes. Always verify smart contract security before interacting with DeFi protocols. #DeFiSecurity #SmartContractSecurity #GoPlus #CryptoSecurity