The NFTFactory contract’s createEstate
function passes a user-supplied description
string directly to _setTokenURI
without any validation. This omission allows an attacker to set invalid, offensive, or fraudulent metadata as the token URI. Such manipulation could mislead users about the nature or legitimacy of the NFT estates, undermining trust in the system and potentially devaluing genuine assets.
Affected Function:
Issue:
The contract accepts any string as a token URI without validating its format or content. There are no checks to ensure the description is a well-formed URI or that it meets any predetermined quality criteria.
Potential Abuse:
An attacker or a malicious administrator (with access as the inheritanceManager
) can set the token URI to an empty string, non-URI text, or even offensive content.
Users relying on NFT metadata for estate information could be misled, affecting their decision-making and eroding trust in the protocol.
The vulnerability stems from the absence of input validation or sanitization on the description
parameter passed to _setTokenURI
. By not verifying that the input conforms to a valid URI format (or at minimum is not empty), the contract permits any arbitrary string to be used as metadata.
The contract may store malicious or malformed metadata without any safeguards.
Foundry:
To mitigate this issue, it is recommended to implement input validation for the metadata string. Possible measures include:
Non-Empty Check:
Require that the metadata string is not empty:
Consider incorporating a library or regex check to validate that the input conforms to a proper URI format.
Emit events when new estates are created so that any anomalous metadata entries can be quickly identified and reviewed.
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.