20,000 USDC
View results
Submission Details
Severity: medium
Valid

Borrower may increase loan interest rate unintentionally in a refinance

Summary

Borrower may increase loan interest rate unintentionally in a refinance.

Vulnerability Details

If there are lower interest rate pools in the market, a borrower would choose to refinance his loan to one of those pools to get a better offer. This can be done by leveraging refinance method.

refinances is passed to refinance method, after doing some checks, loan will be updated as per the new pool info.

// get the loan info
Loan memory loan = loans[loanId];
// validate the loan
if (msg.sender != loan.borrower) revert Unauthorized();
// get the pool info
Pool memory pool = pools[poolId];
// validate the new loan
if (pool.loanToken != loan.loanToken) revert TokenMismatch();
if (pool.collateralToken != loan.collateralToken)
revert TokenMismatch();
if (pool.poolBalance < debt) revert LoanTooLarge();
if (debt < pool.minLoanSize) revert LoanTooSmall();
uint256 loanRatio = (debt * 10 ** 18) / collateral;
if (loanRatio > pool.maxLoanRatio) revert RatioTooHigh();

It is worth noting that there is no check on if pool interest rate is lower than loan interest rate, imagine the following scenario:

  1. Alice sees a pool with lower interest rate than her loan, and submit a transaction to refinance to that pool;

  2. The pool lender Bob sees Alice's transaction in the mempool, and front-runs to increase the pool interest rate;

  3. Bob's transaction gets executed, pool interest rate is higer than before;

  4. Alice's transaction gets executed, loan is updated but loan interest rate is much higher.

Impact

More interest rate means more interest, borrower has to pay more tokens to repay.

Tools Used

Manual Review

Recommendations

When a loan is refinanced to a new pool, should check if the pool interest rate is higher than loan interest rate.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.