60431 sc high unauthorized vtho reward claims after delegation exit

Submitted on Nov 22nd 2025 at 14:38:45 UTC by @Dliteofficial for Audit Comp | Vechain | Stargate Hayabusaarrow-up-right

  • Report ID: #60431

  • Report Type: Smart Contract

  • Report severity: High

  • Target: https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/tree/main/packages/contracts/contracts/Stargate.sol

  • Impacts:

    • Protocol insolvency

    • Theft of unclaimed yield

Description

Brief/Intro

A critical vulnerability in the _claimableDelegationPeriods() function allows users who have exited their delegation to continually claim VTHO rewards for periods occurring after their delegation has ended. When a user requests delegation exit, claims all rewards up to their endPeriod, and then waits for the validator to complete additional periods, the function incorrectly returns claimable periods extending beyond the endPeriod up to the current completedPeriods. This enables unauthorized reward extraction from the Stargate contract's VTHO reserves, potentially draining funds that should belong to active delegators or the protocol.

Vulnerability Details

The Stargate contract manages delegation rewards through a period-based system where users can stake VET, delegate to validators, and claim VTHO rewards proportional to their effective stake during active delegation periods. When users request to exit their delegation via requestDelegationExit(), the protocol sets an endPeriod marking when their delegation terminates. Users should only be able to claim rewards for periods up to and including this endPeriod.

The vulnerability exists in the _claimableDelegationPeriods() function of Stargate.sol. This function determines which periods a user can claim rewards for by returning a tuple (firstClaimablePeriod, lastClaimablePeriod). The function implements two main conditional branches:

The root cause lies in Condition 2. When a user has exited their delegation and claimed all rewards up to endPeriod, the following scenario occurs:

  1. User requests exit, setting endPeriod = completedPeriods + 1 (e.g., endPeriod = 11 when completedPeriods = 10)

  2. User claims all rewards up to endPeriod, setting lastClaimedPeriod[_tokenId] = endPeriod (e.g., 11)

  3. Time passes, validator completes more periods (e.g., completedPeriods advances to 50)

  4. User calls claimRewards() again, which invokes _claimableDelegationPeriods()

At this point:

  • nextClaimablePeriod = lastClaimedPeriod[_tokenId] + 1 = endPeriod + 1 (e.g., 12)

  • currentValidatorPeriod = completedPeriods + 1 (e.g., 51)

  • endPeriod < currentValidatorPeriod is true (11 < 51)

  • endPeriod > nextClaimablePeriod is false (11 > 12 is false)

Since Condition 1 fails (specifically, endPeriod > nextClaimablePeriod evaluates to false), execution falls through to Condition 2. Condition 2 only checks nextClaimablePeriod < currentValidatorPeriod without validating whether the delegation has exited or whether nextClaimablePeriod exceeds endPeriod. Consequently, it returns (endPeriod + 1, completedPeriods) (e.g., (12, 50)), allowing the user to claim rewards for periods 12 through 50, even though their delegation ended at period 11.

The _claimableRewardsForPeriod() function calculates rewards for a given period without validating that the period is within the delegation's active range (period <= endPeriod). It retrieves the validator's total rewards for that period and calculates the user's share based on their effective stake, which may still exist in the system's checkpoints even after exit. This enables the unauthorized reward calculation.

The _getDelegationStatus() function correctly identifies exited delegations when delegationEndPeriod < currentValidatorPeriod, but this status check is not utilized in _claimableDelegationPeriods() to prevent claims after exit.

Impact Details

Critical Impact - Unauthorized VTHO Extraction: Users who have exited their delegations can continually claim VTHO rewards for periods occurring after their delegation has ended as long as they do not unstake and remain in the EXITED delegation state. The severity increases with time, as the gap between endPeriod and completedPeriods grows, allowing extraction of rewards for an unbounded number of periods.

Financial Impact: The exploit allows draining VTHO from the Stargate contract that should belong to:

  • Active delegators who maintained their stake during those periods

  • The protocol's reward reserves

The maximum loss depends on:

  • The number of users who exit and exploit this vulnerability

  • The time elapsed between exit and exploitation (more time = more periods = more rewards)

  • The validator's reward generation rate during the exploited periods

https://gist.github.com/Dliteofficial/336c5d14121945cb74deae3af287cc54

Proof of Concept

Proof of Concept

Was this helpful?