Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: medium
Invalid

`tokenURI` returns common rarity for non-existing NFTs

Summary

The tokenURI view returns the URI of common rarity NFTs when queried about non-existing items.

Vulnerability Details

Passing the token_id of a non-existing NFT to the tokenURI view returns the URI of a common rarity item, instead of failing and throwing.
The following test can be added to the test suite to assess the wrong behavior:

def test_tokenURI_itemDoesNotExist(raffle_boa):
COMMON_SNEK_URI = "ipfs://QmSQcYNrMGo5ZuGm1PqYtktvg1tWKGR7PJ9hQosKqMz2nD"
supply = raffle_boa.totalSupply()
value = raffle_boa.tokenURI(supply + 100)
assert value == COMMON_SNEK_URI

Impact

This behavior can lead to confusion and poor integration, as tokens that do not exist will be associated to common rarity, even if, when minted, they could actually be different.

Tools Used

Manual review, VSCode, Pytest

Recommendations

Querying the URI of non-existing NFTs should fail, avoiding the confusing return value of common rarity.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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