Skip to content
Business logic Audit finding Intermediate

DistributeYieldWithLimit Lacks Snapshot Between Batches, Allowing State Changes to Break Distribution and Lock Yield

The distributeYieldWithLimit function recalculates the eligible total supply on every batch instead of using a snapshot from the first batch, so transfers, burns or eligibility changes between batches alter the share calculation. This can make a batch try to pay out more than the contract holds, reverting the transaction and locking the remaining yield.

Plume Network

Originally disclosed on Immunefi

52845 sc high distributeyieldwithlimit lacks snapshot between batches allowing state changes to break distribution and lock yield

Impact: Permanent freezing of funds

Description

Brief / Intro

The distributeYieldWithLimit function recalculates effectiveTotalSupply on each batch execution without storing a snapshot of balances or total supply from the first batch. This allows state changes (transfers, burns, toggling eligibility) between batches to alter supply used in share calculations mid-distribution. As a result, the function may attempt to overpay holders, causing transaction reverts, locking yield in the contract indefinitely, and producing unfair distributions.

Vulnerability Details

In ArcToken.sol:

Solidity
uint256 share = (totalAmount * holderBalance) / effectiveTotalSupply;
  • totalAmount remains constant for all batches.
  • effectiveTotalSupply is recalculated at every batch call by iterating over all holders.
  • No snapshot is taken at the start of distribution.
  • No tracking exists for:
    • How much yield has been distributed so far
    • Remaining amount
    • Original total supply of eligible holders

Because effectiveTotalSupply can change between batches (e.g., token transfers, mint/burn, or _isYieldAllowed changes), the calculation can become inconsistent. This can cause the function to attempt to send more tokens than the contract holds (revert), or to distribute yield unfairly across holders.

Impact Details

  • Funds Locked: Remaining yield cannot be distributed after revert.
  • DoS: Distribution can be blocked by a single malicious holder modifying balance/eligibility mid-process.
  • Fairness Violation: Early-processed holders may receive more than their fair share while others receive none.
  • Gas Waste: Unbounded iteration increases cost of retries.

Severity justification: An attacker can intentionally lock yield distribution for all holders, freezing funds and breaking intended protocol functionality.

References

Proof of Concept

Assume 3 holders:

Holder Balance Eligible
H1 50 Yes
H2 30 Yes
H3 20 Yes
  • effectiveTotalSupply = 100
  • totalAmount = 100 tokens yield
  • maxHolders = 1 (process 1 holder per batch)

{% stepper %} {% step %}

Batch 1 (startIndex = 0)

  • startIndex == 0 → transferFrom pulls 100 tokens to the contract
  • effectiveTotalSupply = 100
  • H1 share = (100 * 50) / 100 = 50
  • Contract balance after: 50 tokens remain {% endstep %}

{% step %}

State Change Before Batch 2

  • H1 transfers tokens away or becomes restricted (_isYieldAllowed returns false)
  • New effectiveTotalSupply = 30 + 20 = 50 {% endstep %}

{% step %}

Batch 2 (startIndex = 1)

  • effectiveTotalSupply = 50 (recalculated)
  • H2 share = (100 * 30) / 50 = 60
  • Contract only has 50 → safeTransfer fails → revert
  • Distribution halts permanently, locking yield in the contract {% endstep %} {% endstepper %}

Notes on mitigation attempt

A possible mitigation is to adjust totalAmount before each batch to reflect only the remaining yield. However:

  • The caller must be aware of on-chain interactions (transfers, burns, blacklists) and adjust correctly.
  • The caller must calculate remaining yield perfectly.
  • State changes between batches still invalidate the original plan and break fairness.
  • This approach relies on trusted off-chain logic and is not trustless.

Conclusion: Without an on-chain snapshot or robust tracking of distributed amount and original eligible supply, the design cannot guarantee correct, permissionless yield distribution.

Severity: High / Critical

(As reported)


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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Plume Network's ArcToken.sol contract contains a yield distribution feature. The function at the centre of this report, distributeYieldWithLimit, pays out a yield amount to token holders in batches, capped by a maxHolders parameter so that a single call does not iterate over an unbounded holder set. The target of the report is the contract source in the attackathon repository:

Text
https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcToken.sol

The report was filed as a smart contract finding with High severity and an impact of permanent freezing of funds.

Setup

The report does not describe any accounts, roles, tooling or versions used to test the finding. The only preconditions it states are the ones built into the function itself: distribution happens across multiple batch calls, each call recalculates the eligible supply, and the first batch (startIndex == 0) pulls the yield into the contract with transferFrom. The proof of concept uses a hypothetical token with three holders and a maxHolders of 1.

Finding it

The researcher focused on the share calculation inside ArcToken.sol:

Solidity
uint256 share = (totalAmount * holderBalance) / effectiveTotalSupply;

Three properties of this line, taken together with how the function is called, looked wrong:

  1. totalAmount stays constant for every batch.
  2. effectiveTotalSupply is recalculated on every batch call by iterating over all holders.
  3. No snapshot of balances or total supply is taken at the start of the distribution.

The function also keeps no record of how much yield has already been distributed, how much remains, or what the original eligible supply was. Because effectiveTotalSupply can move between batches (through transfers, mint or burn, or a change in _isYieldAllowed), the denominator used for later holders can differ from the one used for earlier holders, while the numerator stays fixed at the full original amount.

Exploitation

The proof of concept assumes three holders, all eligible:

Holder Balance Eligible
H1 50 Yes
H2 30 Yes
H3 20 Yes

With effectiveTotalSupply = 100, totalAmount = 100 tokens of yield, and maxHolders = 1, one holder is processed per batch.

Batch 1 (startIndex = 0)

Because startIndex == 0, the function calls transferFrom to pull 100 tokens into the contract. effectiveTotalSupply is 100, so H1's share is:

Text
(100 * 50) / 100 = 50

After the batch, 50 tokens remain in the contract.

State change before batch 2

H1 transfers tokens away or becomes restricted so that _isYieldAllowed returns false. The new effectiveTotalSupply becomes 30 + 20 = 50.

Batch 2 (startIndex = 1)

effectiveTotalSupply is recalculated as 50. H2's share is now:

Text
(100 * 30) / 50 = 60

The contract only holds 50 tokens, so safeTransfer fails and the transaction reverts. The distribution halts permanently and the yield stays locked in the contract.

The report also notes a possible mitigation attempt: adjusting totalAmount before each batch so that it reflects only the remaining yield. It rejects this approach for four reasons:

  • The caller must be aware of on-chain interactions (transfers, burns, blacklists) and adjust correctly.
  • The caller must calculate the remaining yield perfectly.
  • State changes between batches still invalidate the original plan and break fairness.
  • The approach relies on trusted off-chain logic and is not trustless.

The conclusion is that without an on-chain snapshot or robust tracking of the distributed amount and the original eligible supply, the design cannot guarantee correct, permissionless yield distribution.

Root cause

The denominator of the share formula is recomputed from live state on every batch, while the numerator is fixed at the full distribution amount. Nothing pins the eligible supply or the holder balances to the moment the distribution started, and nothing tracks how much has already been paid out. Any state change between batches therefore shifts the basis of the calculation mid-distribution. The report states that no snapshot of balances or total supply is taken at the start of the distribution.

Impact

The report lists four consequences:

  • Funds locked: remaining yield cannot be distributed after a revert.
  • Denial of service: distribution can be blocked by a single malicious holder modifying balance or eligibility mid-process.
  • Fairness violation: early-processed holders may receive more than their fair share while others receive none.
  • Gas waste: unbounded iteration increases the cost of retries.

The severity justification is that an attacker can intentionally lock yield distribution for all holders, freezing funds and breaking intended protocol functionality. The report labels the severity as High / Critical as reported.

Fix

The report does not describe a fix that was applied. It states what the design needs: an on-chain snapshot, or robust tracking of the distributed amount and the original eligible supply, so that the share calculation is not affected by state changes between batches. It rejects adjusting totalAmount per batch from off-chain logic as insufficient, because that approach relies on trusted off-chain logic and still breaks fairness when state changes.

Variants to test

  • Batch payout functions with a live denominator. Look for any distribution loop that divides a fixed total by a supply or balance value read at call time. A positive result is a share that changes when a holder transfers, burns or loses eligibility between batches.
  • First-batch funding with later recalculation. Check functions that pull the full amount on the first call and pay out over subsequent calls. A positive result is a later batch whose cumulative payouts exceed the contract balance.
  • Eligibility toggles as a griefing lever. Look for an _isYieldAllowed-style check that a holder can flip on themselves. A positive result is a holder who can shrink the eligible supply after receiving a share and cause the next batch to revert.
  • Missing distributed-amount accounting. Look for distribution code with no running total of what has been paid. A positive result is a retry after a revert that pays earlier holders twice or leaves the remainder stranded.

Hunting notes

This class of bug hides in multi-call, permissionless distribution functions: reward claims, airdrop batches, staking yield and dividend payouts. The signal during review is a share formula whose numerator is a constant and whose denominator is recomputed from live state, combined with a batch parameter such as startIndex or maxHolders.

Severity: High / Critical

(As reported)

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

A smart contract called ArcToken.sol on Plume Network has a feature that pays out "yield" (a reward, a bit like interest) to people who hold its tokens. The payout is split into batches so that one transaction does not have to loop over every holder at once. The function that does this is called distributeYieldWithLimit.

The problem is that each batch recalculates how much of the token supply counts as "eligible" at that moment, instead of remembering the numbers from when the distribution started. If anything changes between batches, for example a holder moves their tokens or stops being eligible, the maths for the next batch is done on different numbers. The contract can then try to pay out more than it actually holds, the payment fails, and the remaining yield is stuck in the contract forever. The report rates this as High severity with the impact "permanent freezing of funds".

To follow the rest of this article you only need to understand a few ideas, explained as they come up.

Context

What a smart contract is

A smart contract is a small program that lives on a blockchain. A blockchain is a shared record book that many computers keep copies of, and nobody can quietly change past entries. Once a smart contract is deployed, its code runs exactly as written whenever someone sends it a transaction. People often compare it to a vending machine: you put in a request, the machine follows its fixed rules, and out comes a result. Nobody stands behind the machine to fix mistakes.

What a token is

A token is an entry in a smart contract that says how much of something each address owns. An address is like a bank account number. Holding tokens is like holding shares: the contract keeps a balance for every address.

What yield is

Yield is a reward paid to holders, similar to interest on a savings account. In this contract, yield is paid in tokens: the contract receives an amount of tokens and hands them out to holders in proportion to their balances.

The feature under review

The function at the centre of this report, distributeYieldWithLimit, pays out a yield amount to token holders in batches. A parameter called maxHolders caps how many holders one call processes, so a single transaction does not have to loop over an unlimited number of holders. The target of the report is the contract source in the attackathon repository:

Text
https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcToken.sol

The report was filed as a smart contract finding with High severity and an impact of permanent freezing of funds.

Setup

The report does not describe any accounts, roles, tooling or versions used to test the finding. The only preconditions it states are the ones built into the function itself:

  1. Distribution happens across multiple batch calls.
  2. Each call recalculates the eligible supply.
  3. The first batch (startIndex == 0) pulls the yield into the contract with transferFrom.

transferFrom is a standard token operation: it moves tokens from one address to another on behalf of the caller. Here it moves the yield amount from wherever it is held into the contract, so the contract has something to pay out.

The proof of concept uses a hypothetical token with three holders and a maxHolders of 1, meaning each batch pays exactly one holder.

Finding it

The researcher focused on the share calculation inside ArcToken.sol:

Solidity
uint256 share = (totalAmount * holderBalance) / effectiveTotalSupply;

Line by line, in plain words:

  • uint256 share declares a variable called share that holds a whole, non-negative number. This is the amount one holder is about to receive.
  • totalAmount is the full yield amount being distributed. It is the same for every batch.
  • holderBalance is how many tokens the current holder owns.
  • effectiveTotalSupply is the total of all balances that currently count as eligible for yield.
  • The formula multiplies the total yield by the holder's balance and divides by the eligible supply. If you own half of the eligible tokens, you get half of the yield. It is the same idea as splitting a pizza: your slice is your share of the whole.

Three properties of this line, taken together with how the function is called, looked wrong:

  1. totalAmount stays constant for every batch.
  2. effectiveTotalSupply is recalculated on every batch call by iterating over all holders. "Iterating" means the contract loops through the list of holders one by one to add up their balances.
  3. No snapshot of balances or total supply is taken at the start of the distribution. A snapshot is a saved copy of the numbers at one moment in time, like taking a photo of a scoreboard so later changes do not confuse you.

The function also keeps no record of how much yield has already been distributed, how much remains, or what the original eligible supply was. Because effectiveTotalSupply can move between batches (through transfers, mint or burn, or a change in _isYieldAllowed), the denominator used for later holders can differ from the one used for earlier holders, while the numerator stays fixed at the full original amount.

A few terms from that paragraph:

  • A transfer moves tokens from one address to another.
  • Mint means creating new tokens; burn means destroying tokens. Both change the total supply.
  • _isYieldAllowed is a check inside the contract that decides whether a given holder is currently allowed to receive yield. If it returns false, that holder is left out of the eligible supply.
  • The numerator is the top part of a fraction (here totalAmount * holderBalance); the denominator is the bottom part (here effectiveTotalSupply). Changing the denominator while the numerator stays the same changes the result.

Exploitation

The proof of concept assumes three holders, all eligible:

Holder Balance Eligible
H1 50 Yes
H2 30 Yes
H3 20 Yes

With effectiveTotalSupply = 100, totalAmount = 100 tokens of yield, and maxHolders = 1, one holder is processed per batch.

Batch 1 (startIndex = 0)

Because startIndex == 0, the function calls transferFrom to pull 100 tokens into the contract. effectiveTotalSupply is 100, so H1's share is:

Text
(100 * 50) / 100 = 50

In words: the total yield (100) times H1's balance (50) divided by the eligible supply (100) gives 50 tokens to H1. After the batch, 50 tokens remain in the contract.

State change before batch 2

H1 transfers tokens away or becomes restricted so that _isYieldAllowed returns false. The new effectiveTotalSupply becomes 30 + 20 = 50.

Why this matters: the eligible supply is no longer 100. H1 has left the eligible group, so only H2 and H3 count, and their balances add up to 50.

Batch 2 (startIndex = 1)

effectiveTotalSupply is recalculated as 50. H2's share is now:

Text
(100 * 30) / 50 = 60

In words: the total yield (100) times H2's balance (30) divided by the new eligible supply (50) gives 60 tokens to H2. But the contract only holds 50 tokens, because 50 were already paid to H1. The transfer therefore fails, the whole transaction is undone (this is called a revert), and the distribution halts permanently. The yield stays locked in the contract.

The report also notes a possible mitigation attempt: adjusting totalAmount before each batch so that it reflects only the remaining yield. It rejects this approach for four reasons:

  • The caller must be aware of on-chain interactions (transfers, burns, blacklists) and adjust correctly.
  • The caller must calculate the remaining yield perfectly.
  • State changes between batches still invalidate the original plan and break fairness.
  • The approach relies on trusted off-chain logic and is not trustless.

Some of those words need unpacking:

  • On-chain means happening inside the blockchain, where the contract can see it. Off-chain means happening outside, for example in a person's own software, where the contract cannot verify it.
  • A blacklist is a list of addresses that are not allowed to take part.
  • Trustless means nobody has to be trusted to behave correctly; the code enforces the rules by itself. If a fix depends on someone outside the blockchain doing the right calculation, it is no longer trustless.

The conclusion is that without an on-chain snapshot or robust tracking of the distributed amount and the original eligible supply, the design cannot guarantee correct, permissionless yield distribution. Permissionless means anyone can call the function, without needing special permission.

Root cause

The denominator of the share formula is recomputed from live state on every batch, while the numerator is fixed at the full distribution amount. Nothing pins the eligible supply or the holder balances to the moment the distribution started, and nothing tracks how much has already been paid out. Any state change between batches therefore shifts the basis of the calculation mid-distribution. The report states that no snapshot of balances or total supply is taken at the start of the distribution.

A simple comparison: imagine splitting a cake among friends, but before each slice you re-count who is still in the room and re-divide the original whole cake by the new number of people. The first person may get a slice sized for a bigger group, and by the time you reach the last person there may be no cake left, even though the total was supposed to be enough.

Impact

The report lists four consequences:

  • Funds locked: remaining yield cannot be distributed after a revert.
  • Denial of service: distribution can be blocked by a single malicious holder modifying balance or eligibility mid-process. Denial of service means making a service unusable for everyone, without stealing anything.
  • Fairness violation: early-processed holders may receive more than their fair share while others receive none.
  • Gas waste: unbounded iteration increases the cost of retries. Gas is the fee paid for computation on a blockchain; every retry that fails still costs gas.

The severity justification is that an attacker can intentionally lock yield distribution for all holders, freezing funds and breaking intended protocol functionality. The report labels the severity as High / Critical as reported.

Fix

The report does not describe a fix that was applied. It states what the design needs: an on-chain snapshot, or robust tracking of the distributed amount and the original eligible supply, so that the share calculation is not affected by state changes between batches. It rejects adjusting totalAmount per batch from off-chain logic as insufficient, because that approach relies on trusted off-chain logic and still breaks fairness when state changes.

Variants to test

These are patterns a reviewer can look for in other contracts, to find the same kind of mistake elsewhere:

  • Batch payout functions with a live denominator. Look for any distribution loop that divides a fixed total by a supply or balance value read at call time. A positive result is a share that changes when a holder transfers, burns or loses eligibility between batches.
  • First-batch funding with later recalculation. Check functions that pull the full amount on the first call and pay out over subsequent calls. A positive result is a later batch whose cumulative payouts exceed the contract balance.
  • Eligibility toggles as a griefing lever. Look for an _isYieldAllowed-style check that a holder can flip on themselves. A positive result is a holder who can shrink the eligible supply after receiving a share and cause the next batch to revert. Griefing means causing harm or annoyance to others without direct profit.
  • Missing distributed-amount accounting. Look for distribution code with no running total of what has been paid. A positive result is a retry after a revert that pays earlier holders twice or leaves the remainder stranded.

Hunting notes

This class of bug hides in multi-call, permissionless distribution functions: reward claims, airdrop batches, staking yield and dividend payouts. An airdrop is a free distribution of tokens to many addresses. The signal during review is a share formula whose numerator is a constant and whose denominator is recomputed from live state, combined with a batch parameter such as startIndex or maxHolders.

Severity: High / Critical

(As reported)

Glossary

  • Smart contract: a program stored on a blockchain that runs automatically according to fixed rules.
  • Blockchain: a shared, tamper-resistant record book kept by many computers.
  • Token: a digital unit tracked by a smart contract, with a balance for each address.
  • Address: an identifier on a blockchain, similar to a bank account number.
  • Yield: a reward paid to token holders, similar to interest.
  • Batch: one group of items processed in a single call, here a limited number of holders.
  • maxHolders: a parameter that caps how many holders one batch processes.
  • startIndex: a parameter that says where in the holder list the current batch begins.
  • transferFrom: a token operation that moves tokens from one address to another on the caller's behalf.
  • effectiveTotalSupply: the total of all balances that currently count as eligible for yield.
  • totalAmount: the full yield amount being distributed.
  • Numerator: the top part of a fraction.
  • Denominator: the bottom part of a fraction.
  • Snapshot: a saved copy of values at one moment in time.
  • Transfer: moving tokens from one address to another.
  • Mint: creating new tokens.
  • Burn: destroying tokens.
  • _isYieldAllowed: a contract check that decides whether a holder may receive yield.
  • Revert: undoing a transaction because a rule failed; the transaction has no effect.
  • On-chain: happening inside the blockchain, visible to the contract.
  • Off-chain: happening outside the blockchain, not verifiable by the contract.
  • Blacklist: a list of addresses that are not allowed to take part.
  • Trustless: requiring no trust in any party because the code enforces the rules.
  • Permissionless: callable by anyone without special permission.
  • Denial of service: making a service unusable for its intended users.
  • Griefing: causing harm or disruption to others without direct gain.
  • Gas: the fee paid for computation on a blockchain.
  • Airdrop: a free distribution of tokens to many addresses.
  • Proof of concept: a small worked example that demonstrates a bug is real.

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.