The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Valid

In `SmartVaultManagerV5.sol`, `tokenURI()` does not check if the `_tokenId` is valid NFT and violates EIP-721 specification

Summary

In SmartVaultManagerV5.sol, tokenURI() does not check if the _tokenId is valid NFT and violates EIP-721 specification

Vulnerability Details

In SmartVaultManagerV5.sol, tokenURI() is used to get the tokenURI of input tokenId. The issue is that, it does not check whether the passed tokenId as input argument exists or not. This violates the ERC721-Metadata part standard.

SmartVaultManagerV5.sol inherits the ERC721Upgradeable in contract.

contract SmartVaultManagerV5 is ISmartVaultManager, ISmartVaultManagerV2, Initializable, ERC721Upgradeable, OwnableUpgradeable {

As seen below, it violates the EIP-721 standard tokenURI implementation,

function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
ISmartVault.Status memory vaultStatus = ISmartVault(smartVaultIndex.getVaultAddress(_tokenId)).status();
return INFTMetadataGenerator(nftMetadataGenerator).generateNFTMetadata(_tokenId, vaultStatus);
}

EIP-721 specfically states,

/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
/// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC @audit // This revert is missing in current tokenURI function
/// 3986. The URI may point to a JSON file that conforms to the "ERC721
/// Metadata JSON Schema".
function tokenURI(uint256 _tokenId) external view returns (string);

The issue is identified as Medium severity since the functionality breaks the EIP721 specification and there is no funds are at risk.

Impact

tokenURI() function implementation deviates from the ERC-721 standard. According to the standard, the tokenURI method must revert if a non-existent tokenId is passed. In SmartVaultManagerV5 contract, this requirement was overlooked, leading to a violation of the EIP-721 specification.

Tools Used

Manual review

Recommendations

Throw an error if the _tokenId is not a valid NFT.

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

informational/invalid

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

eip-compliance

Support

FAQs

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