Core Contracts

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

Users can manipulate the `withdrawNFT` function and take out extra money out of the protocol

Summary

The withdrawNFT() function contains a flawed collateral validation check that enables users to withdraw NFTs that should be locked as collateral, leading to major profit to a user

Vulnerability Details

The withdrawNFT function's collateral check is fundamentally flawed in its mathematical logic:
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L302-L304

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

The check attempts to verify if the remaining collateral after withdrawal would be sufficient, but the mathematical implementation allows users to withdraw NFTs even when their position would become severely undercollateralized\

poc -
assume -
Attacker deposits 2 NFTs worth 100,000 crvUSD each

Total collateral value = 200,000 crvUSD
now

Attacker First borrow 120,000 crvUSD (within normal limits)

Then attempt to withdraw one NFT (100,000 crvUSD value)
due to this now -

collateralValue - nftValue < userDebt.percentMul(liquidationThreshold)
200,000 - 100,000 < 120,000 * 0.8
100,000 < 96,000
Check passes when it should fail

the attacker now has
120,000 crvUSD in borrowed funds

One NFT worth 100,000 crvUSD

Net instant profit: 20,000 crvUSD

Impact
Allows profit without market risk
Can be repeated with multiple NFTs
Generates immediate bad debt
Enables direct value extraction from the protocol

Tools Used
Manual Audit

Recommendations
Correct the withdrawal validation logic:

Updates

Lead Judging Commences

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