Skip to content
Business logic Audit finding Intermediate

It is possible to “uninitialize” ERC20Facet contract

The ERC20Facet contract's initialization status is determined by its name and symbol strings. An attacker could set these to empty strings, effectively uninitializing the contract and allowing the initialize function to be called again, enabling them to mint unlimited tokens or hide minting.

Czar102 Follow

Originally disclosed on Code4rena

Submitted by Czar102

Impact

The initialization status is defined by the name and symbol. It is possible it set them back to an empty string, uninitializing the contract and letting the initialize(..) function be called again. This way, the owner may, for example, hide minting additional tokens. Or, after accidentally setting name and symbol to empty strings, anyone can take control over the contract and mint any number of tokens.

In general, it shouldn’t be possible to initialize more than once.

Recommended Mitigation Steps

Consider adding empty string checks in setName(...) and setSymbol(...) functions.

loki-sama (Amun) confirmed

The original report as published on Code4rena, by Czar102. 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 contract uses the name and symbol strings as the sole indicator of initialization, without preventing them from being set to empty strings.

Impact

An attacker could uninitialize the contract and reinitialize it to mint unlimited tokens, or the owner could hide minting; the text does not specify if this was actually exploited.

What the attacker needed

Ability to call setName or setSymbol

The fix

The contract should be fixed by adding checks to prevent setting the name or symbol to empty strings.

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 smart contract uses the token's name and symbol to decide if it has been set up. If someone can erase those names, the contract thinks it's new and lets anyone set it up again, which could let them create unlimited tokens.

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 Czar102

View all

12 more disclosed reports, best first.

More from Amun 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.