Skip to content
Business logic Audit finding Intermediate

Unstaking calculates user share at request time, ignoring slashing — leading to DoS and unfair distribution

The unstaking flow calculates the claimable amount at request time rather than at claim time, so if the pool is slashed during the unbonding period, the precomputed amount may exceed the pool's actual holdings. This can cause a denial of service for large unstakers or allow early claimers to take full value while later users absorb the loss.

0xAlix2 Follow with adam-idarrha, givn and 2 others

Originally disclosed on Code4rena

Submitted by 0xAlix2, also found by adam-idarrha, givn, maxzuvex, and TheSchnilch

https://github.com/code-423n4/2025-04-cabal/blob/main/sources/cabal.move#L1075-L1080 https://github.com/code-423n4/2025-04-cabal/blob/main/sources/cabal.move#L1017-L1022

Finding Description and Impact

Users can stake both INIT and LP tokens into different validator pools by calling functions like deposit_init_for_xinit or stake_asset. To exit, users initiate an unstake via initiate_unstake, which starts an unbonding period. After this delay, they can claim their tokens through claim_unbonded_assets.

Behind the scenes, these staked assets are delegated to validators, and slashing may occur—meaning a portion of the delegated tokens could be penalized (burned). To stay accurate, the protocol uses pool_router::get_real_total_stakes to track the current delegated amount. However, the current unstaking flow doesn’t properly account for slashing events that may occur during the unbonding period.

When a user initiates an unstake, either process_lp_unstake or process_xinit_unstake is called. For simplicity, we focus on process_lp_unstake.

In process_lp_unstake, the claimable amount is calculated up front at unstake time:

let reward_amount = compound_lp_pool_rewards(m_store, unstaking_type);
let lp_amount = reward_amount + pool_router::get_real_total_stakes(...);
let cabal_lp_amount = option::extract(...);
let ratio = bigdecimal::from_ratio_u128(unstake_amount as u128, cabal_lp_amount);
let unbonding_amount = bigdecimal::mul_by_u64_truncate(ratio, lp_amount);
...
vector::push_back(&mut cabal_store.unbonding_entries, UnbondingEntry {
    ...
    amount: unbonding_amount,
    ...
});

Later, in claim_unbonded_assets, this precomputed amount is blindly transferred to the user:

primary_fungible_store::transfer(
    &package::get_assets_store_signer(),
    metadata,
    account_addr,
    amount // ← Precomputed at unstake time
);

This design introduces a critical flaw: it assumes the pool value remains constant between unstake and claim, which is not guaranteed. If slashing happens during this period:

  • A large user may claim more than the pool holds → DoS
  • An early user may claim full value post-slash → Other users absorb full loss

NB: This differs from systems like Lido, where the amount returned is computed at claim time based on the user’s share of the pool, ensuring fair slashing distribution.

Recommended Mitigation Steps

Instead of locking in the claimable amount at unstake time, store the user’s percentage share of the total LP supply. Then, during claim_unbonded_assets, recalculate the actual amount using the current pool value (i.e., post-slash).

This ensures slashing risk is shared proportionally among all stakers, and prevents DoS or overclaiming exploits.

Proof of Concept

Case 1 – Whale Unstakes 50%, Then Pool Is Slashed by 51%

Scenario:

  • Total pool value: 1,000 LP tokens
  • A whale holds 500 LP and unstakes it, expecting to claim 500 units
  • The remaining users hold the other 500 LP
  • Before the whale claims, the pool is slashed by 51%, reducing it to 490 units

Current behavior (problem):

  • The whale still tries to claim 500 units
  • The pool only has 490 units left → this would revert, fail, or break accounting
  • Essentially, the whale locks in a pre-slash value and now the pool can’t fulfill it

What should happen:

  • Claim should be recalculated at execution time
  • 500 LP × (490 / 1000) = 245 units
  • Whale gets 245 units, the rest of the pool reflects that slashing fairly across all holders

Case 2 – Early User Unstakes, Pool Slashed, Claims Full Amount

Scenario:

  • Pool has 1,000 LP total
  • User A holds 100 LP, unstakes and expects 100 units
  • User B holds 900 LP
  • A 50% slash hits before User A claims → pool is now worth 500 units

Current behavior (problem):

  • User A claims 100 units (based on original rate)
  • Only 400 units remain for User B’s 900 LP
  • That means User B absorbs the full impact of the slash — clearly unfair

What should happen:

  • Claim is based on current pool state
  • 100 LP × (500 / 1000) = 50 units
  • User A gets 50 units, User B’s 900 LP is worth 450 → everyone shares the slash proportionally

The original report as published on Code4rena, by 0xAlix2. 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

The claimable amount is fixed at unstake time using the pool value at that moment, instead of being recalculated from the user's share of the pool at claim time.

Impact

A large unstaker could cause a denial of service by claiming more than the pool holds, or an early claimer could take full pre-slash value while other users absorb the entire loss.

What the attacker needed

User has staked LP or INIT tokens; slashing occurs during unbonding period; user claims after the slash

The fix

The protocol should store the user's percentage share of the total LP supply at unstake time and recalculate the actual claimable amount using the current pool value when the user claims.

How it was found

  1. A user initiates an unstake, which records a fixed claimable amount based on the current pool value.
  2. Before the user claims, the pool is slashed, reducing the total delegated assets.
  3. The user calls claim_unbonded_assets, which transfers the precomputed amount without recalculating against the current pool value.

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.

When you unstake, the system writes down how many tokens you will get back later. If the pool loses value in the meantime (because a validator misbehaved and some tokens were burned), that written-down number can be too high. Then either the pool cannot pay you, or you get paid in full and everyone else gets less.

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.

More by 0xAlix2

View all

39 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.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.