Skip to content

Owner Can Mint Unlimited Supply

SAFE-0133 Centralization Checked automatically by the scanner
1

What goes wrong

An owner/minter-gated mint has no cap or supply schedule. The privileged key can inflate supply arbitrarily and dump on the market or dilute holders to zero — a rug-pull primitive, and a catastrophic risk if the key is compromised.

2

The vulnerable pattern

proof of concept — how it is exploited
// function mint(address to, uint256 amt) external onlyOwner { _mint(to, amt); }
// owner: mint(owner, 1e30) then sells into every pool -> holders wrecked.
3

How to fix it

the pattern that is safe
uint256 public constant MAX_SUPPLY = 100_000_000e18;
function mint(address to, uint256 amt) external onlyOwner {
    require(totalSupply() + amt <= MAX_SUPPLY, "cap");
    _mint(to, amt);
}
Cap supply and/or route minting through governance.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0133 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs