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

Lender can front-run borrwer to increase interest rate

Summary

Lender can front-run borrwer to increase interest rate.

Vulnerability Details

When a borrower borrows a loan, the borrower can only specify poolId, debt and collateral , but cannot specify the interest rate:

struct Borrow {
/// @notice the pool ID to borrow from
bytes32 poolId;
/// @notice the amount to borrow
uint256 debt;
/// @notice the amount of collateral to put up
uint256 collateral;
}

This is problematic as lender can front-run and change the interest rate by calling setPool(…) function or updateInterestRate(…) function.

Impact

Borrower may get a bad loan with much higher interest rate than expected;

Tools Used

Manual Review

Recommendations

Borrower should be allowed to specify interest rate and auction length when borrowing, transaction should be revert if the pool's interest rate or aution length is not as expected.

struct Borrow {
/// @notice the pool ID to borrow from
bytes32 poolId;
/// @notice the amount to borrow
uint256 debt;
/// @notice the amount of collateral to put up
uint256 collateral;
+ uint256 interestRate;
}
function borrow(Borrow[] calldata borrows) public {
for (uint256 i = 0; i < borrows.length; i++) {
+ uint256 interestRate = borrows[i].debt;
+ if (pool.interestRate != interestRate) revert;
}
}

Support

FAQs

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

Give us feedback!