Skip to content
Business logic Audit finding Beginner

Incorrect yield distribution event emission

The contract emits a YieldDistributed event with the total amount taken from the distributor, not the amount actually transferred to holders. When integer division rounds shares to zero, the event claims tokens were distributed even though none were sent, which could mislead off-chain monitoring systems.

TheCarrot Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

52303 sc insight incorrect yield distribution event emission

Submitted on Aug 9th 2025 at 16:03:03 UTC by @TheCarrot for Attackathon | Plume Network

Description

Brief/Intro

In distributeYieldWithLimit the contract emits YieldDistributed(totalAmount, yieldTokenAddr) when nextIndex == 0. However, the function actually transfers amountDistributed (which can be < totalAmount due to integer-division rounding or restricted holders). The event therefore can report an amount that was not actually sent.

Vulnerability Details

Inside distributeYieldWithLimit the code accumulates amountDistributed as it transfers per-holder shares:

Solidity
uint256 share = (totalAmount * holderBalance) / effectiveTotalSupply;
if (share > 0) {
    yToken.safeTransfer(holder, share);
    amountDistributed += share;
}
...
if (nextIndex == 0) {
    emit YieldDistributed(totalAmount, yieldTokenAddr); // <-- incorrect
}

The bug: the emitted event uses totalAmount (the amount taken from the distributor at the start of a distribution run) rather than amountDistributed (the sum of actual transfers performed). When rounding (integer division) or restricted accounts reduce or zero-out per-holder shares, amountDistributed can be strictly less than totalAmount, producing a discrepancy between the event and on-chain token movements.

Impact Details

  • Emits incorrect distributed amount in final batch
  • Creates discrepancy between actual transfers and event logs
  • May mislead off-chain monitoring systems

References

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

Proof of Concept

A step-by-step reproducible scenario showing the mismatch between event and actual transfers:

{% stepper %} {% step %}

Setup test tokens

  • Deploy a simple ERC20 test token YieldToken and mint 1 unit to the distributor address D.
  • Ensure D has approved the ArcToken contract to spend 1 YieldToken (approve ArcToken for 1). {% endstep %}

{% step %}

Setup ArcToken holders

  • Ensure the ArcToken contract has two holders H1 and H2 recorded in its holders set, each with ArcToken balances of 1 token (so balanceOf(H1) = 1 and balanceOf(H2) = 1).
  • Ensure H1 and H2 are eligible for yield calculation (i.e., not both restricted) so that effectiveTotalSupply = 2. {% endstep %}

{% step %}

Ensure distributor role

  • Give D the YIELD_DISTRIBUTOR_ROLE on the ArcToken contract. {% endstep %}

{% step %}

Call the function

From D, call:

JavaScript
distributeYieldWithLimit(1 /* totalAmount */, 0 /* startIndex */, 2 /* maxHolders */)

{% endstep %}

{% step %}

Observe execution behavior

  • At function start (because startIndex == 0) the contract executes yToken.safeTransferFrom(D, address(this), 1), contract now holds 1 YieldToken.
  • For each holder: compute share = (totalAmount * holderBalance) / effectiveTotalSupply. Here share = (1 * 1) / 2 = 0 due to integer division truncation. Therefore neither holder receives any YieldToken and amountDistributed remains 0. {% endstep %}

{% step %}

Event vs reality

  • Because nextIndex == 0 (we processed all holders in the single batch), the contract emits:
Solidity
YieldDistributed(1, yieldTokenAddr)

which claims 1 was distributed.

  • But in reality amountDistributed == 0 and no safeTransfer calls were made to H1 or H2. The contract balance remains 1 YieldToken. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by TheCarrot. 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 event emission uses the input totalAmount instead of the accumulated amountDistributed, so rounding or restricted holders can make the logged amount exceed the actual transfers.

Impact

Off-chain monitoring systems may be misled because the event reports a distributed amount that does not match the actual token transfers, though no funds are lost.

What the attacker needed

Distributor holds YIELD_DISTRIBUTOR_ROLE; at least two eligible holders; integer division rounds shares to zero

How it was found

  1. Deploy a test ERC20 yield token and mint one unit to a distributor address that has approved the ArcToken contract.
  2. Ensure the ArcToken contract has two holders with equal balances and that both are eligible for yield.
  3. Give the distributor address the YIELD_DISTRIBUTOR_ROLE.
  4. Call distributeYieldWithLimit with totalAmount 1, startIndex 0 and maxHolders 2.
  5. Observe that each holder's share rounds down to zero, so no tokens are transferred and amountDistributed stays zero.
  6. Observe that the contract still emits YieldDistributed with the total amount of 1.

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 smart contract sends out yield payments and logs an event to say how much was paid. The log uses the total amount collected from the distributor, not the sum of what each holder actually received. When rounding makes each holder's share zero, the log still says a payment happened, so anyone watching the log is told something untrue.

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 TheCarrot

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.