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.
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
Lenders can jack up interest rates to force borrowers to pay more.
Summary
Lenders can jack up interest rates to force borrowers to pay more.
Vulnerability Detail
The function provideNewTermsForRoll can be used by lenders to change the loan parameters. This can be used to change the interest rate, duration, and loan-to-collateral ratios.
The new loan terms can be applied to the loan by calling the rollLoan function. Lenders can set up new loan parameters and can force borrowers to pay more interest. In the rollLoan function, the extra collateral needed to cover the loan is calculated and stored in the newCollateral variable.
Here we see the new collateral amount, and the new interest amount are calculated and the loan is updated. The newCollateral value is actually charged from the msg.sender, so the lender needs to keep this at 0 to not pay anything. This can be done by setting a lower loanToCollateral ratio. This can be understood from the implementation of the newCollateralFor function.
Here, if the newCollateral is lower than the existing loan.collateral, the newCollateral is set to 0. To ensure this, the lender can set a lower value of loanToCollateral ratio. This will ensure that the newCollateral is lower than the existing collateral, and thus the lender will not have to pay anything. The borrower will have their loan updated with a larger interest amount.
Assume Alice is the borrower, and Bob is the lender.
Alice sets up a loan request. Loan amount is 100 USD, loan-to-collateral is 0.5. Interest is 10% pa. Duration is 1 year.
collateralFor(100,0.5) = 200 So alice pays collateral worth 200 USD to the contract. Due to 10% interest, Alice has to repay 110 USD after 1 year.
Bob fulfills the loan request. Bob pays 100 USD to the contract, which is the loan amount. loan.amount is set to 110 (principal + interest)
Bob resets the loan parameters with interest of 1000% pa, duration of 0, and loantocollateral of 0.8.
In the rollLoan function, newCollateral is calculated from collateralFor(110,0.8)=137.5. Since this is less than 200, newCollateral is set to 0.
newDebt is calculated as the interest at the updated rate of 1000% pa. So newDebt=1210.
Now Alice is forced to pay 1210 USD. Alice will never pay that loan, but the attacker can change the numbers until Alice is forced to pay almost 200 USD of the loan and force Alice to give up all her collateral.
Impact
Borrowers can have their interest rates changed on them.
sherlock-admin
changed the title
Bent Latte Skunk - Lenders can jack up interest rates to force borrowers to pay more.
carrotsmuggler - Lenders can jack up interest rates to force borrowers to pay more.
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
carrotsmuggler
high
Lenders can jack up interest rates to force borrowers to pay more.
Summary
Lenders can jack up interest rates to force borrowers to pay more.
Vulnerability Detail
The function
provideNewTermsForRoll
can be used by lenders to change the loan parameters. This can be used to change the interest rate, duration, and loan-to-collateral ratios.The new loan terms can be applied to the loan by calling the
rollLoan
function. Lenders can set up new loan parameters and can force borrowers to pay more interest. In therollLoan
function, the extra collateral needed to cover the loan is calculated and stored in thenewCollateral
variable.Here we see the new collateral amount, and the new interest amount are calculated and the loan is updated. The
newCollateral
value is actually charged from themsg.sender
, so the lender needs to keep this at 0 to not pay anything. This can be done by setting a lowerloanToCollateral
ratio. This can be understood from the implementation of thenewCollateralFor
function.Here, if the
newCollateral
is lower than the existingloan.collateral
, thenewCollateral
is set to 0. To ensure this, the lender can set a lower value ofloanToCollateral
ratio. This will ensure that thenewCollateral
is lower than the existing collateral, and thus the lender will not have to pay anything. The borrower will have their loan updated with a larger interest amount.Assume Alice is the borrower, and Bob is the lender.
collateralFor(100,0.5) = 200
So alice pays collateral worth 200 USD to the contract. Due to 10% interest, Alice has to repay 110 USD after 1 year.loan.amount
is set to 110 (principal + interest)rollLoan
function,newCollateral
is calculated fromcollateralFor(110,0.8)=137.5
. Since this is less than 200,newCollateral
is set to 0.newDebt
is calculated as the interest at the updated rate of 1000% pa. SonewDebt=1210
.Now Alice is forced to pay 1210 USD. Alice will never pay that loan, but the attacker can change the numbers until Alice is forced to pay almost 200 USD of the loan and force Alice to give up all her collateral.
Impact
Borrowers can have their interest rates changed on them.
Code Snippet
https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Cooler.sol#L192-L217
Tool used
Manual Review
Recommendation
Enforce the same loantovalue and interest for rolled-over loans.
Duplicate of #26
The text was updated successfully, but these errors were encountered: