Pieces Protocol

First Flight #32
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Valid

Unrestricted Access to Mint Function

Summary

The mint function src/token/ERC20ToGenerateNftFraccion.sol is public giving anyone the ability to mint unlimited tokens to any address. This lack of access control creates a vulnerability issue that undermines the system's integrity.

Vulnerability Details

The mint function allows any caller to mint any token amount to any address without restriction. This exposes the contract to abuse from malicious users who could flood the system, rendering the token worthless.

function mint(address _to, uint256 _amount) public {
_mint(_to, _amount);
}

There is no restriction limit as to who can call this function.

Impact

This vulnerability can result in token inflation, where an attacker mints unlimited tokens that devaluate their worth. Trust will drastically reduce if users realize that anyone can mint as many tokens as they wish.

Tools Used

I manually review the code after cloning the GitHub repository on my computer and access it using VS Code.

Recommendations

Access control should be implemented to restrict who can mint the tokens,openzeppelin's Ownable or AccessControl modifiers can be used to achieve this.

function mint(address _to, uint256 _amount) public Ownable{
_mint(_to, _amount);
}
Updates

Lead Judging Commences

juan_pedro_ventu Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Lack of token access control chekcs

Any person can mint the ERC20 token generated in representation of the NFT

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.