Core Contracts

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

closeLiquidation Function has no logic for users to repay loan

Summary

The closeLiquidation function should allow users to repay their debts and close the liquidation within the grace period but the current implementation doesn't have any logic that allows the user to repay the debts.

Vulnerability Details

function closeLiquidation() external nonReentrant whenNotPaused {
address userAddress = msg.sender;
if (!isUnderLiquidation[userAddress]) revert NotUnderLiquidation();
// update state
ReserveLibrary.updateReserveState(reserve, rateData);
if (block.timestamp > liquidationStartTime[userAddress] + liquidationGracePeriod) {
revert GracePeriodExpired();
}
UserData storage user = userData[userAddress];
uint256 userDebt = user.scaledDebtBalance.rayMul(reserve.usageIndex);
if (userDebt > DUST_THRESHOLD) revert DebtNotZero();
isUnderLiquidation[userAddress] = false;
liquidationStartTime[userAddress] = 0;
emit LiquidationClosed(userAddress);
}

The function is designed to close liquidation but:

  1. No transfer of CrvUSD from user to protocol

  2. No debt reduction logic

  3. No validation of repayment amount against debt

  4. No update to the user's debt balance

    Also, the closeLiquidation function incorrectly reverts when debt is above DUST_THRESHOLD, effectively preventing users from closing their liquidation even when they should be able to.

Impact

  • Users can't repay their debts whenever they are under liquidation.

Tools Used

Manual

Recommendations

Add logic for users to repay debts in closeLiquidation

Remove/modify the DUST_THRESHOLD check

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!