57850 sc medium by transferring his staking shares to another non staking address allowing him to bypass minstakeperiod
Submitted on Oct 29th 2025 at 08:06:33 UTC by @Oxlookman for Audit Comp | Belong
Report ID: #57850
Report Type: Smart Contract
Report severity: Medium
Target: https://github.com/immunefi-team/audit-comp-belong/blob/main/contracts/v2/periphery/Staking.sol
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief / Intro
An emergency-withdrawing staker can transfer their staking shares to another address and emergency withdraw (redeem) those shares from that other address, which keeps the original staker's stakes mapping and timestamps intact while the actual staked assets have been removed. This allows bypassing the intended minStakePeriod restrictions.
Vulnerability Details
Staker timestamps and stake shares are tracked in the stakers mapping:
mapping(address staker => Stake[] times) public stakes;This mapping is used to enforce minStakePeriod (preventing withdrawal for a period or incurring penalty). However, because staking shares are a standard ERC20 token, a staker can transfer their shares to another address before performing an emergency withdrawal. When the recipient address calls emergencyWithdraw, the recipient's stakes array may be empty, and internal helpers such as _removeAnySharesFor will simply return early (no adjustments to the sender's stakes array happen):
Because the original staker's stakes array is untouched, their timestamps remain as if the assets are still staked. If the original staker deposits the same amount again later, they can normally withdraw immediately (or without penalty) even though they have not actually respected the minStakePeriod.
Impact Details
All deposited assets are intended to be withdrawable only after minStakePeriod or, if withdrawn earlier via emergency withdraw, to incur a penalty. This vulnerability allows bypassing minStakePeriod, meaning:
The protocol can lose fee/penalty revenue.
The intent of
minStakePeriod(e.g., preventing MEV or protecting protocol stability) is bypassed.Griefing is possible: attackers can manipulate staking timestamps/state to advantage or to harm other users/ the protocol.
Reference
Source lines demonstrating relevant logic: https://github.com/immunefi-team/audit-comp-belong/blob/a17f775dcc4c125704ce85d4e18b744daece65af/contracts/v2/periphery/Staking.sol#L300C9-L314C10
Proof of Concept
Add this to the staking test file (the staking features describe test) and run on a localhost anvil node.
Notes
The PoC demonstrates the sequence: deposit → transfer shares to another address → emergency withdraw from recipient → original account appears to still have staked timestamps → re-deposit and immediate (forbidden) withdraw.
This allows bypassing minStakePeriod enforcement and penalties.
Suggested mitigation ideas (not exhaustive)
Tie stake accounting (timestamps & shares) to ownership of staking shares rather than to separate mappings that can be desynchronized by token transfers.
Prevent transferability of staking shares while they are associated with active stake entries, or make emergencyWithdraw and share transfers update/clear the relevant stake entries consistently.
Ensure any transfer of staking tokens updates the
stakesmapping for sender and recipient to reflect the moved shares and preserves minStakePeriod semantics.
Was this helpful?