Minimum deposit requirement can be bypassed #13
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-a
primary issue
Highest quality submission among a set of duplicates
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_primary
AI based primary recommendation
🤖_55_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/AccessControlHooks.sol#L850-L880
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/AccessControlHooks.sol#L812-L825
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/AccessControlHooks.sol#L769-L804
Vulnerability details
Impact
Users can bypass the minimum deposit requirement to create small positions
Small positions may be used as an attack path
Vulnerability Details
The minimum deposit for market is not enforced in the withdrawal process or the transfer process so lender can bypass the requirement.
Say the minimum deposit is 100_000; a user can:
or
Both hooks templates enforce the minimum deposit (if set) in the onDeposit hook as:
However there is no check when a user executes a transfer of Scaled Tokens or withdraws from the protocol to go below the minimum deposit level.
See onTransfer()
See onQueueWithdrawal()
The market prefers not to allow small positions because they may be too small to be worth the gas cost of conducting operations on.
Furthermore, an attacker can add a large amount of small positions in order to exploit the block gas limit in a function which is gas heavy using operations like looping, such as
closeMarket()
sich that they may be able to cause a DOS.POC
Add the test function below to
WildcatMarket.t.sol
and run:User bypasses minimum deposit
Tools Used
Manual Review
Foundry Testing
Recommendations
Enforce minimum deposit with a check in the onTransfer & onQueueWithdrawal hooks in both hooks templates so that user cannot go below it
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: