59742 sc high user funds get stucked in the contract when validators exits

Submitted on Nov 15th 2025 at 12:18:00 UTC by @danvinci_20 for Audit Comp | Vechain | Stargate Hayabusaarrow-up-right

  • Report ID: #59742

  • 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

Description

Summary

The system decreases a user’s effective stake when they request a delegation exit and then decreases it again when they later call unstake() if the validator has already exited.

Because the validator is already in an exited state, the second decrease is performed using a later period index, causing _updatePeriodEffectiveStake() to underflow during:

updatedValue = currentValue - effectiveStake;

This results in a panic(0x11) arithmetic underflow, reverting unstake(). Since unstake() is the only mechanism for the user to retrieve their staked VET, the user’s funds become permanently stuck in the Stargate contract, with no recovery path.

Vulnerability Details

Relevant Code Paths

  • When requestDelegationExit() is called, the contract immediately reduces the user's effective stake:

  • Later, if the validator exits before the user calls unstake(), the unstake() function performs another decrease:

  • Inside _updatePeriodEffectiveStake the underflow occurs:

Because the second decrease subtracts the same effectiveStake from a smaller currentValue, the result becomes negative, causing a panic(0x11). This reverts the unstake() call entirely.

As a result, the user can never unstake or retrieve their VET, leaving their funds permanently stuck inside the Stargate contract.

Recommendation

circle-exclamation

Proof of Concept

chevron-rightTest showing the revert (add this test to Delegation.test.ts and run: yarn hardhat test --network vechain_solo test/integration/Delegation.test.ts)hashtag

Output observed:

Was this helpful?