Open hats-bug-reporter[bot] opened 6 months ago
@PlamenTSV invalid issue as this is more of a recommendation than a vulnerability. _safeMint()
in its turn opens up reentrancy attack vector so both functions have their advantages and disadvantages
@PlamenTSV i think @rodiontr is correct here. A normal mint function can also send the NFT to both wallet and contract address. You always dont need to check ERC721 receiver support unless the safe transfer method is used to transfer NFT. You can check it in remix IDE. use of unsafe mint seems to be intended design by project team.
We don't use safeMint, as it's an expensive function and can be exploited by reentrancy. This issue is therefore invalid.
Github username: -- Twitter username: -- Submission hash (on-chain): 0xc9744d2c5939517f8898f82f71d405f530cb3b42aecadba999ceb9ff71671507 Severity: medium
Description: Description\
Use safeMint instead of mint for ERC721 tokens.
Attack Scenario\ When a deposit is made into the staking service by a user, an nft position is minted to the caller. The nft uses unsafe
_mint
function which doesn't check that the receiver accepts ERC721 tokens. This can lead to the user's staking position being locked in the contract.As per the documentation of ERC721Upgradeable.sol by Openzeppelin, the use of
_mint
is discouraged in favour ofsafeMint
instead.Ref:
Attachments
Proof of Concept (PoC) File
...
Use safemint function instead and implement a reentrancy guard