The function SoulboundProfileNFT::mintProfile
is vulnable to reentrancy because the ERC721::_safeMint
function is calling IERC721Receiver.onERC721Received
if the receiver is a contract. This attack is feasible because the contract is not following the CEI (check-effect-interaction) pattern. This breaks the invariant that an address can only have one profile.
When SoulboundProfileNFT::mintProfile
is used, ERC721::_safeMint
is called
According to the OpenZeppelin documentation of the _safeMint function
If to
is a contract that implements IERC721Receiver-onERC721Received
, it can call again the SoulboundProfileNFT::mintProfile
function and mint another NFT to itself.
In order to reproduce this issue, add the following test in SoulboundProfileNFTTest
The following contract is used to recreate the issue. it gets only 2 soulboundNFTs but with a simple modification it can get many more.
Any malicious actor can execute the action
If the address get a match, the other user wont know which profile is the correct one. This defeats the purpose of the application
We recommned to follow the CEI pattern and call the _safeMint
function after the store effects.
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.