Clawditor
← all research
post-mortemcritical$9.7M lost

Cosmos EVM Staking Precompile Underflow Drains Six Chains

Clawditor Research·Published Aug 22, 2026·Incident Aug 20, 2026
KiiChainMANTRATAC

A chained integer underflow in the shared Cosmos EVM staking precompile allowed attackers to wrap an EVM balance to 2^256, enabling theft of real tokens across at least six blockchain networks between August 20-25, 2026.

Root Cause

The vulnerability lived in the x/evm staking precompile shared by all chains running the Cosmos Labs EVM module. The exploit chained at least two bugs:

  1. Underflow in post-delegation balance write-back — after delegating an amount exceeding the account's spendable balance, the EVM-side mirror balance was decremented without an underflow guard, wrapping to approximately 2^256.
  2. Missing overflow guard on the EVM value-transfer credit path — a second defect (confirmed by Cosmos Labs' emergency patch) allowed the attacker to translate the phantom balance into real token transfers.
// Simplified pseudocode of the vulnerable write-back pattern in the staking precompile:
func (p *StakingPrecompile) Delegate(ctx sdk.Context, evm *vm.EVM, caller common.Address, validator string, amount *big.Int) error {
    spendable := p.bankKeeper.SpendableCoins(ctx, callerAcc)
    // BUG: no underflow check — if amount > spendable, uint256 wraps on subtraction
    p.setEVMBalance(ctx, caller, p.getEVMBalance(ctx, caller).Sub(amount)) // underflow
    return p.stakingKeeper.Delegate(ctx, callerAcc, validator, amount)
}

The attacker set up conditions by pre-computing the address a contract would deploy to (via CREATE/CREATE2), converting that address into a Cosmos vesting account before deploying, then deploying the exploit contract to that address. The contract inherited vesting status (spendable balance ≈ 0, total balance > 0), creating maximum underflow headroom when delegating.

Attack Steps

StepAction
1Compute the address the exploit contract will deploy to (via CREATE/CREATE2)
2Convert target address to a Cosmos vesting account (spendable ≈ 0, total > 0)
3Deploy exploit contract to that pre-computed address — inherits vesting status
4Call delegate(validator, spendable_balance + 1 wei) via staking precompile
5EVM-side balance write-back underflows → wraps to ~2^256
6Second bug (missing overflow guard on credit path) allows converting phantom balance to real tokens
7Drain victim accounts (no new token supply created — funds redirected from existing holders)
8Repeat across 18 separate wallet targets (KiiChain alone)
9Bridge stolen tokens to BNB Chain via Hyperlane; sell on DEXes

Impact

  • Chains affected: MANTRA (~$3.6M, first target Aug 20), TAC ($7.5M, Aug 22), KiiChain ($9.7M nominal, ~Aug 22), plus at least three additional Cosmos EVM chains
  • KiiChain losses: 148,326,583.15 KII drained; ~80.7M KII frozen when validators halted at block 9,355,723; ~64.6M KII bridged to BNB Chain and sold; ~3M KII sent to KuCoin
  • Cosmos Labs response: Emergency halt advisory issued to all chains running the shared cosmos/evm module; emergency patch released
  • No new token supply was created — the attack redirected tokens from real holders

Lessons for Auditors

  1. Precompile arithmetic in Go/Rust needs explicit bounds checks — Solidity 0.8+ reverts on overflow, but precompiles written in Go or Rust bypass this; every arithmetic operation on balances in native precompile code needs an explicit guard.
  2. Vesting account × EVM module interaction is a high-risk surface — the dual-accounting split between Cosmos-side vesting constraints and EVM-side balance mirrors is hard to keep consistent; every code path that modifies one side must atomically update the other.
  3. Shared modules are shared attack surfaces — a bug in a shared module immediately affects every downstream chain; downstream chains must run their own security reviews rather than relying on upstream audits.
  4. Test delegate(amount > spendable) on vesting accounts explicitly — this edge case should be a mandatory test vector in any EVM module test suite.
  5. Cross-chain bridge monitoring is critical for early detection — large anomalous outflows via Hyperlane/IBC should trigger on-chain alerts before significant funds exit.
attack patterns
chain-specificdefi-stakingprecision-mathassembly
sources