Malicious users can perform a grief attack by repaying a loan to themselves using multicall to deposit tokens, thereby exceeding the borrowATokenCap
.
#59
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-238
🤖_primary
AI based primary recommendation
🤖_11_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-06-size/blob/main/src/libraries/CapsLibrary.sol#L19-L44
Vulnerability details
Impact
Malicious users can perform a grief attack by repaying a loan to themselves using multicall to deposit tokens, thereby exceeding the
borrowATokenCap
.Bug Description
Let's first see the design reason for the borrowTokenCap: https://docs.size.credit/technical-docs/contracts/4.-faq
Multicall allows temporary exceeding the cap because users may want to deposit tokens then repay their debt. There is a check in
validateBorrowATokenIncreaseLteDebtTokenDecrease
that the increase in borrow tokens must be less or equal to the decrease in debt.However, if a user creates a loan to themselves, they can use multicall to repay this loan, and deposit as many borrow tokens into the protocol as they like, and exceeding
borrowATokenCap
.It can be also done at a very low cost, since according to the protocol parameters, a user can create a loan with 1M USDC with 1 hour tenor, and the swap fee APR is 0.5%, which is
1M USDC * 0.5% * 1 hour / 365 days = 0.57 USDC
. This means the malicious user only has to spend 0.57 USDC to deposit 1M USDC.CapsLibrary.sol
Multicall.sol
Proof of Concept
Add the following code in
Multicall.t.sol
. The steps are as follow:Tools Used
Manual review
Recommended Mitigation Steps
Don't allow a user to buy/sell his own limit order.
Assessed type
Other
The text was updated successfully, but these errors were encountered: