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

Possible DOS by borrowers in `setPool()`

Summary

Lenders couldn't update already existing pools by borrowers who want to keep the original settings.

Vulnerability Details

Lenders can update their pool settings using setPool().

function setPool(Pool calldata p) public returns (bytes32 poolId) {
// validate the pool
if (
p.lender != msg.sender ||
p.minLoanSize == 0 ||
p.maxLoanRatio == 0 ||
p.auctionLength == 0 ||
p.auctionLength > MAX_AUCTION_LENGTH ||
p.interestRate > MAX_INTEREST_RATE
) revert PoolConfig();
// check if they already have a pool balance
poolId = getPoolId(p.lender, p.loanToken, p.collateralToken);
// you can't change the outstanding loans
if (p.outstandingLoans != pools[poolId].outstandingLoans) //@audit possible DOS by borrower
revert PoolConfig();
}

It checks if the new pool contains the same outstandingLoans as the old pool but it might revert due to borrowers.

  1. A lender has a pool and there are several borrowers already.

  2. After noticing the pool's interest ratio is too low, he's going to increase the rate using setPool().

  3. But borrowers don't want to pay higher interest and they front runs borrow() or repay() to change outstandingLoans.

  4. Then setPool() will revert here because outstandingLoans was changed.

Impact

Lenders couldn't update their pool settings properly.

Tools Used

Manual Review

Recommendations

I think we don't need to validate outstandingLoans in setPool(). Instead, we can set the old pool's outstandingLoans for the new pool here.

p.outstandingLoans = pools[poolId].outstandingLoans;
pools[poolId] = p;

Support

FAQs

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