Skip to content
Business logic Audit finding Intermediate

The supply of NFT for each tokenID in ERC1155NFTProduct cannot be modified after the first minting

The ERC1155NFTProduct contract prevents minting additional tokens with the same tokenId after the first mint, so the supply for each tokenId is fixed and cannot be increased. This limits the intended multi-token functionality of ERC1155.

GimelSec Follow with cccz

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-10-nftport-judging/issues/95

Found by

GimelSec, cccz

Summary

The supply of NFT for each tokenID in ERC1155NFTProduct cannot be modified after the first minting

Vulnerability Detail

When minting NFT in the ERC1155NFTProduct contract, it will check whether the tokenID already exists, that is, as long as tokenSupply[tokenId] > 0, the ERC1155 NFT of this tokenId will not be able to be minted again. This will lead to

  1. The supply of NFT for each tokenID is determined after the first mint
  2. Unable to mint ERC1155 NFT with the same tokenId for different users

This will greatly limit the application scenarios of ERC1155NFTProduct

Impact

  1. The supply of NFT for each tokenID is determined after the first mint
  2. Unable to mint ERC1155 NFT with the same tokenId for different users

Code Snippet

https://github.com/sherlock-audit/2022-10-nftport/blob/main/evm-minting-master/contracts/templates/ERC1155NFTProduct.sol#L279-L286 https://github.com/sherlock-audit/2022-10-nftport/blob/main/evm-minting-master/contracts/templates/ERC1155NFTProduct.sol#L259-L265 https://github.com/sherlock-audit/2022-10-nftport/blob/main/evm-minting-master/contracts/templates/ERC1155NFTProduct.sol#L388-L390

Tool used

Manual Review

Recommendation

Consider removing the _exists check when minting ERC1155 NFT in the ERC1155NFTProduct contract

Discussion

hyperspacebunny

We've decided to not change the behaviour at this point and revisit it once we have requests from users. It's currently working as designed.

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

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 mint function includes an existence check that reverts if tokenSupply[tokenId] > 0, preventing any subsequent minting for that tokenId.

Impact

The supply of each tokenId is fixed after the first mint, and it is impossible to mint the same tokenId for different users, which severely limits the contract's use cases.

What the attacker needed

None

The fix

The _exists check should be removed from the minting logic so that additional tokens can be minted for an existing tokenId.

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.

ERC1155 is a token standard that allows multiple copies of the same token ID, unlike ERC721 where each token is unique. In this contract, once any amount of a token ID is minted, the code blocks any further minting of that same ID, so you can never add more copies later. This means the total supply is locked after the first mint, which defeats the purpose of a multi-copy token.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by GimelSec

View all

18 more disclosed reports, best first.

More from NFTPort

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.