Closed c4-submissions closed 1 year ago
Every single lending participant to a market is incentivised to hit updateState
if and when they notice a scenario like this. There is no need to create an external watchdog program for it.
Moreover, this example presumes that the grace period is set to zero. This is not a rational assumption: the protocol itself is vanishingly unlikely to ever permit zero as a minimum grace period bound in any controller factory that is deployed, and even if that did happen, no sane borrower would deploy a market with that value.
minhquanym marked the issue as primary issue
minhquanym marked the issue as sufficient quality report
laurenceday (sponsor) disputed
MarioPoneder marked the issue as unsatisfactory: Overinflated severity
See also #323.
Similar to liquidations in other DeFi protocols, the lenders are heavily incentivized to monitor the state and call updateState()
in case.
This is the intended way to avoid the the non-accrual of delinquency fees, therefore QA seems most appropriate.
(Since the original severity is High, the issue was invalidated as overinflated)
Lines of code
https://github.com/code-423n4/2023-10-wildcat/blob/main/src/market/WildcatMarket.sol#L26
Vulnerability details
Impact
Once the market goes below required reserves, it is marked as delinquent only if an
updateState()
action happens. Actions likemarket.updateState()
,executeWithdrawal()
,deposit()
, etc. have to happen else the protocol remains unaware of the market's delinquency and no penalty fees is applied on the borrower. The borrower can repay before any state updates happen and escape a penalty altogether.Proof of Concept
Save the following code in a new file inside the
test/market/
folder.forge test --mt test_t0x1c_SomeAction_TimeLapse -vv
to confirm that the market goes into delinquency within 1 second due to interest accrual & protocol fee. The test should pass.forge test --mt test_t0x1c_NoAction_TimeLapse -vv
to see that in the absence of any explicit state updates, market is never delinquent. Then the borrower himself callsmarket.stateUpdate()
after repayment and escapes his 2 hours of penalty.Tools Used
Manual inspection, foundry.
Recommended Mitigation Steps
Such issues are normally overcome by protocols incentivizing participants to flag any such undercollateralization events, so that state updates can happen and protocols do not face a loss of fees. This way, a user would be inclined to hit
market.updateState()
and monitor any delinquent positions which can be flagged to receive an award from the protocol.Assessed type
Other