Description: The mintProfile function in the SoulboundProfileNFT
contract calls _safeMint(msg.sender, tokenId)
before updating critical state variables such as _profiles[tokenId]
and profileToToken[msg.sender]
. Since _safeMint
invokes IERC721Receiver(to).onERC721Received
, if msg.sender
is a contract, it can execute arbitrary code before the function completes. This allows potential reentrant calls that could manipulate state inconsistencies or execute unintended logic.
Impact:
If a malicious contract is used as msg.sender
, it can re-enter the mintProfile
function via onERC721Received
.
This could lead to double minting or inconsistent state, where profiles
and profileToToken
are not correctly updated.
The vulnerability could potentially allow an attacker to mint multiple NFTs or bypass profile uniqueness constraints.
Proof of Concept:
Recommended Mitigation:
Follow the Checks-Effects-Interactions - (CEI) pattern to ensure state updates occur before external calls.
Move _safeMint
after all state changes to prevent reentrancy risks.
By consider using OpenZeppelin’s ReentrancyGuard
to prevent reentrant calls ("")
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`.
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.