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.
- 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
- Report ID: #52303
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcToken.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
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:
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
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
YieldTokenand mint 1 unit to the distributor addressD. - Ensure
Dhas approved the ArcToken contract to spend 1YieldToken(approveArcTokenfor 1). {% endstep %}
{% step %}
Setup ArcToken holders
- Ensure the ArcToken contract has two holders
H1andH2recorded in itsholdersset, each with ArcToken balances of1token (sobalanceOf(H1) = 1andbalanceOf(H2) = 1). - Ensure
H1andH2are eligible for yield calculation (i.e., not both restricted) so thateffectiveTotalSupply = 2. {% endstep %}
{% step %}
Ensure distributor role
- Give
DtheYIELD_DISTRIBUTOR_ROLEon the ArcToken contract. {% endstep %}
{% step %}
Call the function
From D, call:
distributeYieldWithLimit(1 /* totalAmount */, 0 /* startIndex */, 2 /* maxHolders */)
{% endstep %}
{% step %}
Observe execution behavior
- At function start (because
startIndex == 0) the contract executesyToken.safeTransferFrom(D, address(this), 1), contract now holds 1YieldToken. - For each holder: compute
share = (totalAmount * holderBalance) / effectiveTotalSupply. Hereshare = (1 * 1) / 2 = 0due to integer division truncation. Therefore neither holder receives anyYieldTokenandamountDistributedremains 0. {% endstep %}
{% step %}
Event vs reality
- Because
nextIndex == 0(we processed all holders in the single batch), the contract emits:
YieldDistributed(1, yieldTokenAddr)
which claims 1 was distributed.
- But in reality
amountDistributed == 0and nosafeTransfercalls were made toH1orH2. The contract balance remains 1YieldToken. {% endstep %} {% endstepper %}
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
- Deploy a test ERC20 yield token and mint one unit to a distributor address that has approved the ArcToken contract.
- Ensure the ArcToken contract has two holders with equal balances and that both are eligible for yield.
- Give the distributor address the YIELD_DISTRIBUTOR_ROLE.
- Call distributeYieldWithLimit with totalAmount 1, startIndex 0 and maxHolders 2.
- Observe that each holder's share rounds down to zero, so no tokens are transferred and amountDistributed stays zero.
- 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.