mintProfile
in SoulboundProfileNFT ContractThe mintProfile
function calls _safeMint(msg.sender, tokenId)
, which in turn triggers an external call to onERC721Received
. if the recipient is a malicious smart contract, it can execute a reentrant call before _profiles[tokenId]
and profileToToken[msg.sender]
are updated.
An attacker can repeatedly reenter mintProfile
, allowing them to mint multiple NFTs before the mapping profileToToken[msg.sender]
is updated, violating the assumption that each address can have only one profile.
A malicious contract could look like this:
Use the Checks-Effects-Interactions pattern by updating state variables before calling _safeMint
:
Likelihood: High, anyone can do it. Impact: Low, several profile will be minted, which is not allowed by the protocol, but only the last one will be stored in profileToToken and won't affect `likeUser` or `matchRewards`.
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.