High Risk of being frontrun when removing liquidity in CurveSpell
Summary
Inside the _removeLiquidity function in the CurveSpell contract, if the isKilled variable is true the contract will call the Curve remove_liquidity function, passing in minOuts as an array of uint256 with default values of 0.
Vulnerability Detail
This leaves the function vulnerable to being front-run by a MEV bot where the MEV bot can potentially steal all user funds by manipulating the curve pools as the expected minOutAmount is 0.
Impact
Loss of all funds, that the LP is trying to withdraw.
0xjoseph
high
High Risk of being frontrun when removing liquidity in CurveSpell
Summary
Inside the
_removeLiquidity
function in the CurveSpell contract, if theisKilled
variable is true the contract will call the Curveremove_liquidity
function, passing inminOuts
as an array of uint256 with default values of0
.Vulnerability Detail
This leaves the function vulnerable to being front-run by a MEV bot where the MEV bot can potentially steal all user funds by manipulating the curve pools as the expected
minOutAmount
is 0.Impact
Loss of all funds, that the LP is trying to withdraw.
Code Snippet
https://github.com/sherlock-audit/2023-07-blueberry/blob/main/blueberry-core/contracts/spell/CurveSpell.sol#L276-L289
Tool used
Manual Review
Recommendation
Estimate the minOutAmount off-chain when removing all liquidity and pass it in as an argument.