Core Contracts

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

Incorrect Health Factor Check in `initiateLiquidation` Function

Summary

The initiateLiquidation function incorrectly checks the user's health factor against the liquidation threshold. The current implementation reverts if the health factor is greater than or equal to the threshold, whereas it should revert only if the health factor is above the threshold, ensuring liquidation occurs only when necessary.

Vulnerability Details

In the initiateLiquidation function, the following line contains a logic error:

if (healthFactor >= healthFactorLiquidationThreshold) revert HealthFactorTooLow();

The intention behind this condition is to prevent liquidation if the user’s health factor is above the liquidation threshold, meaning their position is safe. However, the revert message HealthFactorTooLow suggests the opposite, implying that the user's health factor is too low for liquidation to proceed.

Logically, liquidation should only occur when the health factor is below the threshold. The correct condition should be:

if (healthFactor < healthFactorLiquidationThreshold) revert HealthFactorTooLow();

With the current flawed implementation, liquidation may be incorrectly prevented, and healthy accounts might be liquidated while unhealthy ones remain unliquidated.

Impact

  • Prevents liquidation of accounts that should be liquidated, leading to risk accumulation in the protocol.

  • Allows liquidation of accounts that should not be liquidated, causing unnecessary losses to users.

  • Can lead to unintended protocol insolvency due to unliquidated bad debt.

Tools Used

Manual Review

Recommendations

Modify the conditional check to properly reflect the intended liquidation logic:

if (healthFactor < healthFactorLiquidationThreshold) revert HealthFactorTooLow();

Additionally, consider adding unit tests to validate liquidation logic and ensure that users are only liquidated when their health factor is below the threshold.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

LendingPool::borrow as well as withdrawNFT() reverses collateralization check, comparing collateral < debt*0.8 instead of collateral*0.8 > debt, allowing 125% borrowing vs intended 80%

Support

FAQs

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