This repository has been archived by the owner on May 26, 2023. It is now read-only.
IllIllI - Loans can be rolled an unlimited number of times #215
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
IllIllI
high
Loans can be rolled an unlimited number of times
Summary
Loans can be rolled an unlimited number of times, without letting the lender decide if has been done too many times already
Vulnerability Detail
The lender is expected to be able to toggle whether a loan can be rolled or not, but once it's enabled, there is no way to prevent the borrower from rolling an unlimited number of times in the same transaction or in quick succession.
Impact
If the lender is giving an interest-free loan and assumes that allowing a roll will only extend the term by one, they'll potentially be forced to wait until the end of the universe if the borrower chooses to roll an excessive number of times.
If the borrower is using a quickly-depreciating collateral, the lender may be happy to allow one a one-term extension, but will lose money if the term is rolled multiple times and the borrower defaults thereafter.
The initial value of
loan.rollable
is alwaystrue
, so unless the lender callstoggleRoll()
in the same transaction that they callclear()
, a determined attacker will be able to roll as many times as they wish.Code Snippet
As long as the borrower is willing to pay the interest up front, they can call
roll()
any number of times, extending the duration of the total loan to however long they wish:https://github.com/sherlock-audit/2023-01-cooler/blob/main/src/Cooler.sol#L129-L147
toggleRoll()
can't be used to stop rolls if they're all done in a single transaction.Tool used
Manual Review
Recommendation
Have a variable controlling the number of rolls the lender is allowing, and or only allow a roll if the current
block.timestamp
is within onereq.duration
of the currentloan.expiry
The text was updated successfully, but these errors were encountered: