tokenURI() builds the token's JSON metadata with abi.encodePacked, but embeds the rarity name ("common", "rare", or "legendary") directly as an unquoted identifier instead of a properly quoted JSON string.
The resulting attributes field looks like "value": common instead of the syntactically valid "value": "common". Every single token minted by the contract has this same malformed metadata - it is deterministic, not a rare edge case.
Wallets, marketplaces, and indexers that parse this JSON with a standard JSON parser will fail to parse the attributes array (or the whole document, depending on the parser's strictness), degrading or breaking how the NFT displays.
Likelihood:
Reason 1 // This triggers on every single mint with no special conditions - it is a deterministic output-formatting bug, not something that depends on an attacker or unusual input.
Impact:
Impact 1 // The NFT's on-chain metadata is not valid JSON, which can cause wallets, marketplaces, and indexers to fail to display the rarity trait correctly (or reject the metadata document entirely), directly undermining the "collectible NFT" value proposition of the raffle prize - though it does not put funds at risk.
Ran with forge test --match-path "test/PoC_9.t.sol" -vv: [PASS] test_TokenURI_ProducesInvalidJSON_UnquotedRarityValue(). The test decodes the actual on-chain tokenURI(0) output and inspects the raw bytes the contract concatenates for the attributes field. Logs confirm the byte immediately following "value": is 0x63 (the ASCII character c, the start of common), not 0x22 (a double quote) - i.e. the value is emitted unquoted, exactly as claimed.
Wrap rareName in escaped double quotes so the emitted JSON is syntactically valid: "value":"common" instead of "value": common.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.