60548 sc high an exited delegator who has not unstaked or delegated to a validator will be dos ed if a validator exits

Submitted on Nov 24th 2025 at 00:47:20 UTC by @HalalAudits for Audit Comp | Vechain | Stargate Hayabusaarrow-up-right

  • Report ID: #60548

  • 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:

    • Permanent freezing of funds

    • Temporary freezing of funds for at least 24 hour

Description

Brief/Intro

The checks in unstake and delegate will subtract a delegator's effective stake from the delegatorsEffectiveStake[_validator] if the delegation is still pending or the validator has exited.

An issue arises incase a delegator has exited and before unstaking or redelegating to a new validator, the validator also exits, which will lead to subtracting an already subtracted value leading to a panic due to underflow hence preventing the delegator from recovering their amount.

Vulnerability Details

Before unstaking or delegating to a new validator, a delegator must first call requestDelegationExit to show his exit intent and his effective stake is subtracted from the validtaor's delegatorsEffectiveStake[_validator] for the next period.

  • https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/blob/e9c0bc9b0f24dc0c44de273181d9a99aaf2c31b0/packages/contracts/contracts/Stargate.sol#L567C9-L568C101

  • https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/blob/e9c0bc9b0f24dc0c44de273181d9a99aaf2c31b0/packages/contracts/contracts/Stargate.sol#L993C5-L1013C6

But if this previous validator exits( which is possible since a validator can exit anytime) before the delegator unstakes or redelegates (a delegator is not given any period in which to unstake or redelegate so it can also be a longer period), the effectiveStake will be subtracted again from the validator's delegatorsEffectiveStake[_validator] due to these checks in unstake and delegate:

  • https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/blob/e9c0bc9b0f24dc0c44de273181d9a99aaf2c31b0/packages/contracts/contracts/Stargate.sol#L398C13-L414C14

As you can see in the above check will be true if the validator has exited regardless of whether the delegator had exited before the validator's exit hence guaranteeing a re-subtraction of the validator's delegatorsEffectiveStake[_validator].

Yet this amount was already subtracted in the call to requestDelegationExit before.

VulnerabiltyPath

  • Delegator A has delegated his stake to validator B, and he is the only delegator to this validator.

  • After sometime Delegator A wants to unstake so he calls requestDelegationExit.

  • But before Delegator A calls unstake, validator B also exits.

  • So when Delegator A tries to call unstake, the function just reverts with a panic due to underflow.

  • Delegator A will lose his funds forever if validator B does not become a validator again.

Impact Details

This will prevent users from being able to unstake or redelegate their funds due to the underflow panic hence a total loss of funds.

Some such exited delegators will be able to collect their funds if the funds are still huge but it will be inevitable for the last unstakers from this exited validator to lose their funds as with each unstake the delegatorsEffectiveStake[_validator] reduces upto the last one where it will underflow.

This can also be done by a malicious validator to prevent delegators from unstaking their funds.

References

  • https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/blob/e9c0bc9b0f24dc0c44de273181d9a99aaf2c31b0/packages/contracts/contracts/Stargate.sol#L398C13-L414C14

  • https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/blob/e9c0bc9b0f24dc0c44de273181d9a99aaf2c31b0/packages/contracts/contracts/Stargate.sol#L993C5-L1013C6

  • https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/blob/e9c0bc9b0f24dc0c44de273181d9a99aaf2c31b0/packages/contracts/contracts/Stargate.sol#L567C9-L568C101

Proof of Concept

Proof of Concept

Paste the test below and run yarn contracts:test:unit -- -- --grep "For an exited delegaotor, cannot unstake if validator exited"

Was this helpful?