The borrower may end up paying non-agreed interests in the refinance() function.
The refinance() function helps to the borrower to transfer his debt to another pool. The borrower sends the next data:
The problem is that the borrower can be frontrunned by a malicious lender changing the pool interest or a legitimate lender can change his pool interests while the refinance() function is executing making the borrower to take non-agreed interest by chance. Please see the next scenario:
Borrower calls the refinance() function because he wants to transfer his debt to a pool which has a 0.01% interest rate.
Legitimate lender just change his pool interests to 0.3% using the updateInterestRate() function. This function is executed before the step1 because the lender pay more gas.
The refinance() transaction is now executed but the pool interest has increased, now the borrower end up with a different pool interest (0.3%).
The borrower may end up paying more pool interests via a malicious lender frontrun or lender changing interest rate by chance while the borrower refinance is executing.
Manual review
Add a validation in the refinance() function which helps the borrower to specify the interest he is allowed to pay:
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.