Freezing of funds
The Staking vault inherits transferable ERC20 shares but keeps a separate internal record of each user's stakes that is not updated when shares are transferred. A recipient of transferred shares cannot withdraw normally and can only use the emergency path, which charges a penalty, so funds can be effectively frozen or lost.
Originally disclosed on Immunefi
- Disclosed after under an hour
56872 sc critical freezing of funds
Submitted on Oct 21st 2025 at 12:37:02 UTC by @shadowHunter for Audit Comp | Belong
- Report ID: #56872
- Report Type: Smart Contract
- Report severity: Critical
- Target: https://github.com/belongnet/checkin-contracts/blob/main/contracts/v2/periphery/Staking.sol
- Impacts:
- Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
- Permanent freezing of funds
Description
Brief/Intro
The Staking contract mints shares to represent users’ staked positions. These shares are freely transferable ERC20 tokens because of ERC4626 inheritance.
The vault tracks staked positions in the stakes[address] array to enforce:
- Minimum stake periods (
minStakePeriod) - Reward distribution (proportional to shares)
- Emergency withdrawal penalties
Transferring shares to another address does not update the internal stakes[] array, resulting in a permanent desync between the internal staking record and the transferable ERC20 shares.
{% stepper %} {% step %}
Vulnerability Details — sequence of actions
- Assume Alice and Bob are two users.
- Alice deposits 100
LONGtokens → receives 100sLONGshares. - Alice transfers 100
sLONGshares to Bob. - Bob now holds the shares but has no corresponding entries in
stakes[Bob]. - Bob attempts a normal withdraw → fails due to missing unlocked stake.
- Bob can only use
emergencyWithdraw→ receives 90% of assets, losing 10% as a penalty. {% endstep %}
{% step %}
Impact Details
- The new holder of transferred shares cannot withdraw normally — the vault sees no unlocked shares.
- Emergency withdrawal is the only recovery path, but it always imposes the configured penalty (10% by default).
- Users effectively lose access to their funds or pay a financial cost simply due to a transfer.
This can lead to permanent freezing of funds. {% endstep %} {% endstepper %}
Recommendation
Prevent permanent freezing by making shares non-transferable. For example:
{% hint style="info" %}
Override ERC20 transfer and transferFrom to revert so shares cannot be moved without updating the internal bookkeeping.
{% endhint %}
function transfer(address, uint256) public pure override returns (bool) {
revert("NON_TRANSFERABLE");
}
function transferFrom(address, address, uint256) public pure override returns (bool) {
revert("NON_TRANSFERABLE");
}
Proof of Concept
<details> <summary>Click to expand the full PoC test and observed output</summary>// SPDX-License-Identifier: MIT
pragma solidity 0.8.27;
import "forge-std/Test.sol";
import {Staking} from "../contracts/v2/periphery/Staking.sol";
import {LONG} from "../contracts/v2/tokens/LONG.sol";
import "openzeppelin-contracts/contracts/proxy/Clones.sol";
contract StakingTransferTest is Test {
Staking stakingImplementation;
Staking vault;
LONG token;
address owner = address(this);
address treasury = address(0xDEAD);
address alice = address(0xA11CE);
address bob = address(0xB0B);
function setUp() public {
// --- Deploy and initialize LONG ---
LONG longImpl = new LONG();
token = LONG(Clones.clone(address(longImpl)));
//token = new LONG();
token.initialize(alice, owner, owner); // initial supply to alice, owner/admin roles set
// --- Deploy Staking implementation ---
stakingImplementation = new Staking();
// --- Deploy a clone vault ---
vault = Staking(Clones.clone(address(stakingImplementation)));
// --- Initialize vault ---
vault.initialize(owner, treasury, address(token));
// --- Alice approves the vault ---
vm.startPrank(alice);
token.approve(address(vault), type(uint256).max);
vm.stopPrank();
}
/// @notice Helper to get stake array length for a user
function getStakeLength(address user) internal view returns (uint256 len) {
try vault.stakes(user, 0) returns (uint256, uint256) {
uint256 i = 0;
while (true) {
try vault.stakes(user, i) returns (uint256, uint256) {
unchecked { ++i; }
} catch {
break;
}
}
len = i;
} catch {
len = 0;
}
}
function testTransferBreaksStakeBookkeeping() public {
// Alice deposits
vm.startPrank(alice);
vault.deposit(100 ether, alice);
vm.stopPrank();
// Fast forward beyond minStakePeriod
vm.warp(block.timestamp + 2 days);
uint256 aliceShares = vault.balanceOf(alice);
assertGt(aliceShares, 0, "alice should have shares");
// Alice transfers all shares to Bob
vm.prank(alice);
vault.transfer(bob, aliceShares);
// Bob attempts to redeem shares (should fail: no unlocked stakes)
vm.prank(bob);
vm.expectRevert(); // MinStakePeriodNotMet
vault.redeem(aliceShares, bob, bob);
}
}
Observed output: As expected Redeem reverts (vm.expectRevert())
[PASS] testTransferBreaksStakeBookkeeping() (gas: 191754)
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the vault inherits transferable ERC20/ERC4626 share tokens while its staking bookkeeping in the stakes array is only written on deposit and withdraw, so transfers desynchronise the two.
Impact
A holder of transferred shares cannot withdraw normally and may lose part of the funds through the emergency penalty, which the report says can lead to permanent freezing of funds.
What the attacker needed
A staking vault with transferable shares; a user transfers shares to another address
The fix
The report recommends making the shares non-transferable by overriding the ERC20 transfer and transferFrom functions to revert.
How it was found
- Alice deposits tokens into the vault and receives shares.
- Alice transfers all her shares to Bob.
- Bob holds the shares but has no entry in the vault's stake record.
- Bob tries a normal withdrawal and it reverts.
- Bob can only use the emergency withdrawal, which applies the penalty.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A staking vault gives people tokens (shares) that represent what they deposited, and it also keeps its own list of who staked what. Those shares can be sent to someone else like normal tokens, but the vault's private list is not updated when that happens. The new holder is therefore not recognised as a staker and cannot take the money out the normal way, only through an emergency route that keeps a cut.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.