Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Invalid

Underflow during finalizeLiquidation and repay.

Summary

There could be underflow in the function finalizeLiquidation , and _repay function which could lead to failure of transactions.

Vulnerability Details

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

amountScaled = (1000 * 1.13)/ 1.13 = 1000,
user.scaledDebtBalance = user.scaledDebtBalance - amountBurned(amountScaled ) = 917.43 - 1000 --> @audit Underflow

Impact

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.

Tools Used

Manual Review

Recommendations

Add some more checks before subtracting.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!