57848 sc medium permanent freezing of funds due to no minimum stake limit

Submitted on Oct 29th 2025 at 07:49:03 UTC by @KalyanSingh for Audit Comp | Belongarrow-up-right

  • Report ID: #57848

  • Report Type: Smart Contract

  • Report severity: Medium

  • Target: https://github.com/immunefi-team/audit-comp-belong/blob/main/contracts/v2/periphery/Staking.sol

  • Impacts:

    • Permanent freezing of funds

Description

Brief / Intro

A user's stakes data is stored in:

mapping(address staker => Stake[] times) public stakes;

But due to no minimum stake requirement in _deposit()arrow-up-right, an attacker can fill up a target user's array of stakes with dust values. This can result in an OOG (out-of-gas) revert.

Vulnerability Details

When deployed on an EVM chain with a ~100M gas block limit (e.g., BSC/BNB), an attacker can perform ~40k 1-wei deposits to populate a victim's stakes array. After this, the victim may not be able to withdraw their full amount because withdrawal logic iterates sequentially over the stakes array and can hit OOG.

Assume the following scenario:

1

Scenario — Step 1

Alice is a DCA staker on BelongNet and stakes tokens daily (Alice could be a large entity or an automated smart contract).

2

Scenario — Step 2

Bob is a malicious actor who wants to freeze Alice's funds.

3

Scenario — Step 3

Bob performs ~40k deposit transactions in the staking contract with the recipient set to Alice, which triggers:

4

Scenario — Step 4

These ~40k transactions fill Alice's stakes array with ~40k 1-wei entries.

5

Scenario — Step 5

When Alice tries to withdraw, _consumeUnlockedSharesOrRevert parses all stake entries sequentially (see code: https://github.com/belongnet/checkin-contracts/blob/22d92a3af433a1cf4d0aa758f872c887b2f33db8/contracts/v2/periphery/Staking.sol#L258C14-L287), which can lead to OOG even with a 100M gas limit.

Estimated attacker cost to perform ~40k 1-wei deposits is approximately USD 150–200 (as provided by reporter). After this, Alice's withdrawal transactions will be hit with OOG errors, resulting in stuck funds.

Impact Details

triangle-exclamation

References

This is a classic example of DoS by array traversal.

Proof of Concept

chevron-rightForge test PoC (expand to view)hashtag

Notes from reporter:

  • Add imports remappings:

    • @openzeppelin/community-contracts/=lib/openzeppelin-community-contracts/contracts/

    • @openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/

    • @openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/

  • You may need to install OpenZeppelin contracts & upgradeable contracts for forge.

Run the test under test/ with:

Was this helpful?