In SoulboundProfileNFT.sol, tokenURI
calls ownerOf(tokenId)
, which reverts for burned tokens, making the metadata inaccessible.
When a token is burned:
The burnProfile
function deletes the profileToToken
and _profiles
mapping entries, however if the same user tries to mint again the require(profileToToken[msg.sender] == 0, "Profile already exists");
would pass because it is deleted. So they can mint a new profile
In the tokenURI
, OpenZeppelin's ownerOf
will revert with "ERC721: invalid token ID"
It will never return address(0)
Therefore, the check if (ownerOf(tokenId) == address(0))
can never be true
This means:
The function will always revert for burned tokens
Function execution will never reach the custom error ERC721Metadata__URI_QueryFor_NonExistentToken()
There is no way to distinguish between tokens that never existed and burned tokens
Lost historical metadata for burned tokens
Foundry
Implement OpenZeppelin's internal _ownerOf
function
Or replace ownerOf(tokenId)
with a custom check for token
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.