Open code423n4 opened 3 years ago
We'll address this with a more custom function for converting
Spoke internally and we do not view this as a bug, not addressing.
Per code-423n4 guidelines, problems that are ecosystem-wide like frontrunning/sandwiching are generally not notable. The default slippage being very high warrants Note, though.
Duplicate of #106.
Handle
@cmichelio
Vulnerability details
Vulnerability Details
As the docs say:
When this trade is observed, it can be sandwich-attacked by arbitrage bots observing the mem pool.
The default max slippage (
_globals.maxSwapSlippage()
) is set to 10% and is too high which makes attacks profitable compared to the swap fees the attacker would have to pay:Impact
The attacker's profit is the treasury's loss and would result in the Maple treasury receiving fewer tokens than at market price.
Recommended Mitigation Steps
Set a max slippage to at most 1% and add a second parameter to
convertERC20
that allows specifying the amount of tokens to trade at once, instead of the whole amount. A lower trade size (chosen according to the swap pool's reserves) makes sandwich attacks not profitable.