The mint function inherits and uses ERC1155Upgradeable::_mint()
which has a protection against zero address calls, however, it requires that if the caller is a smart contract, it must implement {IERC1155Receiver-onERC1155Received}. In that external call and inside the onERC1155Received()
, reentrance attack can be introduced. Below are mint() code as well as ERC1155Upgradeable::_mint()
reentrance attack can be used when mint() calls to verify that "to" address is smart contract and inside the onERC1155Received()
. This happened in the documented attack against "HypeBears NFT contract".
Can also be problem of future exploitation of same external call(onERC1155Received()
).
Note: The access control on the mint() can't help against this since, this is mint() legitimately calling external contract to verify address as stated above.
Manipulation of mint logic and future issues that can be introduced by reentrance attack() as the case linked above.
For example an attacker can setup his/her onERC1155Received() function and include logic to manipulate / call back the contract as below.
Manual review
Add reentrance guard modifier on mint or add additional if condition.
Inherit from ReentrancyGuard, then use nonReentrant modifier on mint() function.
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.