Closed c4-bot-3 closed 9 months ago
raymondfam marked the issue as sufficient quality report
raymondfam marked the issue as primary issue
no frontrun on L2
andresaiello (sponsor) disputed
It is stated in the README that Curves will run on a rollup L2, therefore no mempool and no MEV.
alcueca marked the issue as unsatisfactory: Invalid
There will be private mempool and sequencers who can still see those transactions can still front run .
Lines of code
https://github.com/code-423n4/2024-01-curves/blob/main/contracts/Curves.sol#L282
Vulnerability details
Impact
There is no slippage checks (minimum amount of ETH received back) present in https://github.com/code-423n4/2024-01-curves/blob/main/contracts/Curves.sol#L282
And since price monotonically increases with token supply based on a curve: https://github.com/code-423n4/2024-01-curves/blob/main/contracts/Curves.sol#L180
Note: [The following is being calculated: price = (supply)^2 to (supply + 1)^2 + (supply + 2)^2 + ... (supply - 1 + amount)^2] which can be calculated using the closed form formula above.
Therefore, it is possible for MEV bots to sandwich Alice's sellCurvesToken trade and make a profit:
It leads to a loss of funds for Alice.
Tools Used
Manual Review
Recommended Mitigation Steps
Add a minimumAmountETH parameter which the minimum amount of ETH the function will return to a user for a paritucular transaction and revert if the result of selling the tokens is lower than this amount.
Assessed type
Other