There could be underflow in the function finalizeLiquidation , and _repay function which could lead to failure of transactions.
If we look at the function LendingPool::_repay, there could be a underflow during the calculation of user.scaledDebtBalance.
Let's say user borrowed 1000 at usageIndex = 1.09, by calling the function Lending::borrow,
So, user.scaledDebtBalance = 1000/1.09 = 917.43
Now user calls LendingPool::_repay, for , 1000 tokens, at usageIndex = 1.13
User will not be able to repay, and the same applies to the liquidation function. Hence, the function will not be called, leading to funds being locked and liquidations failing, which can result in bad debt accumulation and protocol insolvency over time.
Manual Review
Add some more checks before subtracting.
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.