-
Notifications
You must be signed in to change notification settings - Fork 0
ADM - Lender is able to steal borrowers collateral by calling rollLoan with unfavourable terms on behalf of the borrower. #26
Comments
Whether this is medium or high depends on how likely borrowers are to make massively over-collateralized loans |
Summary: An attacker can manipulate the interest_, loanToCollateral_, duration_ parameters, bypassing Clearinghouse.rollLoan(); Lender is able to steal borrowers collateral by calling rollLoan with unfavourable terms on behalf of the borrower. Issue Links: sherlock-audit/2023-08-cooler-judging#198 ; sherlock-audit/2023-08-cooler-judging#26 Fix Description: Only allow lender to enable rollover at the same terms as origination, instead of with newly proposed terms.
imo a Medium |
escalate |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
Addition: |
Result: |
Escalations have been resolved successfully! Escalation status:
|
Fix confirmed. Sponsor agreed to accept some economic concerns with the fix, but no security concerns were identified. |
ADM
high
Lender is able to steal borrowers collateral by calling rollLoan with unfavourable terms on behalf of the borrower.
Summary
A Lender is able to call provideNewTermsForRoll with whatever terms they want and then can call rollLoan on behalf of the borrower forcing them to roll the loan with the terms they provided. They can abuse this to make the loan so unfavourable for the borrower to repay that they must forfeit their collateral to the lender.
Vulnerability Detail
Say a user has 100 collateral tokens valued at $1,500 and they wish to borrow 1,000 debt tokens valued at $1,000 they would would call: (values have simplified for ease of math)
If a lender then clears the request the borrower would expect to have 1 year to payback 1,050 debt tokens to be able to receive their collateral back.
However a lender is able to call provideNewTermsForRoll with whatever terms they wish: i.e.
They can then follow this up with a call to rollLoan(loanID):
During the rollLoan function the interest is recalculated using:
As rate_ & duration_ are controllable by the borrower when they call provideNewTermsForRoll they can input a large number that the amount returned is much larger then the value of the collateral. i.e. input a rate_ of amount * 3 and duration of 365 days so that the interestFor returns 3,000.
This amount gets added to the existing loan.amount and would make it too costly to ever repay as the borrower would have to spend more then the collateral is worth to get it back. i.e. borrower now would now need to send 4,050 debt tokens to receive their $1,500 worth of collateral back instead of the expected 1050.
The extra amount should result in more collateral needing to be sent however it is calculated using loan.request.loanToCollateral which is also controlled by the lender when they call provideNewTermsForRoll, allowing them to input a value that will result in newCollateralFor returning 0 and no new collateral needing to be sent.
As a result a borrower who was expecting to have repay 1050 tokens to get back their collateral may now need to spend many multiples more of that and will just be forced to just forfeit their collateral to the lender.
Impact
Borrower will be forced to payback the loan at unfavourable terms or forfeit their collateral.
Code Snippet
Cooler.sol#L192-L217
Cooler.sol#L282-L300
Tool used
Manual Review
Recommendation
Add a check restricting rollLoan to only be callable by the owner. i.e.:
Note: unrelated but rollLoan is also missing its event should add:
The text was updated successfully, but these errors were encountered: