The _repay
and finalizeLiquidation
functions in the LendingPool
smart contract incorrectly transfer scaled amount of tokens, amountScaled
, instead of the amount of underlying, amountBurned
, returned from the DebtToken::burn
, which is meant to be the amount of DebtTokens burned in units of the underlying asset. This results in a mismatch between the debt reduction and the actual amount repaid, leading to financial inconsistencies in the protocol.
In the _repay
and finalizeLiquidation
function, the following line executes the transfer of reserve assets:
Issue:
The function transfers amountScaled
, which is derived from the internal debt token calculations.
The expected behavior is to transfer the actual repayment amount, amountBurned
, returned from the DebtToken::burn
, which is meant to be the reserveAsstet worth of the debtTokens burned, taking account of the accrued interest
amountScaled
does not match the expected underlying token amount due to scaling differences, the repayment would be inaccurate, leading to inconsistencies between debt accounting and actual asset movements.
Accounting Inconsistencies: The protocol's debt and collateral accounting may become unreliable, affecting liquidation calculations and reserve balances.
Potential Exploitation: If the issue allows users to manipulate repayment calculations, it could be used for unintended financial gains.
Manual Review
Ensure that the amount transferred matches the repayment amount with the interest accrued accounted for in units of the underlying assets. Consider the following changes:
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.