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

Incorrect loans update

Summary

In Lender.sol,the buyLoan function does not correctly update Loans array.

function buyLoan(uint256 loanId, bytes32 poolId) public {
//..
// update the loan with the new info
loans[loanId].lender = msg.sender; //@audit pool.lender ?
loans[loanId].interestRate = pools[poolId].interestRate;
loans[loanId].startTimestamp = block.timestamp;
loans[loanId].auctionStartTimestamp = type(uint256).max;
loans[loanId].debt = totalDebt;
//..
}

Vulnerability Details

The loans[loanId].lender is updated with msg.sender instead of pool.lender

Impact

The new lender will earn free interest and be able to withdraw from the pool.

Tools Used

Manual review

Recommendations

use

loans[loanId].lender = pool.lender

Support

FAQs

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

Give us feedback!