Skip to content
Smart contracts Audit finding Beginner

M-11 Use _safeMint instead of _mint for ERC721

The contract uses `_mint` instead of `_safeMint` for ERC721 tokens, which does not check if the recipient is a contract that can handle ERC721 tokens. An attacker could mint tokens to a contract that cannot receive them, potentially locking the tokens.

c4lanky Follow

Originally disclosed on Code4rena

Submitted by c4lanky

Note: this finding was reported via the winning Automated Findings report. It was declared out of scope for the audit, but is being included here for completeness.

_mint() is discouraged in favor of _safeMint(), which ensures that the recipient is either an EOA or implements IERC721Receiver. Both OpenZeppelin and solmate have versions of this function.

There are 1 instances of this issue: File: contracts/nft/ReputationBadge.sol

119:         _mint(recipient, tokenId, amount, "");

https://github.com/code-423n4/2023-07-arcade/blob/main/contracts/nft/ReputationBadge.sol#L119

PowVT (Arcade) confirmed


The original report as published on Code4rena, by c4lanky. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the developer used `_mint` instead of `_safeMint` without considering that recipients might be contracts that cannot handle ERC721 tokens.

Impact

If an NFT is minted to a contract that does not implement `IERC721Receiver`, the NFT could become permanently locked in that contract.

What the attacker needed

Recipient is a contract without IERC721Receiver

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you send an NFT to a contract, that contract needs a way to accept it. The `_safeMint` function checks this, but `_mint` does not. Using `_mint` could accidentally send an NFT to a contract that cannot handle it, making the NFT stuck forever.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by c4lanky

View all

3 more disclosed reports, best first.

More from Arcade.xyz

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.