Core Contracts

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

Duplicate NFT

Summary

More than one RAACNFTwith the same combination of name, symbol, tokenid can exist in the system.

Vulnerability Details

In RAACNFT:mint when creating the asset here:

constructor(address _token, address _housePrices, address initialOwner) ERC721("RAAC NFT", "RAACNFT") Ownable(initialOwner) {
if (_token == address(0) || _housePrices == address(0) || initialOwner == address(0)) revert RAACNFT__InvalidAddress();
token = IERC20(_token);
raac_hp = IRAACHousePrices(_housePrices);
}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
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 erc20 from user to contract - requires pre-approval from user
token.safeTransferFrom(msg.sender, address(this), _amount);
// mint tokenId to user
_safeMint(msg.sender, _tokenId);
// If user approved more than necessary, refund the difference
if (_amount > price) {
uint256 refundAmount = _amount - price;
token.safeTransfer(msg.sender, refundAmount);
}
emit NFTMinted(msg.sender, _tokenId, price);
}

It is never checked whether another asset with the same name, symbol and tokenid exist. This can lead to two or more assets being identical (but with different prices for example). Additionally according to NFT docs:

https://eips.ethereum.org/EIPS/eip-721
The tokenId must be unique for each NFT and some implementations may use a sequential identifier or another scheme.

Impact

Tools Used

Manual Review

Recommendations

Add a check whether the given combination of name, symbol and tokenid already exists for another asset.

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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