AI Security AI安全 7h ago Updated 2h ago 更新于 2小时前 46

Cosmos EVM Flaw Exploited After Cosmos Labs Knew Every Blockchain Running It Was Vulnerable Cosmos Labs 明知所有运行其 EVM 的区块链存在漏洞,仍遭利用

A critical balance-handling flaw (GHSA-7g4w-cg88-2cq2) in the shared Cosmos EVM module was exploited to drain funds from six blockchains between August 20–25, 2026, despite Cosmos Labs being aware of the vulnerability since April 25, 2026. The root cause is an unchecked subtraction in the post-delegation write-back logic: when a vesting account delegates more than its spendable balance, the balance wraps to approximately 2^256, enabling attackers to mint or burn funds through the EVM-Cosmos SDK Cosmos EVM共享模块存在关键余额处理漏洞,8月20-25日导致6个区块链资金被盗 漏洞GHSA-7g4w-cg88-2cq2于4月25日通过漏洞赏金计划报告,但被错误评估为无风险,8月13日才确认所有链受影响 修复版本v0.6.2和v0.7.2于8月19日发布,但采用silent patch公开流程而非紧急私有分发,违反自身安全政策 技术根源是EVM StateDB仅跟踪可花费余额,与SDK vesting账户的锁定余额对账逻辑存在缺陷,导致余额回绕至2^256 Cosmos Labs在事故中发现11个Cosmos EVM部署从未注册安全联系渠道

72
Hot 热度
62
Quality 质量
58
Impact 影响力

Analysis 深度分析

TL;DR

  • A critical balance-handling flaw (GHSA-7g4w-cg88-2cq2) in the shared Cosmos EVM module was exploited to drain funds from six blockchains between August 20–25, 2026, despite Cosmos Labs being aware of the vulnerability since April 25, 2026.
  • The root cause is an unchecked subtraction in the post-delegation write-back logic: when a vesting account delegates more than its spendable balance, the balance wraps to approximately 2^256, enabling attackers to mint or burn funds through the EVM-Cosmos SDK reconciliation mechanism.
  • Cosmos Labs incorrectly assessed the vulnerability as affecting only non-18-decimal networks in April, later confirmed all EVM chains were affected by August 13, yet routed the fix through a "silent patch" process reserved for non-fund-risk issues rather than emergency private distribution.
  • The fix (v0.6.2 and v0.7.2) is state-breaking and requires a coordinated network upgrade; chains unable to upgrade must halt block production, and operators are advised to reject vesting account creation messages in the ante handler as an interim measure.
  • Additional unpatched gaps persist: cherry-picked fixes may leave duplicate unexported code paths vulnerable, two critical balance fixes were omitted from the advisory, and eleven Cosmos EVM deployments were discovered that had never registered security contacts with Cosmos Labs.

Why It Matters

This incident exposes a dangerous gap between vulnerability discovery and responsible disclosure in the Cosmos ecosystem, where a known critical flaw threatening live user funds was treated with a silent patch process instead of emergency private distribution. It also highlights systemic risks in shared modular infrastructure: a single bug in a commonly reused EVM module can compromise multiple independent blockchains simultaneously, and fork-based deployments may silently retain unpatched code paths despite upstream fixes.

Technical Details

  • Vulnerability mechanism: The EVMStateDB tracks only an account's spendable balance, while SDK vesting accounts maintain both spendable and locked balances. Both x/staking and the staking precompile allow delegation of locked portions. When a vesting account delegates beyond its spendable balance, the unchecked post-delegation write-back subtracts the full delegated amount from the smaller spendable figure, causing an underflow that wraps the balance to ~2^256.
  • Exploitation vector: The attacker deploys a contract on a precomputed address converted into a vesting account, then executes a single transaction containing two halves with net zero supply change: one half mints funds via the wrapped balance, the other burns a victim's real holdings by sending them 2^256 - balance. Exploitation requires chains to permit permissionless vesting-account creation.
  • Version-specific behavior: On 0.6.x chains, large mint operations cause supply overflows that halt the chain. On 0.7.x chains, balances are set directly in x/bank and survive uint256 to int256 conversion, allowing direct fund drainage.
  • Fixes and gaps: The documented fix (PR #1176, merged May 15, backported August 13) adds a SubBalance underflow guard. Two additional fixes—PR #1187 (locked-balance snapshot, May 20) and commit 3524ebc (module-account balance guard)—were not mentioned in the advisory. Forks like ZetaChain's cherry-picked patch left duplicate unexported helpers unpatched, while Warden Protocol blocked vesting account creation entirely.
  • Affected versions: < 0.6.2 and >= 0.7.0 < 0.7.2; fixed releases are v0.6.2 and v0.7.2 (August 19).

Industry Insight

  • Shared module risk demands coordinated security: The Cosmos EVM flaw demonstrates how a single vulnerability in a shared dependency can cascade across dozens of independent chains. Projects using modular components must treat upstream security advisories as critical infrastructure alerts and verify that their forked code paths are fully patched, not just test-passing.
  • Vesting account permissions are a attack surface: Chains permitting permissionless vesting-account creation should immediately restrict MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, and MsgCreatePeriodicVestingAccount in their ante handlers, or restrict vesting creation to genesis-only, until the underlying module is patched.
  • Responsible disclosure processes must match threat severity: Cosmos Labs' decision to apply a "silent patch" process to a known fund-threatening vulnerability—contradicting its own published policy for emergency mitigations—suggests a need for automated severity-to-response mapping in bug bounty programs, ensuring that critical fund-risk flaws trigger private distribution regardless of prior patch visibility.

TL;DR

  • Cosmos EVM共享模块存在关键余额处理漏洞,8月20-25日导致6个区块链资金被盗
  • 漏洞GHSA-7g4w-cg88-2cq2于4月25日通过漏洞赏金计划报告,但被错误评估为无风险,8月13日才确认所有链受影响
  • 修复版本v0.6.2和v0.7.2于8月19日发布,但采用silent patch公开流程而非紧急私有分发,违反自身安全政策
  • 技术根源是EVM StateDB仅跟踪可花费余额,与SDK vesting账户的锁定余额对账逻辑存在缺陷,导致余额回绕至2^256
  • Cosmos Labs在事故中发现11个Cosmos EVM部署从未注册安全联系渠道

为什么值得看

本文揭示了Cosmos生态重大安全事件及其背后的响应流程缺陷,对区块链项目漏洞管理、安全治理和应急响应机制具有重要警示意义。事件暴露了漏洞赏金评估、补丁分发策略和跨链模块安全审计的系统性问题。

技术解析

  • 漏洞机制:EVM StateDB仅跟踪账户可花费余额,而Cosmos SDK vesting账户同时包含可花费余额和锁定余额。当vesting账户委托超过可花费余额时,post-delegation write-back从较小的可花费余额中减去完整委托金额,未检查减法下溢,导致余额回绕至约2^256。
  • 攻击路径:攻击者在预计算地址部署合约,该地址首先转为vesting账户。在单个交易中,两部分操作净供应变化为零,利用reconciliation的mint/burn逻辑,可将有限金额转出包装账户,或向受害者账户发送2^256减去其余额的金额,使reconciliation燃烧受害者实际持仓。
  • 版本差异:0.6.x链在底层SDK账本上mint/burn,大量mint导致供应溢出使链停止;0.7.x链直接在x/bank中设置余额,接受uint256转int256转换后幸存的变更。
  • 修复与补丁问题:主要修复PR #1176(SubBalance下溢检查)于5月15日合并,8月13日backport;PR #1187(锁定余额快照)于5月20日合并,backport在24小时内完成;第三个修复commit 3524ebc拒绝模块账户余额设置。ZetaChain贡献者指出cherry-pick补丁仅修复导出helper,未导出副本仍保留,导致fork实时路径未修补。
  • 缓解建议:升级至v0.6.2/v0.7.2或更高版本(需协调网络升级);无法立即升级的链应停止出块而非进行治理升级;在ante handler中拒绝MsgCreateVestingAccount等消息关闭前提条件;在分叉上验证实时代码路径。

行业启示

  • 漏洞响应流程需分级:Cosmos Labs对已知威胁生产网络用户资金的漏洞仍采用silent patch公开流程,违反其自身安全政策中"紧急风险需私有分发补丁"的规定,暴露了安全响应与政策执行的脱节。
  • 跨模块安全审计至关重要:EVM与SDK余额对账逻辑的缺陷表明,共享模块在跨层集成时需进行全面的安全审计,特别是涉及余额、委托等核心金融逻辑的代码路径。
  • 项目安全治理透明度不足:事故中发现11个Cosmos EVM部署从未注册安全联系渠道,反映生态项目对安全通知机制的忽视,建议建立强制性的安全联系人注册和漏洞披露规范。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Security 安全