- Type: Exploit
- Network: Fantom
- Total lost: ~$1.55MM USDC
- Category: Price Manipulation
- Vulnerable contracts:
- Attack transactions:
- Attacker Addresses:
- Attack Block:: 34041500
- Date: Mar 21, 2022
- Reproduce:
forge test --match-contract Exploit_OneRingFinance -vvv
- Flashloan some USDC
- Deposit it to mint shares
- Withdraw the shares for USDC
- Repay loand and transfer profit
One Ring Finance used the amount of reserves held in the vault as a price gauge. The attacker can manipulate the price by changhing the amount of reserves in the contract.
Both the deposit
and withdraw
methods use:
uint256 _sharePrice = getSharePrice();
To calculate how many shares the user must receive. To exploit this, the attacker deposited USDC into the contract, which drove the price of the shares up, and then immediatly sold them.
- Use Time-Weighted price feeds or other reliable oracles to get the price of commodities instead of relying on a metric that can be manipulated with flash loans.
- Another strategy is to implement
slippage
, so the price of each share increase the more you buy.