Skip to content
Business logic Audit finding Intermediate

Extension voting threshold check needs to rerun on each transfer

The Extension contract updates vote counts on token transfers but does not re-evaluate whether the extension's voting threshold has been met after the transfer. This can prevent an extension from being granted even when the new token holder's votes would push total support over the threshold.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The Extension contract correctly reduces votes from the from address of a transfer and adds it to the to address of the transfer (in case both of them voted on it before), but it does not rerun the voting logic in voteOnExtension that actually grants the extension. This leads to issues where an extension should be granted but is not:

POC

  • to address has 100 tokens and votes for the extension
  • from address has 100 tokens but does not vote for the extension and transfers the 100 tokens to to
  • to now has 200 tokens, removeVotes is run, the totalExtensionSupport is increased by 100 to 200. In theory, the threshold is reached and the vote should pass if to could call voteOnExtension again.
  • But their call to voteOnExtension with the new balance will fail as they already voted on it (lastVotedExtension == _extensionVoteEndTime). The extension is not granted.

Impact

Extensions that should be granted after a token transfer are not granted.

Recommended Mitigation Steps

Rerun the threshold logic in removeVotes as it has the potential to increase the total support if to voted for the extension but from did not.

ritik99 (Sublime) confirmed

The original report as published on Code4rena, by cmichel. 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 vote-counting logic in `removeVotes` does not re-check the threshold after updating support, so a transfer that increases total support does not trigger the granting of the extension.

Impact

Extensions that should be granted after a token transfer are not granted.

What the attacker needed

Token holders can vote on extensions; a transfer increases total support

How it was found

  1. The `to` address has 100 tokens and votes for the extension.
  2. The `from` address has 100 tokens, does not vote, and transfers the 100 tokens to `to`.
  3. `to` now has 200 tokens; `removeVotes` runs and increases `totalExtensionSupport` by 100 to 200.
  4. The threshold is reached, but `to` cannot vote again because they already voted (`lastVotedExtension == _extensionVoteEndTime`).
  5. The extension is not granted.

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 tokens move between people, the contract adjusts the votes for an extension, but it forgets to check again if enough votes now exist to pass. So an extension that should pass after a transfer might not get approved.

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 cmichel

View all

196 more disclosed reports, best first.

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