mintProfile
function of the SoulboundProfileNFT
contract. The function calls _safeMint
, which in turn makes an external call to onERC721Received
before updating the contract state. This allows a malicious contract to re-enter the mintProfile
function and mint multiple NFTs before the state is updated.SoulboundProfileNFT.sol#30-41
Please look the below vulnerable code to understand it properly:
This allows an attacker to mint multiple NFTs instead of only one.
It breaks the soulbound NFT logic, which ensures that each user has only one profile NFT.
Manual Method
--> Update the state before making external calls:
--> Import OpenZeppelin’s ReentrancyGuard
and mark mintProfile
as nonReentrant
:
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.