Closed sherlock-admin3 closed 8 months ago
3 comment(s) were left on this issue during the judging contest.
panprog commented:
invalid, slippage check is done downstream in
exchange
and upstream in DVP when the actual premium is compared to user's provided max premium value.
tsvetanovv commented:
Slippage related issue is known issues. Check Readme.
takarez commented:
invalid; DEX SWAP: issues related to impacts of fees and slippage are known and mitigated
hals
medium
UniswapAdapter._swapInSingle()
&UniswapAdapter._swapInPath()
don't implement a slippage checkSummary
UniswapAdapter._swapInSingle()
&UniswapAdapter._swapInPath()
don't implement a slippage check.Vulnerability Detail
The protocol integrates with Uniswap V3 pools as an underlying DEX to swap side tokens for base tokens of vaults (via
Vault._sellSideTokens()
) in:Vault.emergencyRebalance()
: to sell all side tokens if the vault is stuck inInsufficientLiquidity
error.Vault._adjustBalances()
: to ddjust the balances in order to cover the liquidity locked for pending operations and obtain an equal weight portfolio.Vault._beforeRollEpoch()
Vault._deltaHedge()
and the swapping is done by callingUniswapAdapter.swapIn()
function, where it will swap the given amount of tokenIn tokens in exchange for some tokenOut tokens, and will return the amount of output token given by the exchange.where:
and
As can be noticed; the
amountOutMinimum
parameter is set to zero for the swap, indicating that any returned amount will be accepted.Impact
Since there's no check in the returned
tokenOutAmount
whereverswapIn
function is used inVault
contract (the aforementioned functions); this would result in the protocol (or any user using this contract to swap) to lose their tokens by accepting any returned amount from swapping.Code Snippet
UniswapAdapter.swapIn function
UniswapAdapter._swapInPath function
UniswapAdapter._swapInSingle function
Tool used
Manual Review
Recommendation
Check the
tokenOutAmount
value returned from callingswapIn
function in the aforementionedVault
contract functions against an acceptable value (slippage, being a percentage of the swapped amount).