Missing slippage control system. Users may lose a lot of funds due to front-running MEV bots.
Submitted by Chom, also found by Jeiwan
AlgebraPool.sol#L416-L485 AlgebraPool.sol#L589-L623 AlgebraPool.sol#L626-L673
Missing slippage control system. Users may lose a lot of funds due to front-running MEV bots. It has liquidityDesired or amountRequired but these parameters are only used in output amount calculation. It isn’t used to prevent the output amounts from dropping below a threshold. So, MEV bots can front-run to profit from dropping the output amount of user swap.
See warden’s original report for full PoC and Recommended Mitigation Steps.
Given the lack of periphery contracts that would handle slippage for minting LP tokens, there doesn’t appear to be any mechanism to ensure that during
mintorburnthere isn’t greater than expected slippage. Will wait for the sponsor to comment on this to confirm my understanding.If correct, this should be a High severity finding as it does lead to a loss of funds from sandwich attacks.
vladyan18 (QuickSwap & StellaSwap) acknowledged and commented:
Contracts are initially made taking into account the use of appropriate periphery. Accordingly, slippage control is in the area of responsibility of the periphery.
Given that this wasn’t made explicit in the README and the scope of the contracts that are being audited is what was provided to the wardens, I believe the wardens issue to be valid.
sameepsi (QuickSwap & StellaSwap) disagreed with severity and commented:
Yes, it’s handled in the periphery contracts. But, I will consider it to be a medium risk given we did not update the README file.
The issue is not that the README wasn’t updated. The issue is that the contracts that were submitted for audit contain a vulnerability. The wardens spent time and energy to find that vulnerability and it should be awarded. It is good to know you already have a mitigation plan in place, but at the time of the wardens doing their work, they had no way of knowing that.
0xean (judge) decreased severity to Medium and commented:
After more discussions during QA, it was made clear that I missed the fact the the call from an EOA would revert. So a contract must be the caller here, which makes it less likely that this becomes an issue. While I do think the sponsors should have been more explicit in the readme, this brings down potential for this to be a problem considerably.
Given that it was not documented and an integrating contract would have to know that it needed to handle slippage will downgrade to Medium.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in QuickSwap and StellaSwap contest. Code4rena made it public on 1 December 2023. Found in the 2022-09-quickswap audit contest (finding M-12).
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.