Skip to content
Business logic Audit finding Beginner

Cannot mint to exactly max supply using _mint function

The smart contract's minting function uses a strict less-than check against the maximum supply, so it reverts when the total supply equals the max. An attacker could not exploit this; it is a functional bug that prevents minting the final token.

Chom Follow

Originally disclosed on Code4rena

Submitted by Chom, also found by hansfriese and minhquanym

Cannot mint to exactly max supply using _mint function.

Proof of Concept

require(_totalSupply < MAX_SUPPLY, "Max supply");

if _totalSupply == MAX_SUPPLY this assert will be failed and reverted.

But it shouldn’t be reverted as _totalSupply == MAX_SUPPLY is valid.

Recommended Mitigation Steps

Change to

require(_totalSupply <= MAX_SUPPLY, "Max supply");

JasoonS (judge) commented:

Feels potentially too generous giving this a medium since it isn’t clear what the exploit would be, but it is a bug. I’ll be generous…

toshiSat (Yieldy) acknowledged and commented:

Yea we aren’t going to implement this one due to nearly every example of rebasing tokens are using this calculation. It will be very unlikely that total supply ever hits max supply, so the risk isn’t worth the reward for changing it.


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

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

The require statement uses a strict less-than comparison instead of less-than-or-equal, so it rejects the valid case where total supply equals max supply.

Impact

The contract cannot mint the final token to reach exactly the maximum supply, but no security impact or exploit is demonstrated.

What the attacker needed

None

The fix

The check should be changed to allow equality, i.e., use less-than-or-equal instead of less-than.

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.

This is a bug in a smart contract's minting logic. The code checks if the total supply is less than the maximum allowed, but it should allow equality. As a result, the contract cannot mint the very last token to reach the maximum supply.

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 Chom

View all

13 more disclosed reports, best first.

More from Yieldy contest

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.