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

Borrowers can be frontrun with an interest rate change

Summary

Borrowers can be frontrun with an interest rate change, resulting in them paying the maximum interest rate.

Vulnerability Details

When a user (borrower) submits a transaction to borrow(), the pool owner (lender) can frontrun the borrower transaction with a call to updateInterestRate() and set the interest rate to MAX_INTEREST_RATE (1000%). The borrower's transaction subsequently gets executed, and since there is no way for the borrower to limit the interest rate they are willing to pay, he will get assigned the maximum interest rate.

Impact

Borrowers can be tricked into paying the maximum interest rate by frontrunning their calls to borrow(), resulting in a loss of funds.

Tools Used

None

Recommendations

Add a uint256 maxInterestRate parameter to the Borrow struct that should be verified withing borrow():

struct Borrow {
// ...
uint256 maxInterestRate;
}
// ...
error InterestRateTooLarge();
// ...
function borrow(Borrow[] calldata borrows) public {
// ...
if (pool.interestRate > borrows[i].maxInterestRate) revert InterestRateTooLarge();
}

Support

FAQs

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