Skip to content
Business logic Audit finding Intermediate

Token: Founder percentages not always respected

The token minting scheme for founders uses a greedy approach that can cause the actual percentage of tokens received by founders to deviate significantly from the configured percentages. An attacker (or a founder) could exploit this to gain more tokens than intended, especially when the vesting period is short.

Lambda Follow

Originally disclosed on Code4rena

Submitted by Lambda, also found by arcoun

Token.sol#L110

Because of the “greedy” minting scheme for founders (tokens to founders are minted until _isForFounder returns false, i.e. until there is an unset tokenRecipient[tokenId % 100]), it can happen that the actual percentages of tokens that the founders receive deviate significantly from the desired percentages:

Proof Of Concept

Imagine we are in a situation where one founder has a 51% share and the other a 48% share. Because schedule is set to 1 for the first founder, tokenRecipient[0] ... tokenRecipient[50] will be set to his address. tokenRecipient[51], tokenRecipient[53], ... is set to the address of the second founder. Now let’s say a mint happens just before the vestExpiry and when tokenId % 100 == 0. In such a situation, founder 1 will get 51 tokens (because of the consecutive entries in tokenRecipients) and founder 2 will get 1 token (because of the entry in tokenRecipient[51], which is also consecutive. Let’s say that the next mint happens after the vest expiration, which means that no founders get additional tokens.

In such a situation, founder 1 got 51 of the “last 100” token IDs, whereas founder 2 only got 1. Therefore, the overall percentage of tokens that those founders got will not be 51% and 40%. When the vest expiration was set to a time far in the future, it will be close to it, but when the vest timespan was only short, it can be very bad. In the extreme case where the expiration is set such that only 1 mint call causes mints for founders, founder 1 will have 51 tokens and founder 2 only 1, meaning the percentages are 51% / 1% instead of 51% / 48%!

Recommended Mitigation Steps

Consider using another distribution scheme. Instead of the current “greedy” scheme (minting until a slot is free), it would make sense to mint the tokens for the founders every 100 tokens, i.e. everytime when tokenId % 100 == 0. Like that, it is ensured that the actual percentages are equal to the desired percentages.

kulkarohan (Nouns Builder) confirmed

Alex the Entreprenerd (judge) commented:

The warden has shown a specific combination of founderPct that will unfairly reward one founder at the detriment of another.

Personally I’d recommend simming a set of schedules, perhaps via Fuzzing (which would have also enriched this submission), to find a solution that solves most use cases.

Because the submission shows a way to lose tokens, in a way that is reliant on configuration, I agree with Medium Severity.


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

The greedy minting loop mints tokens for founders until it encounters an unassigned slot, which can result in an uneven distribution when the token ID modulo 100 aligns with a founder's assigned slots.

Impact

The actual percentage of tokens received by founders can deviate significantly from the configured percentages, potentially unfairly rewarding one founder at the expense of another, especially when the vesting period is short.

What the attacker needed

Founder percentages configured; Short vesting period; Mint at specific tokenId

The fix

The distribution scheme should be changed to mint founder tokens only when tokenId % 100 == 0, ensuring the actual percentages match the desired percentages.

How it was found

  1. Set founder percentages such that one founder has 51% and the other 48%.
  2. Configure the schedule so that the first founder's slots are consecutive from 0 to 50.
  3. Trigger a mint when tokenId % 100 == 0 just before vestExpiry.
  4. Observe that founder 1 receives 51 tokens and founder 2 receives 1 token.
  5. After vestExpiry, no more founder tokens are minted, so the overall percentages are skewed.

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.

When a new token is created, the system gives some tokens to the project founders based on percentages set in the contract. The code tries to give founders their share by minting tokens until it hits a slot that is not assigned to a founder. This can lead to one founder getting many more tokens than they should, especially if the vesting period (the time during which founders receive tokens) is short.

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 Lambda

View all

64 more disclosed reports, best first.

More from Nouns Builder 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.