imsrybr0 - Interest rate is updated before updating the debt when repaying debt #413
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A High severity issue.
Reward
A payout will be made for this issue
imsrybr0
High
Interest rate is updated before updating the debt when repaying debt
Summary
Interest rate is updated before updating the debt when repaying debt in
BorrowLogic@executeRepay
leading to an incorrect total debt being used when calculating the new interest rates and causing suppliers to keep accruing interest based on the previous debt and even if there are no ongoing borrows anymore.Root Cause
BorrowLogic
ReserveLogic
Interest rate is updated before repaying the debt and updating the cached
nextDebtShares
which is then used in the interest rate calculation causing it to return a wrong interest rate as it behaves like liquidity was just supplied by the borrower without a change in debt.Internal pre-conditions
N/A
External pre-conditions
N/A
Attack Path
tokenB
tokenA
tokenB
causing the utilization goes up and interest rate is updatedtokenB
but the interest rate is not updated correctlyImpact
Bob keeps accruing interest rate based on the previous debt and even if there are no ongoing borrows and can withdraw it at the expense of other suppliers.
PoC
Mitigation
The text was updated successfully, but these errors were encountered: