AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

cosmos-vulnerability-scanner

Scans Cosmos SDK blockchain modules and CosmWasm contracts for consensus-critical vulnerabilities — chain halts, fund loss, state divergence. 25 core + 16 IBC + 10 EVM + 3 CosmWasm patterns. Use when auditing custom x/ modules, reviewing IBC integrations, or assessing pre-launch chain security. Updated for SDK v0.53.x.

Original source
trailofbits
License
CC-BY-SA-4.0
Pinned revision
2be6433b39e009cd2b6fd3be1895f6b1faa5af9a

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

This skill also requires local files or dependencies. Remote reading alone may not be enough.

Ask your assistant

Use Agentic Memory skills to read trailofbits--cosmos-vulnerability-scanner at revision 2be6433b39e009cd2b6fd3be1895f6b1faa5af9a, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 9

resources/IBC_VULNERABILITY_PATTERNS.md · 24000

urcePort, packet.SourceChannel, packet.Sequence)

// 2. EFFECT: Delete commitment BEFORE callback
k.DeletePacketCommitment(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence)

// 3. INTERACTION: Now callback cannot re-enter (commitment gone)
k.callbacks.OnTimeoutPacket(ctx, packet)

return nil

}


**What to Check**:
- [ ] ibc-go version is patched (>= v4.6.0, v5.4.0, v6.3.0, v7.4.0, v8.2.0)
- [ ] ALL IBC callbacks (OnRecvPacket, OnAcknowledgementPacket, OnTimeoutPacket) follow CEI: state mutation BEFORE external callbacks
- [ ] Custom IBC middleware and hooks do NOT introduce new callback-before-finalization patterns
- [ ] If the chain has been upgraded, verify the patch was NOT accidentally reverted (Terra re-introduced the vulnerability during a June 2024 upgrade)
- [ ] CosmWasm-enabled chains with ibc-hooks middleware are at highest risk — CosmWasm submessages enable recursive re-entry
- [ ] Rate limiting (§12) is implemented as defense-in-depth even with patched ibc-go

**Vulnerable chain requirements**: IBC-enabled + vulnerable ibc-go version + CosmWasm-enabled with permissionless uploads + ibc-hooks middleware wrapping ICS-20.

**Two attack vectors**:
- **Native token theft**: Drain all tokens from ICS-20 escrow accounts
- **Infinite IBC token minting**: Mint unbacked IBC tokens, bridge them back to original chains

**Grep Patterns** (use Grep tool with `glob: "*.go"` in `x/`):
- `OnTimeoutPacket|OnAcknowledgementPacket|OnRecvPacket` — IBC callbacks
- `DeletePacketCommitment` — verify commitment deletion happens BEFORE callback invocation
- `ibc-hooks|ibchooks` — hooks middleware presence

**References**:
- [Asymmetric Research — IBC Reentrancy Infinite Mint](https://blog.asymmetric.re/cosmos-ibc-reentrancy-infinite-mint/)
- [GHSA-j496-crgh-34mx](https://github.com/cosmos/ibc-go/security/advisories/GHSA-j496-crgh-34mx)
- [Terra IBC hooks exploit — $6.4M](https://www.theblock.co/post/308440/attacker-exploits-ibc-hooks-vulnerability-to-steal-tokens-on-terra-blockchain)

---

### SUMMARY: MOST DANGEROUS PATTERNS

| # | Pattern | Category | Known Incident / Reference |
|---|---------|----------|---------------------------|
| 1 | Untrusted IBC counterparty chain | Channel | GHSA-5jgq-x857-p8xw |
| 2 | Unsafe LookupModuleByPort/LookupModuleByChannel | Channel | ibc-go#71 |
| 3 | Missing IBC channel close validation | Channel | — |
| 4 | Incorrect IBC packet timeout handling | Channel | — |
| 5 | Incorrect IBC channel ordering type | Channel | — |
| 6 | IBC transfers breaking internal bookkeeping | Denom | SDK#20517 |
| 7 | Non-deterministic JSON in IBC ack middleware | Middleware | ISA-2025-001, ASA-2025-004 |
| 8 | PFM inverted escrow/mint (nonrefundable) | Middleware | PoC available |
| 9 | ICS-20 v2 multi-token partial receive inflation | Middleware | PoC available |
| 10 | Unpermissioned IBC channel opening | Channel | Precondition for ISA-2025-001 |
| 11 | IBC denom / voucher confusion | Denom | ibc-go#7848 |
| 12 | Missing IBC rate limiting | Defense | Would have limited $126M exploit |
| 13 | ICA host allow-all (`"*"`) configuration | ICA | Default genesis config |
| 14 | ICA channel ordering backwards compat | ICA | ibc-go#6714 |
| 15 | ICA authentication module missing | ICA | ICS-27 audit finding |
| 16 | IBC reentrancy / CEI violations | Reentrancy | ASA-2024-007, Terra $6.4M exploit |

---

### References

- **IBC-Go Security Advisories**: https://github.com/cosmos/ibc-go/security/advisories
- **IBC-Go Audit Reports**: https://docs.cosmos.network/ibc/v8.5.x/security-audits
- **Asymmetric Research**: "Cosmos IBC Reentrancy Infinite Mint" — https://blog.asymmetric.re/cosmos-ibc-reentrancy-infinite-mint/
- **Jump Crypto**: "Huckleberry: IBC Event Hallucinations" — https://jumpcrypto.com/resources/huckleberry-ibc-event-hallucinations
- **Cosmos Forum**: IBC Security Advisories — https://forum.cosmos.network/c/security/
- **Osmosis Rate Limits**: https://www.range.org/blog/ibc-rate-limits-introduction-and-state-of-the-art-1-3