The tokenURI()
function in Snowman.sol
does not verify if a given tokenId
exists before returning metadata. This allows users to query metadata for non-existent tokens, which can cause confusion in user interfaces and lead to potential misinformation or spoofing in off-chain systems.
Currently, tokenURI()
returns a base64-encoded JSON string without checking if the tokenId
has been minted. As a result, valid-looking metadata can be returned for invalid token IDs.
Likelihood:
Reason 1 // Describe WHEN this will occur (avoid using "if" statements)
Reason 2
Impact:
Lack of error signaling for invalid token queries can cause confusion in user interfaces.
Potential for misinformation or spoofing in off-chain systems that rely on accurate metadata.
Inconsistent API behavior that breaks assumptions for users and developers.
Calling tokenURI(999999)
on a contract that has minted only 3 tokens will still return a valid Base64 JSON response, despite the token not existing.
Example test:
Add a check using _exists(tokenId)
at the start of tokenURI()
to ensure metadata is only returned for valid tokens. The function should revert with a clear error if the token does not exist.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.