Description:
The ERC20ToGenerateNftFraccion::mint
function in the ERC20 contract lacks access control, allowing any user to mint tokens arbitrarily. While this does not directly break any TokenDivider
functionality, it undermines the integrity of the ERC20 token by permitting unauthorized minting.
Code snippet illustrating the issue:
Since the mint function is public and does not include any access restrictions, any user can call it and create tokens, even if they do not own the corresponding NFT.
Impact:
Medium: Unauthorized users can mint tokens tied to an NFT they do not own. While the TokenDivider
tracks ownership, this behavior can lead to inconsistencies.
Proof of Concept:
The following test demonstrates that USER2
can mint ERC20 tokens associated with an NFT owned by USER
:
Recommended Mitigation:
Introduce proper access control to ensure that only authorized accounts can mint ERC20 tokens. This can be achieved using OpenZeppelin’s Ownable or AccessControl modules.
Any person can mint the ERC20 token generated in representation of the NFT
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.