Open c4-submissions opened 1 year ago
minhquanym marked the issue as sufficient quality report
d1ll0n (sponsor) acknowledged
Since there is a queue per market where the participating parties are legally bound by an off-chain contract, therefore the risk of gas griefing negligible. Other than that, there are no malicious impacts.
Nevertheless, this heavily impedes the UX. An excellent QA finding.
MarioPoneder changed the severity to QA (Quality Assurance)
MarioPoneder marked the issue as grade-b
MarioPoneder marked the issue as grade-a
Hi @MarioPoneder I would like to ask you to kindly reconsider the downgrading of this finding:
Since there is a queue per market where the participating parties are legally bound by an off-chain contract, therefore the risk of gas griefing negligible.
There are two aspects I would bring into consideration:
Thanks!
Thank you for reaching out, those are interesting aspects.
Considering only the technical level: The present griefing attack cannot be done by anyone except lenders that do hold market tokens, therefore the likelihood & impact is minimized.
Considering only the business level: Although unlikely, a reserve rate > 90% could be legitimated by an off-chain contract (concerning the comparison with #497), while griefing is not a valid business case. Furthermore, sanctions are a risk borrower & lender parties have to bear and the protocol offers an escrow mechanism to mitigate it.
Therefore, QA status is maintained, but definitely grade A.
Thanks for your understanding.
Lines of code
https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/market/WildcatMarketWithdrawals.sol#L84 https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/market/WildcatMarketWithdrawals.sol#L190
Vulnerability details
Whenever a
WildcatMarket
receives a withdrawal request it cannot process, it will enqueue it in theunpaidBatches
FIFO queue.Any lender who queued a withdrawal request will see their withdrawal execution fail, unless batches prior to theirs get processed, possibly at their own expense via repeated
processUnpaidWithdrawalBatch
calls.Since there is no lower limit to how much a lender can request to withdraw, once the market has no funds to cover withdrawals, a lender could enqueue requests of withdrawing as little as
1 wei
. If the market is configured with short enough withdrawal periods, these requests can make theunpaidBatches
queue grow arbitrarily large.Impact
There are two impacts on this finding:
executeWithdrawals
will fail despite being covered, unless the lender repeatedly callsprocessUnpaidWithdrawalBatch
to crunch the backlog1 wei
requestsProof of Concept
The below PoC shows how a covered batch fails to be executed without a leading array of
processUnpaidWithdrawalBatch
calls:Tools Used
Code review, Foundry
Recommended Mitigation Steps
Consider mitigating the problem on two fronts:
processUnpaidWithdrawalBatch
loop in execution requests, so, once the queue processing cost is at bay, it becomes an automatic actionAssessed type
DoS