Skip to content
Business logic Audit finding Intermediate

Fee calculation is potentially incorrect

The fee calculation in Basket.sol divides by BASE minus feePct instead of BASE, causing more fees to be charged than intended. An attacker could exploit this to overcharge users on fees.

itsmeSTYJ Follow

Originally disclosed on Code4rena

Submitted by itsmeSTYJ

Impact

More fees are actually charged than intended

Mitigation Steps

Basket.sol line 118

Assume that license fee is 10% i.e. 1e17 and time diff = half a year.

When you calculate feePct, you expect to get 5e16 since that’s 5% and the actual amount of fee to be charged should be totalSupply * feePct (5) / BASE (100) but on line 118, we are actually dividing by BASE - feePct i.e. 95.

5 / 95 = 0.052 instead of the intended 0.05.

Solution is to replace BASE - feePct in the denominator with BASE.

frank-beard (Kuiper) confirmed

Alex the Entreprenerd (judge) commented:

The warden identified an inconsistency with the math that charged more fees than intended

The original report as published on Code4rena, by itsmeSTYJ. 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 fee calculation incorrectly uses BASE - feePct as the denominator instead of BASE.

What the attacker needed

None

The fix

The fix is to replace BASE - feePct in the denominator with BASE.

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 smart contract bug where the fee calculation uses the wrong denominator. Instead of dividing by 100 (the base), it divides by 95, which makes the fee percentage slightly higher than it should be. Users end up paying more fees than they should.

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 itsmeSTYJ

View all

9 more disclosed reports, best first.

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