Skip to content
Business logic Audit finding Advanced

Desynchronization of Cabal’s internal accounting with actual staked INIT amounts leads to over-minting of sxINIT tokens

The reward-compounding function in Cabal's liquid staking contract adds claimed rewards to its internal staked-amount record without checking the real amount staked in the underlying Initia staking system. If a slashing event reduces the real stake, the internal figure stays too high, so the exchange rate used to mint sxINIT is wrong and new stakers receive fewer sxINIT than their deposit is worth.

ChainSentry Follow with Afriauditor, givn and 1 other

Originally disclosed on Code4rena

Submitted by ChainSentry, also found by Afriauditor, givn, and maze

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

Summary

The Cabal Protocol’s implementation of compound_xinit_pool_rewards fails to synchronize the protocol’s internal accounting (m_store.staked_amounts) with the actual amount of INIT tokens staked in the underlying Initia staking system. This creates a vulnerability where external events like slashing penalties or validator-initiated actions that reduce the staked amount are not reflected in Cabal’s internal state. The reward compounding function simply adds claimed rewards to its internal tracking variable without verifying that this matches reality, creating a divergence between what Cabal thinks is staked and what actually is staked. When slashing occurs, users who stake xINIT will receive more sxINIT than they should based on the actual backing ratio. This leads to economic dilution of all sxINIT holders.

This issue is particularly concerning because it compounds over time - each slashing event that goes unaccounted for widens the gap between reported and actual values, eventually leading to significant economic damage for the protocol and its users.

Technical Explanation

The core issue lies in the compound_xinit_pool_rewards function in cabal.move, which is responsible for claiming staking rewards and updating the protocol’s internal state:

fun compound_xinit_pool_rewards(m_store: &mut ModuleStore, pool_index: u64) {
    let coin_metadata = coin::metadata(@initia_std, string::utf8(b"uinit"));
    let reward_fa = pool_router::withdraw_rewards(coin_metadata);
    let reward_amount = fungible_asset::amount(&reward_fa);

    if (reward_amount > 0) {
        // calculate fee amount
        let fee_ratio = bigdecimal::from_ratio_u64(m_store.xinit_stake_reward_fee_bps, BPS_BASE);
        let fee_amount = bigdecimal::mul_by_u64_truncate(fee_ratio, reward_amount);
        let fee_fa = fungible_asset::extract(&mut reward_fa, fee_amount);
        let rewards_remaining = reward_amount - fee_amount;
        primary_fungible_store::deposit(package::get_commission_fee_store_address(), fee_fa);

        m_store.stake_reward_amounts[pool_index] = m_store.stake_reward_amounts[pool_index] + rewards_remaining;
        pool_router::add_stake(reward_fa);

        // mint xINIT to pool
        m_store.staked_amounts[pool_index] = m_store.staked_amounts[pool_index] + rewards_remaining;
        coin::mint_to(&m_store.x_init_caps.mint_cap, package::get_assets_store_address(), rewards_remaining);
    } else {
        fungible_asset::destroy_zero(reward_fa);
    }
}

The issue occurs because this function:

  1. Claims rewards from the staking system via pool_router::withdraw_rewards
  2. Processes these rewards and restakes them via pool_router::add_stake
  3. Updates m_store.staked_amounts[pool_index] by simply adding the rewards amount
  4. Never verifies that this updated value matches the actual staked amount in the underlying system

However, the protocol has a function pool_router::get_real_total_stakes that does query the actual staked amount from the Initia staking system:

// From pool_router.move
pub fun get_real_total_stakes(metadata: Object<Metadata>): u64 {
    // Sum up all stake amounts from the underlying staking system
    let total_stakes: u64 = 0;
    /* ... */
    let pools = *simple_map::borrow(&router.token_pool_map, &metadata);

    for (i in 0..vector::length(&pools)) {
        let amount = if (metadata == utils::get_init_metadata()) {
            get_init_real_stakes(&pools[i])
        } else {
            get_lp_real_stakes(&pools[i])
        };
        total_stakes = total_stakes + amount;
    };

    total_stakes
}

This function is never called during reward compounding, leading to the desynchronization.

The following scenario demonstrates how this vulnerability can lead to over-minting of sxINIT tokens:

  1. Initial state:

    • 1,000,000,000 INIT staked in the Initia staking system
    • m_store.staked_amounts[0] = 1,000,000,000
    • Total sxINIT supply = 1,000,000,000
  2. A slashing event occurs in the Initia staking system, reducing the staked INIT by 5%:

    • Actual staked INIT = 950,000,000
    • m_store.staked_amounts[0] still = 1,000,000,000 (unchanged)
  3. Rewards of 50,000,000 INIT are claimed via compound_xinit_pool_rewards:

    • Function adds 50,000,000 to m_store.staked_amounts[0], making it 1,050,000,000
    • Actual staked INIT after adding rewards = 1,000,000,000 (950,000,000 + 50,000,000)
  4. User comes to stake 100,000,000 xINIT:

    • According to Cabal’s accounting: Exchange rate = 1,050,000,000 INIT / 1,000,000,000 sxINIT = 1.05
    • User should receive: 100,000,000 / 1.05 = 95,238,095 sxINIT
    • But the actual exchange rate should be: 1,000,000,000 INIT / 1,000,000,000 sxINIT = 1.0
    • User should actually receive: 100,000,000 / 1.0 = 100,000,000 sxINIT
  5. The discrepancy:

    • User receives 95,238,095 sxINIT
    • These tokens are backed by only 90,702,948 INIT (95,238,095 * 1,000,000,000 / 1,050,000,000)
    • This means the user has been short-changed by 4,761,905 INIT worth of backing

The issue becomes even more severe with multiple slashing events and/or larger stake amounts.

Impact

The impact of this vulnerability is significant and affects multiple areas:

  1. Violation of Core Protocol Invariants: The fundamental invariant 1 xINIT ≈ 1 INIT is broken. This undermines the entire economic model of the protocol as described in the documentation.

  2. Economic Dilution: When new users stake xINIT and receive sxINIT based on incorrect exchange rates, they get fewer tokens than they should. This effectively transfers value from new users to existing sxINIT holders.

  3. Systemic Risk: Each uncorrected slashing event compounds the problem. Over time, the divergence between tracked and actual amounts could become severe, potentially leading to:

    • Loss of user confidence in the protocol
    • Inability to properly value sxINIT tokens
    • Difficulty in integrating with other DeFi protocols due to unreliable pricing
  4. Unbonding Issues: When users try to unstake their sxINIT tokens, they might not receive the expected amount of xINIT back, leading to unexpected losses.

This issue affects all users of the Cabal Protocol, with the severity increasing over time as more slashing events occur without correction.

Recommended mitigation steps

Sync with Reality: Modify the compound_xinit_pool_rewards function to query the actual staked amounts after claiming rewards.


The original report as published on Code4rena, by ChainSentry. 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 compounding function updates the internal staked-amount counter by adding rewards but never reconciles it with the actual staked balance from the staking system, so any external reduction such as slashing is missed.

Impact

New stakers could receive fewer sxINIT than their deposit is worth, diluting them in favour of existing holders, and the gap may widen with each unaccounted slashing event, though the text gives no evidence of an exploit being run.

What the attacker needed

A slashing event on the underlying stake; users staking after the divergence

The fix

The compounding function should query the actual staked amounts after claiming rewards and reconcile its internal record with them.

How it was found

  1. Start from a state where the internal staked amount and the real staked amount both equal the total sxINIT supply.
  2. A slashing event reduces the real staked INIT, but the internal staked amount is left unchanged.
  3. Rewards are claimed through the compounding function, which adds them to the internal staked amount only.
  4. A user stakes xINIT and receives sxINIT at the inflated internal exchange rate, so they get fewer sxINIT than the real backing justifies.

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 liquid staking protocol keeps its own record of how many coins are staked and hands out receipt tokens based on that record. Here the record is only ever increased when rewards are added, and it is never compared with the real balance held by the outside staking system. If that real balance drops (for example because a validator is penalised, called slashing), the receipt tokens are no longer fully backed, and people who deposit afterwards get too few receipt tokens for their money.

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 ChainSentry

View all

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