Total Supply is not guaranteed and is not deterministic.
The token's total supply is not deterministic because the inflation update uses the old rate before checking if the decay period has passed, so if no one mints or calls the update for a while around the decay point, the total available grows too much. An attacker could mint more than the stated cap of 268435456 tokens.
Submitted by Picodes, also found by scaraven
The actual total supply of the token is random and depends on when _executeInflationRateUpdate is executed.
Proof of Concept
The README and tokenomic documentation clearly states that “The token supply is limited to a total of 268435456 tokens.” However when executing _executeInflationRateUpdate, it first uses the current inflation rate to update the total available before checking if it needs to be reduced.
Therefore if no one mints or calls executeInflationRateUpdate for some time around the decay point, the inflation will be updated using the previous rate so the totalAvailableToNow will grow too much.
Mitigation Steps
You should do
totalAvailableToNow += (currentTotalInflation * (block.timestamp - lastEvent));
Only if the condition block.timestamp >= lastInflationDecay + _INFLATION_DECAY_PERIOD is false.
Otherwise you should do
totalAvailableToNow += (currentTotalInflation * (lastInflationDecay + _INFLATION_DECAY_PERIOD - lastEvent));
Then update the rates, then complete with
totalAvailableToNow += (currentTotalInflation * (block.timestamp - lastInflationDecay + _INFLATION_DECAY_PERIOD));
Note that as all these variables are either constants either already loaded in memory this is super cheap to do.
danhper (Backd) confirmed, but disagreed with severity and commented:
I believe this should actually be high severity
Alex the Entreprenerd (judge) increased severity to High and commented:
The warden has identified the lack of an upper bound on the inflation math which would make it so that more than the expected supply cap of the token could be minted.
The sponsor agrees that this should be of High Severity.
Because this breaks the protocol stated invariant of a specific cap of
268435456tokens, I agree with High Severity.
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 inflation update applies the current rate to the whole elapsed time before checking whether the decay period has passed, so the old rate is used for time after the decay point.
Impact
More than the stated cap of 268435456 tokens could be minted, breaking the protocol's invariant.
What the attacker needed
No one mints or calls the update around the decay point
The fix
The update should split the elapsed time at the decay point: apply the old rate only up to the decay point, then update the rate, then apply the new rate for the remaining time.
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 has a maximum supply that should never be exceeded. The code that updates how many tokens are available uses the old inflation rate before checking if it is time to lower that rate. If nobody triggers the update for a while, the old rate is applied for too long, so more tokens become available than the cap allows.
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.