Lender can change the interest rate of past loans easily. This is not expected behaviour because the function updateInterestRate does not affect the interest rate of past loans.
However, a lender can easily update the interest rate of a past loan by doing this:
We're starting with a lender and a borrower that got a loan from the lender's pool.
Lender changes the interest rate of the pool via updateInterestRate
Auctions the loan
Buys the loan himself with the higher rate
Now the borrower is in a loan with much higher interest rate than expected.
Note that this can be done extremely quickly if the lender frontruns the borrower before getting the loan and changes the auction length of the pool beforehand as well. Or simply by having a pool with lower auction length.
He could set it up for as low as a couple of seconds enabling him to auction and re-buy the loan in just seconds.
Add this test to Lender.t.sol:
Borrower is suddenly in a loan with much higher interest rate than expected. The lender then can change the interest rate back to a very low number baiting more borrowers in.
Manual review, Foundry
Don't allow the lender to buy loans from himself as there's not really a valid reason to do so. Also, you can set up a more meaningful MAX_INTEREST_RATE as currently it is too high.
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.