# GHSA-7G4W-CG88-2CQ2: Balance underflow in EVM StateDB

- Database: GitHub
- Severity: critical (stated by ghsa, no CVSS score)
- Published: 2026-08-28
- Modified: 2026-08-28

## Affected versions

- github.com/cosmos/evm (Go): fixed in 0.6.2

## Description

_This security advisory describes the vulnerability outlined in the [August 28, 2026 Cosmos EVM post-mortem](https://github.com/cosmos/security/blob/main/communications/cosmos_evm_GHSA-7g4w-cg88-2cq2_post_mortem.md)._

## Summary

Cosmos EVM tracks account balances in an EVM `StateDB` that is reconciled with the Cosmos SDK `x/bank` module. The `StateDB` only models an account's **spendable** balance, but vesting accounts in SDK state hold both a **spendable** and a **locked** balance, and both `x/staking` and the staking precompile permit delegating the locked portion.

When a vesting account delegates more than its spendable balance, the post-delegation write-back subtracts the full delegated amount from the `StateDB`'s spendable view, producing an **unchecked underflow** that wraps the account balance to ≈2²⁵⁶. 

## Details

The EVM `StateDB` sees only an account's spendable balance. When a vesting account delegates an amount greater than its spendable balance (i.e., dips into its locked balance, which `x/staking` and the staking precompile permit), the `SubBalance` write-back on the `StateDB` subtracts the full delegated amount from a smaller spendable figure. The subtraction is unchecked and wraps the balance to ≈2²⁵⁶.


## Patches

The fix adds an underflow guard to the `StateDB` `SubBalance` write-back.

- Fixed on `main` in **[#1176](https://github.com/cosmos/evm/pull/1176)**.
- Backported to `release/v0.6.x` in **[#1253](https://github.com/cosmos/evm/pull/1253)** (commit `82b3ef6c8`) and released in **[v0.6.2](https://github.com/cosmos/evm/releases/tag/v0.6.2)**.
- Backported to `release/v0.7.x` in **[#1254](https://github.com/cosmos/evm/pull/1254)** (commit `0182da198`) and released in **[v0.7.2](https://github.com/cosmos/evm/releases/tag/v0.7.2)**.

Chain operators must upgrade to **v0.6.2** or **v0.7.2** (or later). The change is state-breaking and requires a coordinated network upgrade.

## Workarounds

There is no configuration-only mitigation. If an operator cannot upgrade immediately, **halt the chain** rather than attempt a coordinated governance upgrade. Disabling the staking precompile removes the primary trigger path but is not a substitute for the patch.

## References

- Patch: cosmos/evm [#1176](https://github.com/cosmos/evm/pull/1176), [#1253](https://github.com/cosmos/evm/pull/1253), [#1254](https://github.com/cosmos/evm/pull/1254)
- Releases: [v0.6.2](https://github.com/cosmos/evm/releases/tag/v0.6.2), [v0.7.2](https://github.com/cosmos/evm/releases/tag/v0.7.2)

## Credits

Originally reported through the Cosmos bug bounty program by [@AshmitSh4rma](https://hackerone.com/ashmitsh4rma) (https://github.com/ashmitsh4rma) and by additional independent security researchers who provided reproduction details enabling a full assessment.

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-7g4w-cg88-2cq2

Page: https://cve.now/GHSA-7G4W-CG88-2CQ2

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