Core Contracts

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

incorrect undercollateralization check during borrowing and withdrawal of NFT

Summary

incorrect collateralization check during borrowing and withdrawal of NFTs which is essentially checking if collateral is enough to cover 80% of the debt.

Vulnerability Details

during withdrawal of NFT we're ensuring collateral value can cover 80% of the total user debt which is wrong as we're essentially allowing undercolateralization we're also doing this during borrowing, this will cause bad debt and loss for the protocol.

here's the check during NFT withdrawal:

if (
collateralValue - nftValue <
userDebt.percentMul(liquidationThreshold)
) {
revert WithdrawalWouldLeaveUserUnderCollateralized();
}

as well as during borrowing :

// Ensure the user has enough collateral to cover the new debt
if (collateralValue < userTotalDebt.percentMul(liquidationThreshold)) {
revert NotEnoughCollateralToBorrow();
}

this is essentially saying a debt of CRVUSD 1000 can be covered by CRVUSD 800 worth of NFT(80% of debt).

if the claim is that users are allowed to be undercollateralized because their collateral is stable and goes up in value then the healthfactor calculation will always be lower than the liquidation threshold as it's calculated as collteralValue/userDebt

Impact

  • this will result in bad debt for the protocol.

  • anyone can initiate liquidation for such users

Tools Used

Recommendations

  • use the healthfactor calculation for all undercollateralization check :

uint256 collateralThreshold = collateralValue.percentMul(
liquidationThreshold
);
return (collateralThreshold * 1e18) / userDebt;
Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months 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.