Closed c4-bot-3 closed 10 months ago
raymondfam marked the issue as sufficient quality report
raymondfam marked the issue as duplicate of #13
alcueca marked the issue as unsatisfactory: Invalid
alcueca marked the issue as unsatisfactory: Invalid
alcueca marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-01-curves/blob/516aedb7b9a8d341d0d2666c23780d2bd8a9a600/contracts/Curves.sol#L211
Vulnerability details
Impact
Functions buyCurvesToken() and sellCurvesToken() are used to buy and sell curves token shares of a specific tokenSubject in exchange for ETH. The issue with the functions is that they're missing slippage parameters. Due to this, the functions are prone to MEV attacks such as sandwiching and unintentional frontrunning by other users, which causes them to receive a worse execution price.
Additionally due to the slippage, there can be unintentional extra ETH sent by the user (if someone sells right before user), which remains permanently locked in the Curves contract. This occurs because this check in _buyCurvesToken() is not a strict "==", which allows acceptance of more ETH than intended.
Proof of Concept
Here is the whole process:
Coded POC
Here is how to run this POC:
test
folder.forge test --match-test testSlippageIssue -vvv
Slippage issue confirmation
Tools Used
Manual Review
Recommended Mitigation Steps
Add a slippage parameter in both functions to minimize this issue.
Assessed type
MEV