Core Contracts

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

Inadequate Debt Repayment Enforcement in Liquidation Closure

Vulnerability Details

The closeLiquidation function in the LendingPool contract currently allows a user to close their liquidation status without enforcing any repayment of their outstanding debt. The relevant code snippet is as follows:

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);
}

Issues Identified

  • No Debt Repayment Requirement: The function allows users to close their liquidation status without any requirement to repay their outstanding debt.

  • Potential Exploitation: Users could exploit this functionality to avoid repaying their debts, leading to financial instability for the protocol. (until the userDebt > DUST_THRESHOLD)

  • Protocol Integrity at Risk: The lack of enforcement for debt repayment undermines the integrity of the lending protocol, potentially leading to systemic risks.

Impact

The current implementation of the closeLiquidation function allows users to close their liquidation status without repaying their debts, which can lead to:

  • Financial losses for the protocol and its users.

  • Erosion of trust in the lending system.

  • Potential exploitation by users to escape their debt obligations.

Recommendations

1.Implement a Debt Repayment Requirement : Modify the closeLiquidation function to require users to repay their debts before they can close their liquidation status. This can be done by adding a parameter for the repayment amount and validating it against the user's outstanding debt.

Example Code Update

Here’s a suggested modification to the closeLiquidation function:

function closeLiquidation(uint256 amountToRepay) external nonReentrant whenNotPaused {
address userAddress = msg.sender;
if (!isUnderLiquidation[userAddress]) revert NotUnderLiquidation();
// Ensure the user is repaying their debt
uint256 userDebt = userData[userAddress].scaledDebtBalance.rayMul(reserve.usageIndex);
if (amountToRepay == 0 || amountToRepay > userDebt) revert InvalidRepaymentAmount();
// Call the repay function to handle the repayment logic
+ repayDebt(userAddress, amountToRepay);
// Reset liquidation status
isUnderLiquidation[userAddress] = false;
liquidationStartTime[userAddress] = 0;
emit LiquidationClosed(userAddress);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
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!