In mintProfile, the internal _safeMint function is called before updating the contract state (_profiles[tokenId] and profileToToken[msg.sender]). This violates CEI, as _safeMint calls an internal function that could invoke an external contract if msg.sender is a contract with a malicious onERC721Received implementation.
Source Code:
Copy this test and auxiliary contract in the unit test suite to prove that an attacker can mint multiple NFTs:
The attacker could end up having multiple NTFs, but only one profile. This is because the mintProfilefunction resets the profileToTokenmapping each time. At the end, the attacker will have only one profile connecting with one token ID with the information of the first mint.
I consider that the severity is Low because the LikeRegistrycontract works with the token IDs, not the NFTs. So, the impact will be a disruption in the relation of the amount of NTFs and the amount of profiles.
Foundry
Slither
To follow CEI properly, move _safeMint to the end:
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.