The tokenURI
function in SoulboundProfileNFT
is vulnerable to JSON injection through unvalidated user inputs in the profile name and image URI fields, allowing malicious users to manipulate NFT metadata.
In SoulboundProfileNFT.sol
, the tokenURI
function:
Directly concatenates user inputs into a JSON string
Does not validate or escape special characters
Allows manipulation of the JSON structure
Metadata Manipulation: Attackers can inject arbitrary JSON fields
NFT Display Issues: Marketplaces and interfaces could display manipulated data
Potential XSS: If metadata is displayed in web interfaces, XSS attacks might be possible
Severity: MEDIUM - While not directly affecting contract functionality, this can impact NFT display and user trust
Manual code review
Foundry for testing
PoC demonstrating JSON injection
Implement input validation and escaping:
Add input length limits:
Use a JSON library:
Consider using a tested and audited JSON library for safer JSON string construction.
Implement strict input validation:
Scamming/phishing is not the protocol problem, that's a user mistake. NFT are unique, even if someone does a copy of your profile (which is also possible in web2), I consider it informational. Injection is a problem for the web2 part of the protocol, not a bug here. For the age, it depends on the countries law and future medicine. Anyways, that's more an ethical/political problem, not a bug.
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.