Core Contracts

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

Missing slippage protection initiateLiquidation(), in LendingPool.sol

Summary

The function initiateLiquidation lacks slippage protection, exposing it to potential exploitation due to rapid fluctuations in the health factor.

Vulnerability Details

1. Lack of Slippage Protection

  • The function does not have safeguards against sudden changes in the health factor.

  • Attackers could manipulate asset prices or liquidity conditions to artificially trigger liquidation under unfair circumstances.

  • This can lead to unintended or premature liquidations at non-optimal prices.

2. NatSpec Mismatch

  • The NatSpec states this: "if a user's health factor is below threshold", but it does not clarify the behavior when the health factor is above the threshold.

  • The actual check:

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

    This suggests that liquidation is only allowed if the health factor is below the threshold, which is not reflected in the documentation.

function initiateLiquidation(address userAddress) external nonReentrant whenNotPaused {
if (isUnderLiquidation[userAddress]) revert UserAlreadyUnderLiquidation();
// update state
ReserveLibrary.updateReserveState(reserve, rateData);
UserData storage user = userData[userAddress];
uint256 healthFactor = calculateHealthFactor(userAddress);
if (healthFactor >= healthFactorLiquidationThreshold) revert HealthFactorTooLow();
isUnderLiquidation[userAddress] = true;
liquidationStartTime[userAddress] = block.timestamp;
emit LiquidationInitiated(msg.sender, userAddress);
}

Impact

Unfair Liquidations: Attackers can manipulate market conditions to trigger liquidations at non-optimal prices.

  • NatSpec Confusion: Developers and auditors may misunderstand the function's intended behavior, leading to improper integration or missed security concerns.

  • Pending Liquidation State: Liquidations may remain open indefinitely, potentially causing inefficiencies in fund recovery and protocol operations.

Tools Used

Manual review

Recommendations

Introduce Slippage Protection:

  • Implement min and max thresholds to prevent execution in cases where the health factor fluctuates too rapidly.

  • Consider integrating oracle-based pricing verification to ensure fair liquidation conditions.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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