The slippage check implemented in the SmartVaultV3::swap(...) function is insufficient, as the minAmountOut can still be zero, potentially leading to a loss of tokens.
The SmartVaultV3::swap(...) function utilizes the SmartVault::calculateMinimumAmountOut(...) function to determine the minimum expected amount resulting from a token swap. However, the calculation is flawed. If the user's token swap doesn't impact the minimum required collateral for the minted token, the returned minAmountOut can be zero. Consequently, the token swap may allow for the return of 0 tokens, resulting in high slippage and potential substantial loss of assets for the user.
Additionally, if the contracts are deployed on the L1 blockchain, this vulnerability could expose the system to sandwich attacks, resulting in expensive swaps for the vault owner and potential loss of value for the user. In a sandwich attack scenario, malicious actors could exploit the slippage vulnerability to manipulate token prices, causing expensive swaps for the vault owner and potential loss of value for the user.
Users may experience a loss of tokens.
Manual Review
It is advised to incorporate user input for the minAmountOut rather than relying solely on calculations from other functions.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.