# GHSA-C6XV-PPPP-RJW6: Staking claims can be replayed against NotBondedPool after contract self-destruction

- Database: GitHub
- Severity: high (stated by ghsa, no CVSS score)
- Published: 2026-11-02
- Modified: 2026-11-02

## Affected versions

- github.com/cosmos/evm (Go): fixed in 0.6.4
- github.com/cosmos/evm (Go): from 0.7.0, fixed in 0.7.4

## Description

## Summary

Cosmos EVM maps EVM contract addresses to Cosmos accounts and exposes native staking to EVM contracts through the staking precompile, including delegating and undelegating the bond denomination. When a contract self-destructs, the EVM `StateDB` commit deletes the underlying Cosmos auth account, but the staking state associated with that address — including unbonding delegations (UBDs) and their maturity-queue references — is stored independently and survives.

An unprivileged contract can exploit this to repeatedly debit the shared `NotBondedPool` module account without crediting anyone, effectively destroying the pooled funds that back honest users' unbonding claims. For a stale unbonding claim of `X`, an attacker can manufacture an arbitrary number of maturity-queue references to it and destroy up to the entire available `NotBondedPool` balance per cycle, leaving matured claims of ordinary users unpaid and the chain undercollateralized. The affected chain's SDK dependency contains the same queue and payout behavior, so the vulnerability depends only on permissionless contract deployment and the enabled staking precompile.

## Details

When a contract executes `SELFDESTRUCT`, the EVM `StateDB` commit calls the keeper's `DeleteAccount`, which removes the corresponding Cosmos auth account (`x/vm/keeper/statedb.go`). However, staking state — delegations, redelegations, and unbonding delegations (UBDs) — is stored independently of the auth account and is not deleted or invalidated. A contract can therefore use the staking precompile to undelegate and create a pending unbonding claim, then self-destruct in the same transaction, leaving a mature unbonding claim owned by a nonexistent account.

At the claim's maturity time, staking `EndBlock` iterates the mature UBD queue and calls `CompleteUnbonding`. Bank payout first debits the amount from the shared `NotBondedPool` module account and only afterward validates the recipient; because the recipient account no longer exists, the transfer fails. The UBD is only persisted as removed after all payments succeed, so on failure the mature claim remains in store. `EndBlock` swallows the error and continues, so the pool debit is committed while nobody is credited and no burn occurs — the coins vanish and `supply - sum(all bank balances)` increases accordingly.

The maturity queue stores only a delegator/validator pair, and undelegation inserts queue references without deduplication; cancelling an unbonding removes or reduces the UBD entry but not the queue reference. An attacker can therefore recreate the same contract address via `CREATE2`, generate an arbitrary number of queue references pointing at the stored stale claim through repeated undelegation/cancellation, and self-destruct again. Each mature reference triggers another payout attempt: each one debits `NotBondedPool` before failing on the missing account, replaying the same claim. For a claim of `X` with `N` references and available pool balance `P`, the batch destroys `X * min(N, floor(P / X))` — funds supplied by ordinary unbonding users, whose claims then go unpaid. The stale claim survives each cycle, so the attack is repeatable against future unbonding inflows, leaving the chain undercollateralized until bespoke state repair. A variant of the issue can also replay credited claims to steal pooled funds, and the depleted pool can additionally cause deterministic chain halts when later validator-set transitions require more funds than remain.

## Patches

The fix makes `DeleteAccount` refuse to delete a contract account that still holds any staking positions — delegations, redelegations, or unbonding delegations — before clearing its balance and removing the auth account. Self-destructing such a contract now returns an error, so no orphaned staking claim can be created.

- Fixed on `main`.
- Released in **[v0.6.4](https://github.com/cosmos/evm/releases/tag/v0.6.4)**.
- Released in **[v0.7.4](https://github.com/cosmos/evm/releases/tag/v0.7.4)**.

Chain operators must upgrade to **v0.6.4** or **v0.7.4** (or later).

## Workarounds

Disabling the staking precompile (or restricting permissionless contract deployment) prevents the attack. Chains that require the precompile should upgrade; there is no other mitigation for funds already removed from the pool short of coordinated state repair or recapitalization.

## References

- Releases: [v0.6.4](https://github.com/cosmos/evm/releases/tag/v0.6.4), [v0.7.4](https://github.com/cosmos/evm/releases/tag/v0.7.4)

## Credits

Originally reported through the Cosmos bug bounty program by berndartmueller.

Please reach out to our security email, [security@cosmoslabs.io](mailto:security@cosmoslabs.io) to get further details, or via our bug bounty program [https://immunefi.com/bug-bounty/cosmos](https://immunefi.com/bug-bounty/cosmos/information/) to report known vulnerabilities.

## References

- https://github.com/cosmos/evm/security/advisories/GHSA-c6xv-pppp-rjw6

Page: https://cve.now/GHSA-C6XV-PPPP-RJW6

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
