You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.
sherlock-admin opened this issue
Aug 28, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
[H-01] Malicious lender can set very large interest rates and make the loan unpayable.
Summary
Malicious lender can set very large interest rates and make the loan unpayable, leading to the loan getting defaulted and lender getting the collateral.
Vulnerability Detail
In Cooler.sol, the Cooler::provideNewTermsForRoll() function is used to set new terms for the loan by the lender and calling Cooler::rollLoan() which sets those parameters while updating the values. These two functions can be called in succession by a malicious lender to create an attack scenario.
Lender calls provideNewTermsForRoll() setting the interest to very high.
And calls rollLoan immediately and lender need to only pay newCollateral, which in most cases will be zero. The updated interest is calculated with newDebtand added to loan.amount but never withdrawn from the msg.sender when calling rollLoan() so it does not affect the malcious Lender.
Now interest is set to very high and borrower is stuck to pay the abnormal amount of interest and lender can wait till it defaults and get the collateral.
Impact
Lose of collateral for borrower.
Code Snippet
//File:: Cooler.solfunctionprovideNewTermsForRoll(//@audit so lender can greatly increase interest rate and duration?uint256loanID_,uint256interest_,uint256loanToCollateral_,uint256duration_)external{Loanstorageloan=loans[loanID_];if(msg.sender!=loan.lender)revertOnlyApproved();loan.request=Request(loan.amount,interest_,loanToCollateral_,duration_,true);}
Cooler::rollLoan()//Update the amount with the new debtuint256newDebt=interestFor(loan.amount,loan.request.interest,loan.request.duration);loan.amount+=newDebt;// Then use the updated amount to calculate newCollateraluint256newCollateral=newCollateralFor(loanID_);//@audit loan.collateral+=newCollateral;
sherlock-admin2
changed the title
Wobbly Wooden Sardine - [H-01] Malicious lender can set very large interest rates and make the loan unpayable.
Kral01 - [H-01] Malicious lender can set very large interest rates and make the loan unpayable.
Sep 12, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Kral01
high
[H-01] Malicious lender can set very large interest rates and make the loan unpayable.
Summary
Malicious lender can set very large interest rates and make the loan unpayable, leading to the loan getting defaulted and lender getting the collateral.
Vulnerability Detail
In Cooler.sol, the Cooler::provideNewTermsForRoll() function is used to set new terms for the loan by the lender and calling Cooler::rollLoan() which sets those parameters while updating the values. These two functions can be called in succession by a malicious lender to create an attack scenario.
provideNewTermsForRoll()
setting the interest to very high.rollLoan
immediately and lender need to only paynewCollateral
, which in most cases will be zero. The updated interest is calculated withnewDebt
and added toloan.amount
but never withdrawn from themsg.sender
when callingrollLoan()
so it does not affect the malcious Lender.Impact
Lose of collateral for borrower.
Code Snippet
Tool used
Manual Review
Recommendation
There are a few ways to address this issue:
MAX_INTEREST_RATE = 'a reasonable rate'
.Cooler::rollLoan()
only callable by the owner.Make this code:
In this order:
Duplicate of #26
The text was updated successfully, but these errors were encountered: