Now, when USDT/USDC price is 0.9, the protocol tries to swap 1USDC for 1USDT. But that swap fails because prices have deviated. Now the vault is locked because rebalance flow cannot complete.
Impact
User cannot call withdraw, withdrawRewards, withdrawAllowance. These functions require the vault to be in idle state.
tives
medium
Vault.rebalance assumes stablecoin price parity and will revert if it cannot make the swap, locking user funds.
Summary
Vault.rebalance assumes stablecoin price parity and makes a swap according to this when rebalancing.
Vulnerability Detail
During a turbulent market or stablecoin bankrun, the USDC/(USDT/DAI) price can deviate from 1:1.
Vault.rebalance
callsThese functions swap stable tokens on Curve. The amountOutMin is calculated with the assumption of 1:1 price, excluding pool fee.
Now, when USDT/USDC price is 0.9, the protocol tries to swap 1USDC for 1USDT. But that swap fails because prices have deviated. Now the vault is locked because rebalance flow cannot complete.
Impact
User cannot call
withdraw
,withdrawRewards
,withdrawAllowance
. These functions require the vault to be in idle state.Code Snippet
[link](https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/libraries/Swap.sol/#L42)
Tool used
Manual Review
Recommendation
Use price oracles to verify pair’s 1:1 price. Input expected price on rebalance function.
Duplicate of #135