Skip to content
Business logic Audit finding Beginner

_totalSupply not updated in _transferMint() and _transferBurn()

The token contract's internal mint and burn helper functions do not update the total supply variable, unlike the standard mint and burn functions. This causes the reported total supply to be inaccurate, which could mislead external protocols, user interfaces, and analytics platforms that rely on it.

gpersoon Follow

Originally disclosed on Code4rena

Submitted by gpersoon, also found by WatchPug, harleythedog, hubble, xYrYuYx, cmichel, and defsec

Impact

The functions \_transferMint() and \_transferBurn() of OverlayToken.sol don’t update \_totalSupply. Whereas the similar functions \_mint() and \_burn() do update \_totalSupply.

This means that \_totalSupply and totalSupply() will not show a realistic view of the total OVL tokens.

For the protocol itself it isn’t such a problem because this value isn’t used in the protocol (as far as I can see). But other protocols building on Overlay may use it, as well as user interfaces and analytic platforms.

Proof of Concept

https://github.com/code-423n4/2021-11-overlay/blob/914bed22f190ebe7088194453bab08c424c3f70c/contracts/ovl/OverlayToken.sol#L349-L364

function _mint( address account, uint256 amount) internal virtual {
   ...
      _totalSupply += amount;

https://github.com/code-423n4/2021-11-overlay/blob/914bed22f190ebe7088194453bab08c424c3f70c/contracts/ovl/OverlayToken.sol#L376-L395

function _burn(address account, uint256 amount) internal virtual {
   ...
        _totalSupply -= amount;

https:

https:

The original report as published on Code4rena, by gpersoon. 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

Likely the internal helper functions for minting and burning were written without including the total supply update that the standard mint and burn functions perform.

Impact

The total supply value becomes inaccurate, which could mislead external protocols, user interfaces, and analytics platforms that rely on it, though the protocol itself does not use this value.

What the attacker needed

None

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.

A token contract keeps a running total of how many tokens exist, called the total supply. Some functions that create or destroy tokens forgot to update this total, so the reported number is wrong. This can confuse other programs or dashboards that read the total 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 gpersoon

View all

47 more disclosed reports, best first.

More from Overlay Protocol 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.