Core Contracts

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

Users Funds Locked In Contract Forever - RAACNFT.sol

Summary

A critical vulnerability has been identified in RAACNFT.sol, which allows users to purchase tokenized representations of real estate in the form of NFTs. However, the contract lacks functions to withdraw or transfer out funds after deposits, leading to a scenario where funds remain permanently locked in the contract.

Vulnerability Details

In RAACNFT.sol (source code), users purchase NFTs by transferring ERC-20 tokens to the contract using the safeTransferFrom function. The contract, however, does not include any mechanism to transfer these tokens out, effectively making it a black hole for funds.

Code Analysis

The following function in RAACNFT.sol demonstrates the issue:

function mint(uint256 _tokenId, uint256 _amount) public override {
uint256 price = raac_hp.tokenToHousePrice(_tokenId);
if (price == 0) { revert RAACNFT__HousePrice(); }
if (price > _amount) { revert RAACNFT__InsufficientFundsMint(); }
// Transfer ERC-20 tokens from user to contract (requires pre-approval from user)
token.safeTransferFrom(msg.sender, address(this), _amount);
// Mint NFT to user
_safeMint(msg.sender, _tokenId);
}

Issue Breakdown:

  1. Locked Funds: The contract receives ERC-20 tokens via safeTransferFrom, but there is no function to withdraw, transfer, or approve the movement of these tokens.

  2. Protocol Disruption: Since high-value property transactions rely on ERC-20 token movement, funds being permanently locked in the contract hinders the intended functionality.

  3. Lack of Transfer Logic: None of the inherited contracts provide a mechanism to recover funds, effectively making this contract act as a burn address.

Impact

This is a high-impact vulnerability as it prevents funds from being utilized within the protocol, leading to irreversible financial losses for users and rendering the contract ineffective in facilitating property transactions.

Tools Used

  • Manual Review

Recommendations

  1. Implement a Withdrawal Mechanism: Introduce a function to allow authorized parties to transfer ERC-20 tokens out of the contract.

  2. Approval Functionality: Enable the contract to approve token spending by external addresses if needed.

Updates

Lead Judging Commences

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

RAACNFT collects payment for NFT minting but lacks withdrawal functionality, permanently locking all tokens in the contract

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

RAACNFT collects payment for NFT minting but lacks withdrawal functionality, permanently locking all tokens in the contract

Support

FAQs

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