The borrower repayment can be blocked by a malicious actor who doesn't have a created pool causing the pool that acquired the debt to be unable to be paid and the borrower to be unable to get his collateral.
The buyLoan() function helps "buy" a loan and transfer it to another pool. So the first pool will be paid plus interests and the new pool will acquire the debt.
The problem is that a malicious actor, who doesn't have any created pool, can call the buyLoan() function and transfer the debt to another whatever pool. That will cause that the loan repayment will be reverted by an arithmetic error.
I created a test where the malicious actor make the borrower repayment to be reverted by an arithmetic error. Test steps:
Lender1 creates the pool with initial 1000 token balance. Borrower borrows 100 token debt.
Lender2 creates his pool.
Lender1 kicks off the auction.
The malicious actor (address(1337)) call the buyLoan() function using Lender2's pool.
The Lender1 pool has the loaned amount + interests.
Lender2 pool has the debt. 1000 initial pool balance - 100 debt tokens - borrow interests
The loan lender is assigned to the attacker non-existent pool which means that
the repay() function will be reverted by arithmeticError.
The borrower repay will not be possible, causing the borrower collateral lost. Additionally the pool who acquired the debt will lost token balance because nobody will pay that debt.
Manual review
The pool.lender should be assigned to the loans.lender instead the msg.sender:
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.