Skip to content
Business logic Audit finding Intermediate

Unfair yield distribution due to last holder bias

The yield distribution function gives any leftover amount to the last holder in the holders array, making payouts unfair. An attacker could repeatedly transfer tokens to become the last holder and capture the extra yield, potentially causing gas wars.

ZeroXGondar Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

52327 sc low unfair yield distribution due to last holder bias

Submitted on Aug 9th 2025 at 21:24:32 UTC by @ZeroXGondar for Attackathon | Plume Network

Description

Summary

In ArcToken::distributeYield any remaining amount is given to the last holder. This creates unfairness in yield distribution and can also enable a “Zero Balance Dance” (described below) where holders attempt to become the last holder to receive the extra share.

Details

The following block shows that any remaining amount is transferred to the last holder:

Solidity
      if (holderCount > 0) {
            address lastHolder = $.holders.at(lastProcessedIndex);
            if (_isYieldAllowed(lastHolder)) {
                uint256 lastShare = amount - distributedSum;
                if (lastShare > 0) {
                    yToken.safeTransfer(lastHolder, lastShare);
                    distributedSum += lastShare;
                }
            }
        }

This results in unfairness because the last holder may receive more yield than other holders. Two main problems arise:

  • Holders can attempt to manipulate the holders array ordering to become the last holder and capture the excess.
  • This can create network-level competition ("gas wars") where many users repeatedly transfer tokens to become last in the array.

Impact details

  • Zero Balance Dance Attack: Users can transfer all tokens to another address they control (triggering holders.remove()), then transfer back (triggering holders.add() at the end of array). The contract's _update logic shows this behavior:
Solidity
    if (from != address(0)) {
            uint256 fromBalanceBefore = balanceOf(from);
            if (fromBalanceBefore == amount) {
                $.holders.remove(from);
            }
        }

        super._update(from, to, amount);

        if (to != address(0) && balanceOf(to) > 0) {
            $.holders.add(to);
        }

Because a removed-and-readded address is placed at the end of the holders structure, users can repeatedly perform such transfers (or monitor and frontrun distribute calls) to become the last holder and capture the extra yield. If many users adopt this strategy, it can cause excessive on-chain activity and congestion.

Objection: transfers can be restricted by admin

Transfers may be restricted by an admin via a whitelisting module, which would mitigate the attack. However, restricting transfers impacts usability and requires trusted management of whitelisted accounts. The underlying unfair distribution logic remains even if transfers are restricted.

Recommendation (from reporter): If there is an unavoidable remainder, consider returning it to the protocol (e.g., collect into a reserve) and include it in the next distribution rather than awarding it to the last holder.

Severity rationale: Low — the contract fails to deliver promised returns fairly, but funds are not lost.

Proof of Concept

<details> <summary>PoC: Sequence demonstrating the unfairness and the Zero Balance Dance</summary>

SetupAlice, Bob, and Charlie are token holders. Assume Charlie is currently the last holder in the holders structure.Distribution with remainderYield is distributed. Because there's an excess remainder after per-holder shares are computed, that remainder is transferred to the last holder (Charlie), giving Charlie more yield than Alice or Bob.Incentive to manipulateSeeing this, holders attempt to become the last holder. A holder can:Move all tokens to another address they control (causing their address to be removed from the holders structure).Move tokens back to that address (causing it to be re-added and placed at the end of the holders structure). This pattern (Zero Balance Dance) places them as last holder and eligible for the remainder.Amplification: gas warsMultiple holders may compete to be the last holder, sending many transactions to reorder the holders array. If the excess yield is larger than the gas cost, participants can economically justify these transfers, leading to network congestion and wasted gas.

</details>

Notes

  • Admin transfer restrictions can mitigate the attack surface, but do not remove the unfairness in distribution logic.
  • Suggested resolution: do not assign the remainder to the last holder; instead, collect it for future distributions or protocol reserves.

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

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 contract assigns the undistributed remainder to the last holder in the holders array instead of handling it neutrally.

Impact

The last holder could receive more yield than others, and repeated transfers to become last could cause network congestion and wasted gas; admin transfer restrictions may mitigate but do not remove the unfairness.

What the attacker needed

Token holder; ability to transfer tokens

The fix

The remainder should be returned to the protocol or reserved for future distributions instead of being given to the last holder.

How it was found

  1. A holder moves all tokens to another address they control, which removes them from the holders list.
  2. They move the tokens back, which re-adds them at the end of the holders list.
  3. They become the last holder and receive the leftover yield during distribution.

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 contract pays out earnings to many people, the total often doesn't divide evenly. This report says the leftover amount is given to whoever is last in the list of holders. That means someone can try to be last on purpose to get extra money, which is unfair to everyone else.

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 ZeroXGondar

View all

1 more disclosed report, best first.

More from Plume Network

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.