Skip to content
Business logic Audit finding Intermediate

Incorrect Boundary Check in _claimableDelegationPeriods Allows Claiming Rewards Beyond Delegation End Period

A boundary check in the Stargate contract's claimable-periods function used a strict greater-than comparison, so when a delegation's end period equalled the next claimable period the exit branch was skipped. An exited delegator could then claim VTHO rewards for periods after their delegation ended, taking yield owed to active delegators.

Oxodus Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

60310 sc high incorrect boundary check in claimabledelegationperiods allows claiming rewards beyond delegation end period

Submitted on Nov 21st 2025 at 08:40:23 UTC by @Oxodus for Audit Comp | Vechain | Stargate Hayabusa

Description

Brief/Intro

The _claimableDelegationPeriods function in the Stargate contract contains an incorrect boundary check (endPeriod > nextClaimablePeriod) that should use >= instead of >. This logic flaw allows delegators to claim rewards for periods beyond their delegation's end period when endPeriod equals nextClaimablePeriod, potentially claiming rewards they are not entitled to and draining rewards that should belong to other delegators or future periods.

Vulnerability Details

In the _claimableDelegationPeriods function lines 916-922 , the condition checking if a delegation has ended uses a strict greater than operator:

Solidity
if (
    endPeriod != type(uint32).max &&
    endPeriod < currentValidatorPeriod &&
    endPeriod > nextClaimablePeriod  // @audit should be >=
) {
    return (nextClaimablePeriod, endPeriod);
}

The issue arises when endPeriod equals nextClaimablePeriod. In this case:

  • The condition endPeriod > nextClaimablePeriod evaluates to false
  • The function bypasses this branch and falls through to the next condition
  • It returns (nextClaimablePeriod, completedPeriods) instead of (nextClaimablePeriod, endPeriod)
  • This allows the delegator to claim rewards up to completedPeriods, which can be significantly greater than endPeriod

The correct logic should recognize that when endPeriod >= nextClaimablePeriod, there are still claimable periods from nextClaimablePeriod up to and including endPeriod. The current implementation incorrectly excludes the edge case where they are equal.

Impact Details

1. Protocol Insolvency

The Stargate contract holds VTHO rewards to distribute to delegators based on their participation in completed periods. When exited delegators fraudulently claim rewards for periods they didn't participate in, they drain VTHO from the contract that should be reserved for legitimate claimants. If multiple delegators exploit this vulnerability across different validators and time periods, the cumulative theft can exceed the contract's VTHO balance. This leaves the protocol insolvent, resulting in a direct loss of funds for legitimate users.

2. Theft of Unclaimed Yield

Exited delegators can claim VTHO rewards for periods 7, 8, 9, etc., even though their delegation ended at period 6. These rewards rightfully belong to delegators who were actively staking during those periods. By exploiting the boundary check flaw, malicious actors directly steal yield that was earned by the effective stake of legitimate active delegators on the validator during post exit periods.

References

https://github.com/vechain/stargate-contracts/blob/jose/update-contracts-to-hayabusa/packages/contracts/contracts/Stargate.sol#L916

Proof of Concept

Proof of Concept

Taking a scenario whereby:

  • A delegator has lastClaimedPeriod[tokenId] = 5, making nextClaimablePeriod = 6
  • The delegation was requested to exit and ended at endPeriod = 6
  • The validator is still active with completedPeriods = 9 (current period = 10) The protocol will behave as follows while checking for claimable rewards
  1. Function enters the exit check:

    Solidity
    endPeriod (6) != type(uint32).max ✓
    endPeriod (6) < currentValidatorPeriod (10) ✓
    endPeriod (6) > nextClaimablePeriod (6) ✗ FALSE
    
  2. Condition fails, function continues to next branch:

    Solidity
    nextClaimablePeriod (6) < currentValidatorPeriod (10) ✓
    
  3. Function returns (6, 9) instead of (6, 6)

  4. The delegator can now claim rewards for periods 6, 7, 8, and 9 via _claimRewards:

    Solidity
    // Loop iterates from period 6 to 9 (inclusive)
    for (uint32 period = 6; period <= 9; period++) {
        claimableAmount += _claimableRewardsForPeriod($, _tokenId, period);
    }
    
  5. After claiming, lastClaimedPeriod[tokenId] is set to 9, permanently encoding the incorrect state.

The original report as published on Immunefi, by Oxodus. 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

Likely the exit check used a strict greater-than comparison instead of greater-than-or-equal, so the case where the end period equals the next claimable period fell through to the general branch and returned a later upper bound.

Impact

Exited delegators could claim VTHO rewards for periods after their delegation ended, and cumulative exploitation across validators and periods could drain the contract's balance and leave it insolvent.

What the attacker needed

An existing delegation that has exited; validator still active after exit

The fix

The comparison should be changed to greater-than-or-equal so the exit branch is taken when the end period equals the next claimable period.

How it was found

  1. Set up a delegation whose last claimed period is 5, so the next claimable period is 6, and whose delegation ended at period 6.
  2. Have the validator still active with completed periods up to 9 and a current period of 10.
  3. Observe that the exit check fails because the end period is not strictly greater than the next claimable period.
  4. The function returns the next claimable period and the completed periods instead of stopping at the end period.
  5. Claim rewards for periods 6 through 9, after which the last claimed period is recorded as 9.

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 pays out rewards for each staking period. It is supposed to stop paying once a person's delegation has ended. A small mistake in a comparison meant that in one exact case the contract kept paying for later periods, so the person could take rewards that belonged to others.

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 Oxodus

View all

5 more disclosed reports, best first.

More from Vechain | Stargate Hayabusa

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.