Closed c4-bot-2 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#L263-L280 https://github.com/code-423n4/2024-01-curves/blob/516aedb7b9a8d341d0d2666c23780d2bd8a9a600/contracts/Curves.sol#L282-L293
Vulnerability details
Due to the
_buyCurvesToken
andsellCurvesToken
functions, when executed, if the price is not equal to the expected price (calculated before sending the transaction), two bad scenarios arise:Price decrease before the trader's buy transaction is executed:
The trader loses the additional value paid, which becomes locked in the contract since the contract does not refund the excess amount.
Price decrease before the trader's sell transaction is executed:
The trader sells their tokens at a lower price than expected.
Impact
Proof of Concept
POC setup
foundry.toml:
Tools Used
Manual Review Foundry
Recommended Mitigation Steps
Implement slippage protection in
sellCurvesToken
and_buyCurvesToken
.Assessed type
Other