Skip to content
Business logic Audit finding Intermediate

Missing point in time snapshot in batched yield distribution enables double claims and permanent fund lock

The batched yield distribution function recalculates each holder's share from live balances and iterates by array index rather than using a fixed snapshot, so transfers between batches can let an attacker claim yield twice or cause a holder to be skipped and their yield locked. The report also notes that mid-distribution state changes could make a transfer revert and halt the distribution.

vivekd Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

52517 sc high missing point in time snapshot in batched yield distribution enables double claims and permanent fund lock

Submitted on Aug 11th 2025 at 11:04:25 UTC by @vivekd for Attackathon | Plume Network

Description

Brief / Intro

The distributeYieldWithLimit function calculates yield distribution based on current holder state in each batch call instead of using a fixed point-in-time snapshot.

When token transfers occur between batch calls, this causes distribution calculation inconsistencies that enable two critical exploits:

  • Malicious actors can claim yield multiple times for the same tokens by transferring between batches.
  • Legitimate holders can have their yield permanently locked in the contract when array repositioning causes them to be skipped.

With no recovery mechanism, locked funds accumulate indefinitely.

Vulnerability Details

distributeYieldWithLimit is intended to distribute yield tokens across multiple batches for gas efficiency. However it recalculates distribution denominators and uses live balances during each batch rather than using a snapshot captured at distribution initiation.

Problematic mechanism (excerpt):

Solidity
 // Lines 510-516: Recalculated in EVERY batch call
uint256 effectiveTotalSupply = 0;
for (uint256 i = 0; i < totalHolders; i++) {
    address holder = $.holders.at(i);
    if (_isYieldAllowed(holder)) {
        effectiveTotalSupply += balanceOf(holder); // Current live balances
    }
}

// Lines 532-544: Distribution uses current balance
uint256 holderBalance = balanceOf(holder);
if (holderBalance > 0) {
    uint256 share = (totalAmount * holderBalance) / effectiveTotalSupply;
    yToken.safeTransfer(holder, share);
}

Critical Issue: The function processes holders by INDEX, not by ADDRESS. That means:

  • Batch 1 processes indices 0–999
  • Batch 2 processes indices 1000–1999

If holders move positions in the array between batches, they can be processed multiple times or skipped entirely.

State mutations between batches:

  • Balance changes: Token transfers modify holder balances used in effectiveTotalSupply calculation.
  • Holder array mutations: When holders transfer all tokens, they're removed from the array:
Solidity
if (fromBalanceBefore == amount) {
    $.holders.remove(from); // EnumerableSet moves last element to removed position
}

Attack vectors:

  • Double-Claim Exploit: transferring tokens across indices between batches to be included in multiple batch calculations.
  • Permanent Fund Loss: EnumerableSet.remove() moves the last element to the removed position, possibly moving an unprocessed holder into an already processed index so they are never processed.
  • DoS via Revert: If balances concentrate and the contract lacks sufficient yield tokens for later batches, ERC20 transfer reverts can halt distribution.

Impact Details

  • Primary: Permanent fund loss — legitimate holders can miss allocations and those yields become locked in the contract.
  • Secondary: Double-distribution — attackers can receive more yield than their token share by manipulating positions/balances across batches.
  • Tertiary: Distribution DoS — mid-distribution state changes can cause transfers to revert, preventing completion.

References

https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/arc/src/ArcToken.sol#L462-L555

Proof of Concept

{% stepper %} {% step %}

Permanent Fund Lock via Array Repositioning — Setup

Initial State:

  • Holders array: [Alice(0), Bob(1), Charlie(2), Dave(3)]
  • Each holds 250 tokens
  • 1000 yield tokens to distribute {% endstep %}

{% step %}

Permanent Fund Lock — Execution (Batch 1)

  • Batch 1: Process index 0 (Alice)
  • effectiveTotalSupply = 1000
  • Alice receives 250 yield

State mutation:

  • Alice transfers all 250 tokens to Dave
  • $.holders.remove(Alice) triggered — EnumerableSet moves Dave from index 3 to index 0
  • New array: [Dave(0), Bob(1), Charlie(2)] {% endstep %}

{% step %}

Permanent Fund Lock — Execution (Batch 2)

  • Batch 2 starts from index 1 and processes Bob and Charlie
  • effectiveTotalSupply is recalculated (Dave’s 500 tokens included)
  • Bob receives 250 yield
  • Charlie receives 250 yield

Result:

  • Dave (now at index 0) was already past index 0 processing and is skipped for remaining batches
  • Dave owns 500 tokens but received 0 yield
  • 250 yield tokens become permanently locked in contract (no recovery mechanism) {% endstep %} {% endstepper %}
<details> <summary>Demonstration 2: Double-Claim Attack (expand)</summary>

Initial State:

  • Holders array: [Alice(0), Bob(1), Charlie(2), Dave(3)]
  • Each holds 250 tokens
  • 1000 yield tokens to distribute

Execution:

  • Batch 1: Process index 0 (Alice)
    • effectiveTotalSupply = 1000
    • Alice receives 250 yield

State mutation:

  • Alice transfers 100 tokens to Bob
  • Alice now has 150 tokens, Bob has 350 tokens
  • Array remains unchanged
  • Batch 2: Process index 1 (Bob)
    • effectiveTotalSupply = 1000 (recalculated using live balances)
    • Bob receives (1000 × 350) / 1000 = 350 yield

Double-Claim outcome:

  • Alice + Bob token holdings: 150 + 350 = 500 tokens
  • Alice + Bob received yield: 250 + 350 = 600 yield
  • They received yield corresponding to 600 tokens despite owning 500
</details>

Attack Vector — DoS via Revert (example)

  • Batch 1 distributes 500 yield tokens.
  • Between batches, multiple holders transfer to a single address concentrating expected payouts.
  • Batch 2 attempts to distribute 600 tokens to that concentrated holder while the contract only has 500 remaining — ERC20 insufficient balance revert occurs and distribution cannot complete.

Notes / Summary of Root Cause

  • The distribution logic uses live balances and iterates by index across multiple batches without a point-in-time snapshot.
  • EnumerableSet removes/moves elements by swapping last element into removed index, which combined with index-based batching leads to holders being processed multiple times or skipped.
  • There is no recovery or checkpointing mechanism to ensure a consistent view across batches.

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

Likely the distribution uses live balances and index-based iteration across batches without a point-in-time snapshot, so state changes between batches alter the calculation and the set of processed holders.

Impact

Legitimate holders can permanently lose their yield allocation, attackers could receive more yield than their token share, and mid-distribution state changes could cause a transfer revert that prevents the distribution from completing.

What the attacker needed

Yield distribution runs in multiple batches; attacker can transfer tokens between batches; holders array can change between batches

The fix

The distribution should use a fixed point-in-time snapshot of holders and balances, and should include a recovery or checkpointing mechanism so batches stay consistent.

How it was found

  1. Start with four holders each holding 250 tokens and 1000 yield tokens to distribute.
  2. Batch 1 processes index 0 (Alice) and pays her 250 yield.
  3. Alice transfers all her tokens to Dave, which removes Alice from the holders array and moves Dave from index 3 to index 0.
  4. Batch 2 starts from index 1 and processes Bob and Charlie, recalculating the denominator with Dave's 500 tokens.
  5. Dave, now at index 0, is skipped and receives no yield, leaving 250 yield tokens locked in the contract.

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 yield distribution pays out rewards in several batches to save gas. Because each batch looks at current token balances and current list positions instead of a frozen snapshot, moving tokens between batches changes who gets paid and how much. This can let someone be paid twice for the same tokens, or leave a holder's reward stuck in the contract.

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 vivekd

View all

11 more disclosed reports, 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.