Core Contracts

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

Incorrect debt amount calculation during liquidation in the stability pool

Summary

The debt amount is calculated as:

function liquidateBorrower(
address userAddress
) external onlyManagerOrOwner nonReentrant whenNotPaused {
// Get the user's debt from the LendingPool.
uint256 userDebt = lendingPool.getUserDebt(userAddress);
//@audit use userDebt
uint256 scaledUserDebt = WadRayMath.rayMul(
userDebt,
lendingPool.getNormalizedDebt()
);

However, the user debt already comes updated from the lending pool according to the last stored index. In order to properly cover the user debt, this function should update the usage index for the accrued interest since the last update and the second multiplication should not be performed.

Vulnerability Details

Impact

Tools Used

Manual review.

Recommendations

Update the index before calculating the debt and avoid duplicated multiplication.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

StabilityPool: liquidateBorrower should call lendingPool.updateState earlier, to ensure the updated usageIndex is used in calculating the scaledUserDebt

StabilityPool::liquidateBorrower double-scales debt by multiplying already-scaled userDebt with usage index again, causing liquidations to fail

Support

FAQs

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