Lack of slippage control on deposit functions #15
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-a
insufficient quality report
This report is not of sufficient quality
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_primary
AI based primary recommendation
🤖_15_group
AI based duplicate group recommendation
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/market/WildcatMarket.sol#L117-L120
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/market/WildcatMarket.sol#L104-L108
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/market/WildcatMarketBase.sol#L406-L465
Vulnerability details
Impact
The lack of slippage control on both deposit functions can lead to a loss of assets for the affected lender.
Vulnerability Details
When a user calls
deposit()
ordepositUpTo()
the number of scaled tokens minted is dependent on the current scaleFactor of the market. The scaleFactor increases everytime_getUpdatedState()
is called in a new block so the longer it takes to process a user's transaction the less scaledTokens they will receive. If there is high congestion the user may receive far fewer tokens than expected.The user should therefore be able to pass in a slippage parameter whereby if the amount of scaledTokens they receive is not enough the transaction will be reverted.
POC
Tools Used
Manual Review
Foundry Testing
Recommendations
Allow lender to provide a min amount of tokens and a check at the end of execution, such that the transaction will revert if the actual amount of tokens is less than the minimum amount.
Assessed type
MEV
The text was updated successfully, but these errors were encountered: