20,000 USDC
View results
Submission Details
Severity: medium

Loan might be bought with the loan debt being smaller the minLoanSize or loan ratio being larger than maxLoanRatio

Summary

Loan might be bought with the loan debt being smaller the minLoanSize or loan ratio being larger than maxLoanRatio.

Vulnerability Details

Pool lender calls buyLoan(…) function to buy a auctioned loan.

However, this function dose not check if the loan's totalDebt is smaller than pool's minLoanSize or if the loan's ratio is larger than pool's maxLoanRatio.

Impact

Buying a loan with debt being smaller than minLoanSize and ratio being larger than maxLoanRatio breaks the invariant that the loan debt should be larger than or equal to pool's minLoanSize and loan ratio should be smaller than or equal to pool's maxLoanRatio, may leading to various issues and potentially losses for the uses.

Tools Used

Manual Review

Recommendations

Check if the loan debt is smaller the minLoanSize or loan ratio is larger than maxLoanRatio when buys a loan.

function buyLoan(uint256 loanId, bytes32 poolId) public {
+ if (debt < pool.minLoanSize) revert LoanTooSmall();
+ uint256 loanRatio = (debt * 10 ** 18) / collateral;
+ if (loanRatio > pool.maxLoanRatio) revert RatioTooHigh();

Support

FAQs

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

Give us feedback!