Skip to content
Business logic Audit finding Intermediate

Inconsistent yield token transfer logic causes permanent loss of yield in distributeYield()

The yield distribution function transfers yield tokens into the contract before checking whether any eligible recipients exist, so when all holders are yield-restricted the tokens are stranded. An attacker or operator could cause yield tokens to be permanently stuck in the contract by triggering distribution in that state.

Plume Network

Originally disclosed on Immunefi

51910 sc low inconsistent yield token transfer logic causes permanent loss of yield in distributeyield

Description

Brief / Intro

When distributing yield by calling ArcToken::distributeYield() while effectiveTotalSupply == 0, the yield tokens are still sent to the contract even though there are no addresses to receive them. These tokens will be stuck in the contract.

Vulnerability Details

Both yield distribution functions ensure totalSupply() is greater than zero (otherwise they revert). However, effectiveTotalSupply can still be zero when all addresses holding ArcTokens are yield-restricted.

  • ArcToken::distributeYieldWithLimit() checks that effectiveTotalSupply is greater than zero before transferring the yield tokens to the contract, and returns early if it's zero.
  • ArcToken::distributeYield() transfers the yield token amount to the contract first, then checks if effectiveTotalSupply == 0 and may return early.

Because distributeYield() performs the token transfer before the effectiveTotalSupply check, tokens can be sent into the contract when there are no eligible recipients, leaving them permanently stuck. This behavior is inconsistent with distributeYieldWithLimit().

Impact Details

ArcToken::distributeYield() transfers the yield token amount to the contract even when effectiveTotalSupply == 0. This results in yield tokens being permanently stuck in the contract and is inconsistent with the guarded flow used in ArcToken::distributeYieldWithLimit().

References

Code references are provided throughout the original report and implementation:

Proof of Concept

{% stepper %} {% step %}

Reproduce distribution when no eligible holders exist

Call ArcToken::distributeYield() to distribute yield to token holders while skipping restricted accounts.

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

Assume there are currently no non-restricted holders. {% endstep %}

{% step %}

totalSupply() check passes and tokens are transferred

totalSupply() of ArcToken is greater than zero, so the call proceeds.

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

The yield token amount is then sent to the contract:

Reference: https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/arc/src/ArcToken.sol#L407-L408 {% endstep %}

{% step %}

effectiveTotalSupply == 0 triggers early return but tokens are already stuck

After the transfer, the function checks effectiveTotalSupply. If it equals zero, the function returns early:

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

Because the tokens were transferred to the contract before this check, they remain stuck with no eligible recipients. This contrasts with distributeYieldWithLimit(), which performs the effective supply check before transferring tokens.

Reference: https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/arc/src/ArcToken.sol#L518-L528 {% endstep %} {% endstepper %}

Suggested Mitigation (non-exhaustive)

  • Make the effectiveTotalSupply == 0 check before performing any token transfers in distributeYield(), aligning its flow with distributeYieldWithLimit().
  • Alternatively, revert early (or skip transfer) if there are no eligible recipients to avoid tokens being stranded in the contract.

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 contract, at arc/src/ArcToken.sol, is an ERC-20 style token that also distributes yield to its holders. Two functions handle that distribution: ArcToken::distributeYield() and ArcToken::distributeYieldWithLimit(). Both are meant to spread a yield token amount across holders while skipping accounts that are yield-restricted, and both require totalSupply() to be greater than zero.

The report is a smart contract finding of low severity, filed under the impact category "Theft of unclaimed yield". The core claim is narrow: the two distribution functions guard the same condition in different orders, and one of them moves tokens before it checks whether any recipient exists.

Setup

The report does not describe a test environment, toolchain, fork block or deployed addresses. The only concrete artefacts are source references into the repository at commit [redacted]:

Reference Lines
distributeYield source L388-L460
totalSupply() check L397-L400
Yield transfer in distributeYield L407-L408
effectiveTotalSupply early return in distributeYield L425-L428
distributeYieldWithLimit conditional transfer L518-L528

The precondition that matters is a state where totalSupply() is greater than zero but effectiveTotalSupply is zero. That happens when every address holding ArcTokens is yield-restricted, so no holder counts towards the effective supply used for distribution.

Finding it

The researcher compared the two distribution paths and noticed they enforce the same eligibility condition at different points in their execution.

Both functions first require totalSupply() to be greater than zero, otherwise they revert. That check alone is not enough, because effectiveTotalSupply can still be zero when all ArcToken holders are yield-restricted. The two functions then diverge:

  1. ArcToken::distributeYieldWithLimit() checks that effectiveTotalSupply is greater than zero before transferring the yield tokens to the contract, and returns early if it is zero.
  2. ArcToken::distributeYield() transfers the yield token amount to the contract first, and only afterwards checks whether effectiveTotalSupply == 0, returning early at that point.

Because the transfer in distributeYield() happens before the eligibility check, tokens can enter the contract when there are no eligible recipients, and nothing later moves them out. The inconsistency with distributeYieldWithLimit() is what made the ordering look wrong rather than intentional.

Exploitation

The proof of concept is a three-step reproduction rather than an attack with payloads. No requests, commands or code are shown in the report; the steps reference the source lines listed above.

Step 1: Reproduce distribution when no eligible holders exist

Call ArcToken::distributeYield() to distribute yield to token holders while skipping restricted accounts. The reference for this function is L388-L460. The assumed starting state is that there are currently no non-restricted holders.

Step 2: totalSupply() check passes and tokens are transferred

totalSupply() of ArcToken is greater than zero, so the call proceeds past the check at L397-L400. The yield token amount is then sent to the contract, per L407-L408.

Step 3: effectiveTotalSupply == 0 triggers early return but tokens are already stuck

After the transfer, the function checks effectiveTotalSupply. If it equals zero, the function returns early, per L425-L428. Since the tokens were transferred to the contract before this check, they remain stuck with no eligible recipients. This contrasts with distributeYieldWithLimit(), which performs the effective supply check before transferring tokens (L518-L528).

Root cause

The defect is an ordering mistake in distributeYield(): the state-changing transfer of yield tokens is executed before the guard that decides whether any distribution should happen at all. The totalSupply() check at L397-L400 is a weaker condition than the one that actually matters, because it counts restricted holders, so it passes in exactly the scenario where effectiveTotalSupply is zero. The early return at L425-L428 then exits without unwinding the transfer, leaving the tokens in the contract.

distributeYieldWithLimit() does not have this problem because it evaluates effectiveTotalSupply before moving any tokens. The report presents the divergence between the two functions as the evidence that the ordering in distributeYield() is unintended.

Impact

When distributeYield() is called while effectiveTotalSupply == 0, the yield token amount is transferred to the contract and stays there permanently, with no eligible recipients to receive it. The report lists the impact as theft of unclaimed yield and rates it low severity. The condition is not attacker-controlled in the report's description: it depends on all ArcToken holders being yield-restricted at the time of the call. The report does not describe a way for an outside party to force that state or to recover the stranded tokens.

Fix

The report offers two non-exhaustive mitigations:

  1. Move the effectiveTotalSupply == 0 check before any token transfers in distributeYield(), aligning its flow with distributeYieldWithLimit().
  2. Alternatively, revert early, or skip the transfer, when there are no eligible recipients, so tokens are never stranded in the contract.

Variants to test

  1. Look for sibling functions that share a guard but apply it in different orders, such as a withLimit variant versus a plain variant. A positive result is one path that moves tokens before checking eligibility while the other checks first.
  2. Check whether the supply check used as the first gate (totalSupply()) can pass while the effective supply used for distribution is zero, for example through restriction, pause or blocklist flags on holders. A positive result is a reachable state where the first check passes and the second returns zero.
  3. Trace early returns that occur after external transfers or state changes. A positive result is a return that leaves value or accounting behind rather than reverting.
  4. Review distribution and reward-claiming loops for the same pattern: transfer first, eligibility check second. A positive result is any branch where funds land in the contract with no path that pays them out.

Hunting notes

This class of bug hides in pairs of functions that are meant to behave identically but were written at different times or by different hands. During review, diff the guard order of every x and xWithLimit style pair, and of any function that both moves tokens and filters recipients. The signal is a check on a broad quantity (totalSupply()) followed later by a check on a narrower one (effectiveTotalSupply), with a transfer in between.

The report ties the stranded tokens to a state where all holders are yield-restricted and contrasts the behaviour with the guarded sibling function. No exploit transaction or monetary figure is given, which is consistent with the low severity assigned.

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

Plume Network runs a token called ArcToken. Think of a token as a digital voucher that people can hold, like a gift card with a balance. This particular token also pays out a share of profit, called yield, to the people holding it. Yield is a bit like a dividend: the company earns money and hands a slice to each holder.

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 a smart contract runs automatically when someone calls one of its functions. A function is a named action inside that program, like a button you can press. You cannot edit the program after it is deployed; it does exactly what its code says.

The ArcToken contract has two functions that hand out yield: distributeYield() and distributeYieldWithLimit(). Both are supposed to do the same basic job: take an amount of yield tokens and spread it across the holders, skipping any holder who is "yield-restricted". A yield-restricted account is one that is not allowed to receive yield, for example because of a legal or compliance rule.

The bug is about the order in which one of these functions does two things. distributeYield() first moves the yield tokens into the contract, and only afterwards checks whether there is anybody eligible to receive them. If nobody is eligible, the function stops early, but the tokens have already arrived and stay stuck in the contract forever. The other function, distributeYieldWithLimit(), checks eligibility first and only then moves tokens, so it does not have the problem.

The report is rated low severity and filed under the impact category "Theft of unclaimed yield". That category name is a label the platform uses for bugs where yield that should have reached holders is lost or taken. Here the tokens are not stolen by an attacker; they are simply stranded.

Context

The contract lives at arc/src/ArcToken.sol in the project's code repository. A repository is an online folder that stores code and its history. ArcToken is an ERC-20 style token. ERC-20 is a common standard for tokens on Ethereum-like blockchains: it defines a fixed set of functions such as totalSupply() and transfer() so that wallets and exchanges know how to talk to the token.

Two functions handle yield distribution:

  • ArcToken::distributeYield()
  • ArcToken::distributeYieldWithLimit()

The :: notation simply means "the function distributeYield that belongs to the contract ArcToken". It is a way of writing the address of a function, like saying "the kitchen in house number 5" instead of just "the kitchen".

Both functions are meant to spread a yield token amount across holders while skipping accounts that are yield-restricted. Both also require totalSupply() to be greater than zero. The report's claim is narrow: the two functions check the same condition, but in a different order, and one of them moves tokens before it checks whether any recipient exists.

Setup

The report does not describe a test environment, toolchain, fork block or deployed addresses. A test environment is a safe copy of the blockchain where you can try things without spending real money. A toolchain is the set of programs used to build and test code. A fork block is a specific point in the blockchain's history that a test copy is taken from. Deployed addresses are the locations where the contract actually lives on a live network. None of that is given here.

The only concrete artefacts are source references into the repository at commit [redacted]. A commit is a saved snapshot of the code, identified by a long string of letters and numbers, so that everyone can look at exactly the same version.

Reference Lines
distributeYield source L388-L460
totalSupply() check L397-L400
Yield transfer in distributeYield L407-L408
effectiveTotalSupply early return in distributeYield L425-L428
distributeYieldWithLimit conditional transfer L518-L528

"L388-L460" means lines 388 to 460 of the file. Line numbers are how programmers point each other at a specific piece of code, like page numbers in a book.

The precondition that matters is a state where totalSupply() is greater than zero but effectiveTotalSupply is zero. State means the current values stored inside the contract, like the current balance on a bank account. totalSupply() is the total number of tokens that exist. effectiveTotalSupply is a narrower number: the total that actually counts for yield distribution, which leaves out restricted holders. So the precondition is: tokens exist, but none of the people holding them are allowed to receive yield. That happens when every address holding ArcTokens is yield-restricted.

Finding it

The researcher compared the two distribution paths and noticed they enforce the same eligibility condition at different points in their execution. Execution means the sequence of steps the program goes through when the function is called, from top to bottom.

Both functions first require totalSupply() to be greater than zero, otherwise they revert. To revert is to cancel the whole operation and undo any changes, like a cashier refusing a transaction and handing your money back. That check alone is not enough, because effectiveTotalSupply can still be zero when all ArcToken holders are yield-restricted. The two functions then diverge:

  1. ArcToken::distributeYieldWithLimit() checks that effectiveTotalSupply is greater than zero before transferring the yield tokens to the contract, and returns early if it is zero. "Returns early" means it stops and exits the function at that point instead of running the rest of the code.
  2. ArcToken::distributeYield() transfers the yield token amount to the contract first, and only afterwards checks whether effectiveTotalSupply == 0, returning early at that point.

Because the transfer in distributeYield() happens before the eligibility check, tokens can enter the contract when there are no eligible recipients, and nothing later moves them out. The inconsistency with distributeYieldWithLimit() is what made the ordering look wrong rather than intentional.

A useful everyday comparison: imagine a refund desk. The careful clerk checks whether you are on the refund list before handing over the cash. The careless clerk hands over the cash first and only then checks the list; if you are not on it, the clerk shrugs and walks away, and the cash is gone. The bug is the careless clerk.

Exploitation

The proof of concept is a three-step reproduction rather than an attack with payloads. A proof of concept is a set of steps that shows the bug really happens. A payload is the actual data sent to a system to trigger a bug; here there is none. No requests, commands or code are shown in the report; the steps reference the source lines listed above.

Step 1: Reproduce distribution when no eligible holders exist

Call ArcToken::distributeYield() to distribute yield to token holders while skipping restricted accounts. The reference for this function is L388-L460. The assumed starting state is that there are currently no non-restricted holders.

Why this step: you need to be in the exact situation the bug depends on, namely tokens exist but every holder is restricted, so nobody is eligible. Then you press the button that hands out yield and watch what happens.

Step 2: totalSupply() check passes and tokens are transferred

totalSupply() of ArcToken is greater than zero, so the call proceeds past the check at L397-L400. The yield token amount is then sent to the contract, per L407-L408.

Why this step: the first gate only asks "do any tokens exist?" and the answer is yes, so the function keeps going. It then moves the yield tokens into the contract. At this point the tokens have already left the sender and are sitting inside the contract.

Step 3: effectiveTotalSupply == 0 triggers early return but tokens are already stuck

After the transfer, the function checks effectiveTotalSupply. If it equals zero, the function returns early, per L425-L428. Since the tokens were transferred to the contract before this check, they remain stuck with no eligible recipients. This contrasts with distributeYieldWithLimit(), which performs the effective supply check before transferring tokens (L518-L528).

Why this step: this is where the damage becomes visible. The function now asks the narrower question, "is there anybody eligible?", and the answer is no, so it exits. But exiting is not the same as undoing. The transfer already happened, and nothing in the code sends those tokens back out. They sit in the contract permanently.

Root cause

The defect is an ordering mistake in distributeYield(): the state-changing transfer of yield tokens is executed before the guard that decides whether any distribution should happen at all. A guard is a check that decides whether the code is allowed to continue, like a bouncer at a door. A state-changing operation is one that alters stored values, such as moving tokens from one balance to another.

The totalSupply() check at L397-L400 is a weaker condition than the one that actually matters, because it counts restricted holders, so it passes in exactly the scenario where effectiveTotalSupply is zero. The early return at L425-L428 then exits without unwinding the transfer, leaving the tokens in the contract. To unwind means to reverse the changes already made.

distributeYieldWithLimit() does not have this problem because it evaluates effectiveTotalSupply before moving any tokens. The report presents the divergence between the two functions as the evidence that the ordering in distributeYield() is unintended.

Impact

When distributeYield() is called while effectiveTotalSupply == 0, the yield token amount is transferred to the contract and stays there permanently, with no eligible recipients to receive it. The report lists the impact as theft of unclaimed yield and rates it low severity. Severity is how serious a bug is judged to be, usually based on how much damage it can cause and how easy it is to trigger.

The condition is not attacker-controlled in the report's description: it depends on all ArcToken holders being yield-restricted at the time of the call. Attacker-controlled means an outside person can deliberately cause the situation. The report does not describe a way for an outside party to force that state or to recover the stranded tokens.

Fix

The report offers two non-exhaustive mitigations. A mitigation is a change that reduces the problem. Non-exhaustive means the list is not claimed to be complete; other fixes may also work.

  1. Move the effectiveTotalSupply == 0 check before any token transfers in distributeYield(), aligning its flow with distributeYieldWithLimit().
  2. Alternatively, revert early, or skip the transfer, when there are no eligible recipients, so tokens are never stranded in the contract.

Variants to test

These are patterns to look for elsewhere, once you know this kind of bug exists.

  1. Look for sibling functions that share a guard but apply it in different orders, such as a withLimit variant versus a plain variant. A positive result is one path that moves tokens before checking eligibility while the other checks first.
  2. Check whether the supply check used as the first gate (totalSupply()) can pass while the effective supply used for distribution is zero, for example through restriction, pause or blocklist flags on holders. A positive result is a reachable state where the first check passes and the second returns zero.
  3. Trace early returns that occur after external transfers or state changes. A positive result is a return that leaves value or accounting behind rather than reverting.
  4. Review distribution and reward-claiming loops for the same pattern: transfer first, eligibility check second. A positive result is any branch where funds land in the contract with no path that pays them out.

Hunting notes

This class of bug hides in pairs of functions that are meant to behave identically but were written at different times or by different hands. During review, diff the guard order of every x and xWithLimit style pair, and of any function that both moves tokens and filters recipients. To diff means to compare two pieces of code side by side to spot differences.

The signal is a check on a broad quantity (totalSupply()) followed later by a check on a narrower one (effectiveTotalSupply), with a transfer in between. Broad means it counts everything; narrow means it counts only the part that matters for the payout.

The report ties the stranded tokens to a state where all holders are yield-restricted and contrasts the behaviour with the guarded sibling function. No exploit transaction or monetary figure is given, which is consistent with the low severity assigned.

Glossary

  • Blockchain: a shared record book kept by many computers, where entries are hard to change once written.
  • Smart contract: a program stored on a blockchain that runs automatically when someone calls one of its functions.
  • Function: a named action inside a program, like a button you can press.
  • Token: a digital voucher with a balance, tracked by a smart contract.
  • ERC-20: a common standard that defines the basic functions a token must have so wallets and exchanges can use it.
  • Yield: a payout of profit to token holders, similar to a dividend.
  • Yield-restricted: an account that is not allowed to receive yield, for example for compliance reasons.
  • Repository: an online folder that stores code and its history.
  • Commit: a saved snapshot of a repository, identified by a long string of letters and numbers.
  • State: the current values stored inside a contract, such as balances.
  • State-changing operation: an action that alters stored values, such as moving tokens.
  • totalSupply(): the total number of tokens that exist.
  • effectiveTotalSupply: the part of the total supply that counts for yield distribution, leaving out restricted holders.
  • Guard: a check that decides whether the code is allowed to continue.
  • Revert: to cancel an operation and undo any changes made during it.
  • Return early: to stop and exit a function before reaching the end of its code.
  • Unwind: to reverse changes already made.
  • Proof of concept: a set of steps that demonstrates a bug really happens.
  • Payload: the actual data sent to a system to trigger a bug.
  • Severity: how serious a bug is judged to be, based on damage and ease of triggering.
  • Attacker-controlled: a situation an outside person can deliberately cause.
  • Mitigation: a change that reduces a problem.
  • Non-exhaustive: a list that is not claimed to be complete.
  • Diff: to compare two pieces of code side by side to spot differences.
  • Test environment: a safe copy of a blockchain where you can try things without spending real money.
  • Toolchain: the set of programs used to build and test code.
  • Fork block: a specific point in a blockchain's history that a test copy is taken from.
  • Deployed address: the location where a contract lives on a live network.

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.