The tokenURI()
function is expected to generate unique and collision-free metadata URIs for each NFT. However, the use of abi.encodePacked()
when building jsonData
can lead to hash collisions or unexpected concatenation results due to Solidity's packed encoding behavior with dynamic types.
This can result in incorrect token metadata being returned for NFTs, especially as the number of tokens grows.
Likelihood:
This can occur when the protocol generates many NFTs and the concatenated fields overlap in byte structure due to dynamic type packing.
Since dynamic fields like pincode
, isoCode
, and weatherString
are used, this issue could surface as the dataset grows.
Impact:
Two NFTs may produce the same tokenURI
, showing incorrect metadata.
A user might view metadata belonging to another user, breaking the uniqueness guarantee of NFTs.
Add the following code on the end of WeatherNftForkTest.t.sol::test_weatherNFT_Workflow()
:
Alternatively, use a proper JSON struct and a string library if you need to manually construct JSON.
This is informational. The `user` and the `image` are always different for each `tokenURI`.
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.