
On June 26, 2025, Resupply, a decentralized lending protocol operating as a sub-DAO of Convex and Yearn Finance, lost $9.56 million in a devastating attack that unfolded in just 90 minutes. The exploit targeted a newly deployed cvcrvUSD vault, leveraging a classic donation attack to manipulate exchange rates and drain the protocol's entire treasury.
12:18 AM - New crcrvUSD vault deployed with ERC-4626 vault contracts
1:53 AM - Attacker executes exploit, stealing $9.56 million
2:53 AM - Protocol initiates emergency response, setting borrow limits to zero
The attacker began by borrowing $4,000 USDC from Morpho through a flash loan, converting it to 4,000 crvUSD to fund the manipulation.
With the flash loan in hand, the attacker executed a classic ERC-4626 donation attack:
This single wei now represented the entire donated amount in the vault's accounting system, creating a massively inflated share price of 2,000,000,000,000,000,001,998,001,998,001,998.
When the ResupplyPair contract's _updateExchangeRate() function calculated the exchange rate, it used the following formula:
_exchangeRate = 1e36 / IOracle(_exchangeRateInfo.oracle).getPrices(address(collateral));
With the inflated oracle price exceeding 1e36, Solidity's integer division caused the exchange rate to round down to zero.
Critically, the contract lacked any validation such as require(_exchangeRate > 0), allowing this invalid value to be written to storage.
The zero exchange rate then flowed into the _isSolvent() function, which calculates a borrower's Loan-to-Value (LTV) ratio:
_ltv = ((_borrowAmount * _exchangeRate * LTV_PRECISION) / EXCHANGE_PRECISION) / _collateralAmount;
With _exchangeRate = 0, the entire LTV calculation collapsed to zero, causing the solvency check to always return true regardless of the loan amount.
Using just 1 wei of worthless collateral, the attacker borrowed 10 million reUSD tokens—the protocol's entire borrow limit. The funds were then:
The consequences were swift and severe:
Olympix's internal audit agent identified this exact vulnerability. Our audit agent flagged a High severity finding in the ResupplyPairCore contract:
Vulnerable Function: ResupplyPairCore.sol: _updateExchangeRate()
Vulnerability Details: The contract calculates the collateral exchange rate using 1e36 / IOracle(...).getPrices(...). This calculation uses integer division and lacks protection against price manipulation. An attacker can exploit a low-liquidity ERC4626 collateral vault via a donation attack to inflate the price reported by the oracle. If the reported price exceeds 1e36, the calculated _exchangeRate rounds down to zero.
Critical Impact: A zero exchange rate causes _isSolvent() to always return true, effectively disabling all LTV checks and allowing an attacker to borrow unlimited funds against negligible collateral, draining the pair contract.
Recommended Mitigation: Add a zero-check on the calculated exchange rate and ensure newly created markets are properly initialized to prevent price manipulation.
Olympix's internal audit agent autonomously analyzes smart contracts to identify complex logic errors and economic attack vectors. Our audit agent identified the exact vulnerability that led to the $9.56 million loss:
By running Olympix's audit agent during the development or pre-deployment phase, the Resupply team would have been alerted to this critical flaw before deploying the vault to mainnet.
Olympix generates comprehensive unit tests that cover edge cases and attack scenarios. For this vulnerability, our automated testing would have created test cases including:
These tests would have immediately exposed the flawed logic in the _updateExchangeRate() and _isSolvent() functions.
Olympix's mutation testing systematically modifies code to ensure test suites catch real bugs. For the Resupply vulnerability, mutation testing would have:
This would have revealed that existing tests failed to catch the integer division edge case.
Unlike traditional audits that provide a one-time snapshot, Olympix integrates directly into the development workflow:
This shift-left security approach means vulnerabilities are caught and fixed during development, not discovered in production by attackers.
ERC-4626 vaults calculate share prices based on the ratio of assets to shares. In empty or near-empty vaults, this creates a dangerous scenario:
Normal vault: 1,000 shares represent 1,000 tokens = 1:1 ratio
Empty vault after donation: 1 share represents 2,000 tokens = 1:2,000 ratio
This inflated ratio breaks price calculations, enabling the exploit. The vulnerability was entirely preventable through proper initialization practices.
This exploit demonstrates a fundamental truth about DeFi security: 90% of exploited smart contracts were previously audited. Traditional point-in-time audits are insufficient to protect against well-known attack patterns like donation attacks.
The Resupply hack was entirely preventable through:
The difference between a $9.56 million loss and a secure deployment comes down to integrating security throughout the development lifecycle:
A $4,000 flash loan became a $9.56 million theft because of missing validation checks and improper vault initialization. With Olympix's proactive security tools integrated into the development process, this vulnerability would have been identified and fixed before the vault ever went live, saving Resupply and its users from a devastating loss.
In DeFi, security isn't just about reviewing code after it's written. It's about building security into every step of the development process, catching vulnerabilities before attackers do.
Explore Olympix's suite of smart contract tools and learn more about the Olympix-led automated smart contract audit process. Empower your team to take control of your smart contract security from the start. Get your first scan FREE!