Skip to content
Smart contracts Audit finding Advanced

Attacker Can Desynchronize Supply Snapshot During Same-Block Unstake, Reducing Everyone’s Rewards

An attacker can unstake in the same block as the manager's reward snapshot, causing the recorded total supply to remain pre-burn while the attacker's balance is read post-burn. This desynchronisation makes reward shares sum to less than one, reducing payouts for all stakers in that cycle.

maxzuvex Follow with 0xAlix2 and TheSchnilch

Originally disclosed on Code4rena

Submitted by maxzuvex, also found by 0xAlix2 and TheSchnilch

https://github.com/code-423n4/2025-04-cabal/blob/5b5f92ab4f95e5f9f405bbfa252860472d164705/sources/cabal_token.move#L219-L227

Finding description and impact

An attacker holding Cabal LSTs (like sxINIT) can monitor the mempool for the manager’s voting_reward::snapshot() transaction. By submitting his own cabal::initiate_unstake transaction to execute in the same block (H) as the manager’s snapshot, the attacker can use two flaws:

  1. cabal_token::burn (called by their unstake) doesn’t update the supply snapshot for block H, leaving the recorded supply artificially high (pre-burn).
  2. cabal_token::check_snapshot skips recording the attacker’s own balance for block H. Later reward calculations use the stale high supply but retrieve the attacker’s now lower (post-burn) balance via fallback logic. This desynchronization causes the total calculated reward shares to be less than 100%, reducing the rewards paid out to all users for that cycle.

Attacker Exploit:

  1. Manager Snapshots Supply: voting_reward::snapshot triggers cabal_token::snapshot, recording the LST total supply (S₀) for block H.
  2. User Unstakes (Same Block H): The user calls cabal::initiate_unstake.
  3. Internally, cabal_token::check_snapshot is called but skips writing the user’s pre-burn balance for block H due to same-block logic.
  4. The user’s live balance decreases.
  5. cabal_token::burn executes, reducing the live supply, but fails to update the recorded supply snapshot for H (which remains S₀).
  6. Reward Calculation Uses Inconsistent State: Later, rewards for cycle H are calculated:
  7. get_snapshot_supply(H) returns the stale, pre-burn S₀.
  8. get_snapshot_balance(user, H) finds no user snapshot for H and falls back, returning the user’s live, post-burn balance.
  9. Result: The reward share calculation uses post_burn_balance / pre_burn_supply, causing the sum of all shares to be < 1, thus reducing payouts for everyone. An attacker triggers this by ensuring their initiate_unstake executes in the same block as the manager’s snapshot (e.g., via mempool monitoring).
// 1. In `cabal_token::burn` (called by attacker's `initiate_unstake` in block H)
public fun burn(burn_cap: &BurnCapability, fa: FungibleAsset) acquires ManagingRefs, HolderStore, ModuleStore { // Added missing acquires for context
    let metadata = burn_cap.metadata;
    let metadata_addr = object::object_address(&metadata);
    assert!(exists<ManagingRefs>(metadata_addr), EMANAGING_REFS_NOT_FOUND);
    let refs = borrow_global<ManagingRefs>(metadata_addr);

    // Burn reduces the LIVE supply
    fungible_asset::burn(&refs.burn_ref, fa);

    // --- VULNERABILITY PART 1 ---
    // ATTACKER EXPLOIT: This function is called in block H AFTER cabal_token::snapshot recorded
    // the supply. However, UNLIKE mint_to, this function DOES NOT check if it's the snapshot
    // block and DOES NOT update the HolderStore::supply_snapshots table for block H.
    // The recorded supply for H remains the stale, pre-burn value (S₀).
    /* Missing logic similar to mint_to:
        if (is_snapshot_block) {
            update supply_snapshots table with new (lower) supply S₁;
        }
    */
}

// 2. In `cabal_token::check_snapshot` (called during attacker's unstake in block H)
fun check_snapshot(c_balance: &mut CabalBalance, current_snapshot_block: u64, prev_snapshot_block: Option<u64>) {
    let current_block_height = block::get_current_block_height(); // Is H
    let snapshot_block = current_snapshot_block; // is H

    // --- VULNERABILITY PART 2 ---
    if (current_block_height == current_snapshot_block) { // TRUE (H == H)
        // ATTACKER EXPLOIT: This condition is met.The logic inside prevents writing
        // the attacker's PRE-BURN balance to their personal snapshot table for block H.
        if (option::is_none(&prev_snapshot_block)) {
            return; // Early return, no write for H
        };
        // Tries to write for Previous_H instead, still no write for H
        snapshot_block = option::extract(&mut prev_snapshot_block);
    };

    // The code path that writes `table::add(&mut c_balance.snapshot, key, c_balance.balance)`
    // requires `current_block_height > snapshot_block`, which is FALSE here.
    // RESULT: Attacker's balance for H is NOT recorded.
}

// 3. In `cabal_token::get_snapshot_balance_internal` (called during reward calculation for block H)
    fun get_snapshot_balance_internal(cabal_balance: &CabalBalance, block_height: u64): u64 { // block_height is H
    // ... start_block check ...

    // Search attacker's personal table for entry >= H
    let key = table_key::encode_u64(block_height);
    let iter = table::iter(&cabal_balance.snapshot, option::some(key), option::none(), 2);

    // --- VULNERABILITY PART 3 ---
    // Because the write was skipped (Vuln Part 2), no entry >= H is found for the attacker.
    if (!table::prepare<vector<u8>, u64>(iter)) {
        // ATTACKER EXPLOIT: Fallback logic returns the attacker's LIVE balance.
        // At this point (reward calculation time), the live balance is the POST-BURN balance.
        return cabal_balance.balance;
    };

    // This part is not reached for the attacker in this scenario
    let (_, balance) = table::next(iter);
    *balance
}

Impact:

  • Invariant violation The attack breaks the core guarantee Σ balances_H = supply_H. Because the attacker’s balance is recorded after the burn while the supply is recorded before, the numerator shrinks but the denominator stays high.
  • Universal reward loss Reward shares now sum to < 1, so the bribe contract distributes fewer tokens than were deposited. Every honest staker at snapshot H loses part of their yield; the missing amount remains stranded in the pool.
  • Direct leverage for the attacker An exiting holder gives up only their own one‑cycle reward while slashing everyone else’s payout by the same absolute amount. They can repeat the manoeuvre each epoch—or threaten to—creating a zero‑cost grief / extortion vector.
  • Compromise of a core protocol function Fair, supply‑proportional bribe distribution is a primary feature of Cabal. Desynchronising balances and supply corrupts that mechanism, undermining trust in the staking programme.
  • Irreversible cycle corruption Once the snapshot for block H is polluted, the mis‑distribution for that cycle is permanent. users cannot reclaim the lost bribes without an invasive state migration.

Recommended mitigation steps

  1. Add Supply Update to burn: Modify cabal_token::burn to check if it’s executing in the same block as a snapshot. If so, update the supply_snapshots table for that block height with the new, lower supply after the burn, mirroring the logic in cabal_token::mint_to.
  2. Fix check_snapshot: Ensure check_snapshot always writes the user’s pre-interaction balance for the current snapshot block H when needed, removing the logic that skips this write during same-block interactions.

The original report as published on Code4rena, by maxzuvex. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 burn function does not update the supply snapshot for the current block, and the balance snapshot function skips writing the user's balance for the same block, so reward calculation mixes a pre-burn supply with a post-burn balance.

Impact

Every honest staker at snapshot H loses part of their yield, and the missing amount remains stranded in the pool; the attacker can repeat this each epoch, creating a zero-cost griefing or extortion vector.

What the attacker needed

Attacker holds Cabal LSTs; ability to submit transaction in same block; mempool monitoring

The fix

The burn function should update the supply snapshot for the current block after burning, and the balance snapshot check should always write the user's pre-interaction balance for the current snapshot block.

How it was found

  1. The manager's snapshot transaction records the total supply for block H.
  2. The attacker submits an unstake transaction to execute in the same block H.
  3. The balance snapshot check skips writing the attacker's pre-burn balance for block H.
  4. The burn reduces the live supply but does not update the recorded supply snapshot for block H.
  5. During reward calculation, the stale pre-burn supply is used with the attacker's post-burn live balance, reducing all reward shares.

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 snapshot is a record of everyone's token balances and the total supply at a specific moment, used later to share out rewards fairly. The attacker unstakes at the exact same moment as the snapshot, so the total supply is recorded before their tokens are burned but their personal balance is read after, making the reward maths inconsistent. As a result, everyone gets a smaller share of the rewards for that period.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by maxzuvex

View all

2 more disclosed reports, best first.

More from Cabal Liquid Staking Token

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.