Malicious borrower can restart the loan's auction using the refinance() function causing the lender to be unable to receive neither the auction payment or the collateral.
The refinance() function helps to the borrower to transfer his loan to another pool. The borrower needs to specify the new pool who will take the loan.
The problem is that the new pool whoever takes the loan can be the same pool which has the loan, so a malicious borrower can use the same pool the loan has causing that the auction to be restarted.
I created a test where the auction is restarted (auctionStartTime = type(uint256).max) by a malicious borrower. Test steps:
Lender1 creates the pool with initial 1000 token balance. Borrower borrows 100 token debt.
Lender1 kicks off the auction.
The borrower maliciously refinance the loan using the same old poolID from the Lender1.
The malicious borrower doesn't need to deposit any token amount.
The Lender1 auction is restarted. The malicious borrower can repeat the process
causing the lender to be unable to get the collateral.
The lender who started an auction will not receive neither the auction payment or the loan collateral. The malicious borrower can make the attack at zero cost because as the above test shows, the loan debt is still the same (step 4).
Manual review
Add a validation in the refinance() function that the new poolId, who will take the loan, is not the same as the one that has the loan.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.