Core Contracts

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

Inability to liquidate a big position will cost the lending contract to become insolvent (enable partial liquidation)

Summary

When a whale borrows in the lending pool they should be liquidatable when their loan grows over their collateral but the inability of the stability pool to liquidate such a position will leave the lending pool insolvent. Users with a lot of funds, and large token positions can not be liquidated as the max of the liquidation ability is dependent on the balance of the stability pool which may not be enough.

Vulnerability Details

Inability to liquidate a large position

* @notice Liquidates a borrower's position.
* @dev This function can only be called by a manager or the owner when the contract is not paused.
* @param userAddress The address of the borrower to liquidate.
* @custom:throws InvalidAmount If the user's debt is zero.
@audit>>> * @custom:throws InsufficientBalance If the Stability Pool doesn't have enough crvUSD to cover the debt.
* @custom:throws ApprovalFailed If the approval of crvUSD transfer to LendingPool fails.
* @custom:emits BorrowerLiquidated when the liquidation is successful.
*/
function liquidateBorrower(address userAddress) external onlyManagerOrOwner nonReentrant whenNotPaused {
// Get the user's debt from the LendingPool.
uint256 userDebt = lendingPool.getUserDebt(userAddress);
uint256 scaledUserDebt = WadRayMath.rayMul(userDebt, lendingPool.getNormalizedDebt());
if (userDebt == 0) revert InvalidAmount();
uint256 crvUSDBalance = crvUSDToken.balanceOf(address(this));
@audit>>> if (crvUSDBalance < scaledUserDebt) revert InsufficientBalance(); // liquidation can fail why not try partial liquidation or implement flashloan liquidation cause a whale can never be liquidated
// Approve the LendingPool to transfer the debt amount
bool approveSuccess = crvUSDToken.approve(address(lendingPool), scaledUserDebt);
if (!approveSuccess) revert ApprovalFailed();
// Call finalizeLiquidation on LendingPool
lendingPool.finalizeLiquidation(userAddress);
emit BorrowerLiquidated(userAddress, scaledUserDebt);
}

The inability to liquidate a large debt position will create a big solvency problem in the contract.

Partial liquidation can help the protocol liquidate a large position in bits ensuring that insolvency is not an issue, the present implementation poses a big risk to the lending pool.

Impact

Inability to liquidate huge debt positions.

Tools Used

Manual review

Recommendations

Implement a partial liquidation mechanism to at least chop done the debt and maintain solvency in the lending pool.

Updates

Lead Judging Commences

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

StabilityPool has no ability to liquidate large positions due to all-or-nothing design - partial liquidation not supported, risking protocol insolvency

Support

FAQs

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