Swaps are conducted in the well when handling rain, with no slippage protection and an extremely large deadline parameter which can lead to sandwich attacks and loss of slippage.
When the handleRain
function is called, it attempts to handled the "season of plenty" by calling the sopWell
function. The function helps to handle oversaturation and helps bring bean price closer to peg by minting beans and swapping them in the well through the swapFrom
function. The issue is that this swap is conducted with basically no protection from slippage and a large deadline parameter.
From LibFlood.sol
and from IWell.sol
As can be seen from the functions, the library uses a minAmountOut parameter of 0, meaning any amount including 0 returned is acceptable. It also uses a deadline parameter of type(uint256).max
which means that the transaction can stay for that long in the mempool, held down by malicious miners.
Since the protocol aims to deploy on ethereum mainnet, which has a public mempool and is notorious for lots of MEV bots, malicious users and these bots can simply monitor and sandwich the handleRain
transactions for a quick profit leaving the protcol at a loss.
Loss of funds due to sandwich attacks.
Manual Code Review
Recommend using more reasonable parameters instead of 0. A certain percentage of the amount being swapped can be used instead.
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.