Core Contracts

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

Healthy Users Liquidated

Summary

In the LendingPool.sol contract the finalizeLiquidation function does not check if the user is still "unhealthy" after the grace period has expired, which can lead to unfair liquidations.

Vulnerability Details

The vulnerability arises from the lack of a health factor check in the finalizeLiquidation function after the grace period has expired. If a user's health factor improves due to factors such as a price increase or partial repayment, they should not be subject to liquidation. However, the current implementation allows the stability pool to finalize the liquidation without re-evaluating the user's health factor.

Impact

Users who manage to improve their health factor during the grace period can still be unfairly liquidated because the stability pool does not re-check their health status before finalizing the liquidation. This can lead to unnecessary loss of collateral for users who have taken steps to rectify their position, undermining user trust and the fairness of the protocol.

Tools Used

Manual Review

Recommendations

To mitigate this vulnerability, update the finalizeLiquidation function to include a check for the user's health factor before finalizing the liquidation. This ensures that only users who are still "unhealthy" after the grace period are subject to liquidation. The updated function should look like this:

function finalizeLiquidation(address userAddress) external nonReentrant onlyStabilityPool {
uint256 healthFactor = calculateHealthFactor(userAddress);
if (healthFactor >= healthFactorLiquidationThreshold) {
revert HealthFactorTooHigh();
}
...
}

This change will prevent unfair liquidations and ensure that users who improve their health factor are not penalized.

Updates

Lead Judging Commences

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

LendingPool::finalizeLiquidation() never checks if debt is still unhealthy

Support

FAQs

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

Give us feedback!