Resources

People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!

Cosmos EVM GHSA-7g4w-cg88-2cq2 Post-Mortem- 2165

Interchain FoundationPosted 14 Days Ago
  • Several Cosmos blockchains using the evm module were hit by an attack based on this bug. The vulnerability was considered not exploitable, so the affected chains were not notified. This is the story behind it. On Mantra, this led to an infinite mint of their native token.
  • The EVM module tracks account balances in the StateDB but this has to integrate with the Cosmos x/bank module. The StateDB only models an accounts spendable balance but the SDK has vesting accounts that hold both spendable, and locked balance in x/staking. 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. This leads to an unchecked integer overflow on the balance.
  • The original bug report came through their bug bounty program on April 25th (three-month patch). The PoC only worked with 6 decimals. Since they couldn't reproduce the bug with an 18-decimal network (which is what everything else ran as), they didn't think it was exploitable. Thus, they concluded it was a low-risk bug and silently patched it.
  • In early August, additional reports from security researchers showed that the bug could be exploited more broadly. Since the patch was still public and there was no known exploitation, they continued to patch publicly. Given the exploitability known at the time, they still decided to silently patch it... On August 20th (before the first incident began), a fork of the Cosmos SDK fixed the bug with an exploitable path in detail from an audit report.
  • To me, the belief that a silent patch is the solution without coordination with the other teams was a major blunder. It's understandable that you don't want to flood teams with unnecessary fixes... But as soon as the first super critical bug report was submitted (3 months prior to the exploit), you needed to act NOW. It's crazy this was still fixed in the open after the exploitability was known. I don't think you can blame a fork of the project for fixing a bug that was known for four months as the reason for the exploit. They tried to obfuscate the backports as well.
  • I call this the "Android security problem". There are many individual blockchains: how do you ensure each is secure? Especially in blockchain, patching gaps is unacceptable. So, backroom communications and trust that the developers you're working with are not bad actors is the way to go.