A flawed check allows the user to put the pool they are refinancing into insolvency by not making the new debt, which is equal to the old debt + interest and fees
pay anything additional.
Lender.sol
's refinance()
has a flawed check, which is supposed to transfer tokens from the user and to the user based on whether the loan debt has been lowered or raised. Instead of checking loan.debt > debt
it checks debtToPay > debt
.
This check is fundamentally flawed as it will allow someone to refinance their loan to an amount that is debt == debtToPay
, which will not make the user pay anything additional to the protocol for the higher debt.
Direct loss of funds that is easily exploitable by any borrower.
Manual Review
Consider changing the if statement's conditions to the following:
Also, consider making the borrower pay for their accrued interest within this function.
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.