Skip to content
DoS Audit finding Intermediate

DoSed `Voter::finalize()` due to unbounded pending removals lacking a batch argument variable

The epoch finalisation function processes a pending-removals list in a single unbounded loop, so an attacker can create many auto-voting accounts and push entries into that list. When the admin finalises the epoch, the loop runs out of gas, blocking finalisation and leaving rewards stuck.

0x73696d616f Follow with Bobai23, ezsia and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-09-bmx-deli-swap-judging/issues/68

Found by

0x73696d616f, Bobai23, ezsia, maigadoh

Summary

Voter::finalize() processes in batches to allow finalizing epochs and distributing rewards without running out of gas. However, Voter::_processPendingRemovals() doesn't take a batch variable into account, making it possible for an attacker to register as auto voter with a balance > 0, and then transfer their votes out, being sent to the pending removals array as soon as the epoch is finalized. By spamming this in a huge number of accounts, an attacker is able to DoS epoch finalization for all epochs, effectively making all rewards stuck.

Root Cause

In Voter.sol:386, Voter::_processPendingRemovals() is missing a batch variable argument.

Internal Pre-conditions

None

External Pre-conditions

None

Attack Path

  1. Attacker calls Voter::vote() with a wei balance, enabling auto voting, and then transferring the balance out. Attacker does this for multipler addresses such that Voter::finalize() runs out of gas.
  2. Admin calls Voter::finalize(), and in Voter::_tallyAutoVotes(), all the accounts are pushed to the pendingRemovals array. Due to the lack of a batch argument in the Voter::_processPendingRemovals() function, it will run out of gas trying to remove all the addresses of the attacker.

Impact

Epoch finalization is impossible and rewards are forever stuck.

PoC

Note Voter.sol::_processPendingRemovals():

Solidity
function _processPendingRemovals(uint256 ep) internal {
    address[] memory toRemove = pendingRemovals[ep];
    for (uint256 i = 0; i < toRemove.length; i++) {
        address addr = toRemove[i];
        uint256 idx = autoIndex[addr];
        if (idx > 0) {
            _removeAutoVoter(addr, idx - 1);
        }
    }
    delete pendingRemovals[ep];
}

Mitigation

Send a batch argument, to avoid OOG revert.

The original report as published on Sherlock, by 0x73696d616f. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 pending-removals cleanup loop has no batch size limit, so its cost grows with an attacker-controlled list length.

Impact

Epoch finalisation becomes impossible and rewards are permanently stuck.

What the attacker needed

Attacker can create many accounts; attacker needs a small balance to vote

The fix

The cleanup should accept a batch argument so removals are processed in bounded chunks.

How it was found

  1. Attacker votes with a tiny balance to enable auto voting, then transfers the balance out.
  2. Attacker repeats this across many addresses to grow the pending removals list.
  3. Admin calls finalize, which tallies auto votes and queues those accounts for removal.
  4. The removal loop runs out of gas and the transaction reverts.

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 smart contract has a limited amount of computation it can do in one transaction, called gas. This contract tried to clean up a whole list of accounts in one go, and an attacker could make that list so long that the cleanup always ran out of gas, so the epoch could never be finished and rewards could not be paid out.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0x73696d616f

View all

172 more disclosed reports, best first.

More from BMX Deli Swap

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.