Malicious user can steal yields when ArcToken.distributeYieldWithLimit is used.
The paginated yield distribution function calculates each holder's share using their current balance, but the holder list and balances can change between batches. An attacker with two addresses can move tokens between them after the first batch so that the second address also receives a large share, stealing yield from other holders.
Originally disclosed on Immunefi
- Disclosed after under an hour
51090 sc high malicious user can steal yields when arctoken distributeyieldwithlimit is used
Submitted on Jul 31st 2025 at 03:45:37 UTC by @jasonxiale for Attackathon | Plume Network
- Report ID: #51090
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcToken.sol
- Impacts:
- Theft of unclaimed yield
Description
Brief / Intro
In the current implementation, ArcToken.distributeYieldWithLimit is used for paginated distribution. There is a flaw in the function that can allow a malicious user to steal yields.
Vulnerability Details
- In ArcToken.distributeYieldWithLimit's implementation, the function calculates the
effectiveTotalSupplyin ArcToken.sol#L514, and distributes the yields based onbalanceOf(holder) / effectiveTotalSupplyin ArcToken.sol#L538-L545
466 function distributeYieldWithLimit(
467 uint256 totalAmount,
468 uint256 startIndex,
469 uint256 maxHolders
470 )
...
510 uint256 effectiveTotalSupply = 0;
511 for (uint256 i = 0; i < totalHolders; i++) {
512 address holder = $.holders.at(i);
513 if (_isYieldAllowed(holder)) {
514 effectiveTotalSupply += balanceOf(holder); <<<<<<<<<<<< calculate the `effectiveTotalSupply`
515 }
516 }
...
530 for (uint256 i = 0; i < batchSize; i++) {
531 uint256 holderIndex = startIndex + i;
532 address holder = $.holders.at(holderIndex);
533
534 if (!_isYieldAllowed(holder)) {
535 continue;
536 }
537
538 uint256 holderBalance = balanceOf(holder);
539 if (holderBalance > 0) {
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< distribute yields based on balanceOf(holder)
540 uint256 share = (totalAmount * holderBalance) / effectiveTotalSupply;
541 if (share > 0) {
542 yToken.safeTransfer(holder, share);
543 amountDistributed += share;
544 }
545 }
546 }
...
554 return (nextIndex, totalHolders, amountDistributed);
555 }
- ArcToken inherits from ERC20Upgradeable, so
transferandtransferFromare supported. - While
transferortransferFromis called, ArcToken._update will be called, and in its implementation there are a few issues:- Issue 1: The function doesn't check if
fromhas received the yields. - Issue 2: If the
toaddress is not in$.holders, the function will addtointo$.holders(ArcToken.sol#L701-L703).
- Issue 1: The function doesn't check if
Because of the calculation being based on the balances at the time of distribution but the holder list and balances can change between paginated distribution calls, a malicious user can manipulate balances and holder positions to receive more yield than deserved across distribution batches.
Impact Details
A malicious user can steal yields (receive more than their fair share across paginated distributions).
Proof of Concept
{% stepper %} {% step %}
Setup
- Attacker Alice controls two wallets: Addr1 and Addr2.
- Total ArcToken holders: 20.
- Addr1 is at
$.holders.at(1), Addr2 is at$.holders.at(11). - Alice controls X tokens split as:
- Addr1: (X - 1)
- Addr2: 1 wei {% endstep %}
{% step %}
Step 1 — First distribution (holders 0–10)
distributeYieldWithLimitis called for holders between indices 0–10.- effectiveTotalSupply is calculated using current balances.
- Addr1 receives yield proportional to (X - 1) / effectiveTotalSupply. {% endstep %}
{% step %}
Step 2 — Manipulate balances
- After receiving the yield, Alice transfers (X - 2) tokens from Addr1 to Addr2.
- Balances now:
- Addr1: 1 wei
- Addr2: (X - 1)
- Because _update may add Addr2 to the holders list if not present, and transfers changed balances after the first batch, the second batch's distribution calculation still used the earlier effectiveTotalSupply, or otherwise allows Addr2 to be paid based on the previous large balance allocation. {% endstep %}
{% step %}
Step 3 — Second distribution (holders 10–20)
distributeYieldWithLimitis called for holders between indices 10–20.- Addr2 receives yield proportional to (X - 1) / effectiveTotalSupply (the same large share).
- As a result, Alice's combined receipts across the two batches exceed the fair share; yield was effectively stolen. {% endstep %} {% endstepper %}
References
- ArcToken.sol distribution implementation: https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/arc/src/ArcToken.sol
(Links in the document point to the relevant lines in the referenced file.)
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 a holder list that can change between paginated calls, without snapshotting balances or preventing transfers during distribution.
Impact
A malicious user could steal yield by receiving more than their fair share across paginated distributions.
What the attacker needed
Attacker controls two addresses; attacker holds tokens before distribution; distribution is paginated
How it was found
- Attacker controls two addresses, one early in the holder list and one later, with most tokens in the first address.
- The first distribution batch runs and the first address receives yield based on its large balance.
- The attacker transfers most tokens from the first address to the second address.
- The second distribution batch runs and the second address receives yield based on its new large balance.
- The attacker's combined receipts exceed their fair share.
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 token contract pays out rewards to holders in several batches. The amount each holder gets is based on how many tokens they hold when their batch is processed. Because the attacker can move tokens between two wallets they control after the first batch, the second wallet also gets a large payout, so the attacker takes more than their fair share.
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.