State variables are updated with the wrong values in `finalizeLiquidation` which will lead to protocol becoming insolvent
The LendingPool allows the stability pool to finalize a liquidation after the grace period has passed. The grace period is the period when a borrower can cover their possition.
As we can see in `finalizeLiquidation`
The user's nft position is removed.
Reserve debt tokens are burned.
Reserve assets are transferred from the stability pool
User debt balance and total usege are updated
All seems good, but actually the amountScaled and amountBurned values are reversed when returned from IDebtToken::burn()
As can be seen in DebtToken::burn the return values are:
The first return value is actually the burned amount but in the lending pool it is set as the scaled amount, when the 3rd value is the scaled amount, but is set as the burned amount.
These values are used to update the user scaled balance, interest rates and liquidity.
Updating the interest rates with the wrong value will lead to unexpected consequences. One of which is protocol insolvency since the rate will be lower and this would let users borrow for less.
High, Insolvency
Manual Review
This is confusing naming but functionally correct. The variable names are misleading, but that's not a vulnerability.
This is confusing naming but functionally correct. The variable names are misleading, but that's not a vulnerability.
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.