Skip to content
Audit finding Intermediate

Underflow problems occurring when a token has >18 decimals

The contracts assume all tokens have 18 or fewer decimals, but if a token with more than 18 decimals is used, the scaler computations underflow and produce incorrect values. An attacker could exploit this to manipulate balances or bypass checks, though the report does not detail a concrete attack.

tensors Follow

Originally disclosed on Code4rena

Submitted by tensors, also found by s1m0

The contracts assume that all tokens will have <=18 decimals. This isn’t necessarily a problem if the Tracer team is the only people deploying the contracts and they keep it in mind. But, If the contracts are to be deployed by other people, this assumption should be made explicit and hard-coded.

We can see that the scaler computations will underflow and be defined when it should not be In L220-L232.

Recommend writing a require check that ensures tokenDecimals <= 18 before running the above functions.

raymogg (Tracer) confirmed:

Valid issue and makes sense as a medium.

Suggested mitigation will be implemented.

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

Impact

If a token with more than 18 decimals is used, the scaler computations underflow and produce incorrect values, which could lead to loss of funds or broken accounting, though the report does not show a full exploit.

What the attacker needed

A token with more than 18 decimals; contracts deployed by someone other than Tracer

The fix

A require check should be added to ensure tokenDecimals <= 18 before running the affected functions, and the team confirmed this mitigation will be implemented.

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.

Tokens on Ethereum can have different numbers of decimals, which is like the number of decimal places in a price. This code assumes no token has more than 18 decimals, so if someone uses a token with more, the maths breaks and gives wrong numbers. That could let someone trick the system into thinking they have more or less of a token than they really do.

More by tensors

View all

4 more disclosed reports, best first.

More from Tracer contest

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.