Reentrancy is possible in the SoungboundProfileNFT::mintProfile
function.
The mintProfile
function is not protected against reentrancy, which could happen via the _safeMint
invocation. If the message sender is a contract, which implements the IERC721Receiver.onERC721Received
function, this function will be internally invoked as per the ERC721 standard. This could allow the contract to re-enter one of the other functions. For example, re-entering the mintProfile
function would allow the message sender to mint multiple profiles with the same address. This would lead to the potential depletion of the tokenId counter, and also incorrect state, as the profileToToken
mapping would be overwritten and contain only the last minted tokenId.
Low impact - the contract state would be corrupted. High likelihood - an attacking contract is really easy to create. For example:
Manual review.
Use a stock reentrancy guard (for example, OpenZeppelin's ReentrancyGuard
) or follow the CEI (checks-effects-interactions) pattern. Here's an example of the latter:
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.