# Attacker can use any non-enabled capability

CosmWasm enforced capability restrictions only via a compiler-generated string, so a contract built with that string removed could execute any chain action.

- Payout: $2,000
- Severity: low
- Program: Cosmos
- Found by: julianor
- Disclosed: 2025-01-15
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/2930811
- Library page: https://bugbountylibrary.com/r/h1%3A2930811
- Tags: area:web3 domain:web3 impact:integrity kind:bounty platform:hackerone sev:low tech:rust technique:source-review vuln:access-control vuln:privilege-escalation

**Target:** CosmWasm contract capability enforcement (compiler exports / DefaultMessageHandler)
**Root cause:** Required capabilities are declared by a compiler-generated string in the wasm binary and checked only at upload time; the runtime DefaultMessageHandler never re-checks capabilities before dispatching messages.
**Steps:**
1. Assume a chain announces no capabilities but allows users to execute those paths via regular non-wasm messages.
2. Comment out the capabilities-string generation in `packages/std/src/exports.rs` of the cosmwasm compiler.
3. Deploy the resulting contract to the chain; upload succeeds because the `requires_*` string is absent.
4. Execute any chain action through the contract despite the chain disallowing that capability.
**How found:** Reading CAPABILITIES.md's claim that required capabilities must all be available, then noticing the enforcement is a compiler-emitted string rather than a runtime check, and testing by removing that string.
**Exploitation:** Attacker builds a contract with the capability declaration stripped, uploads it (passes upload-time check since no requires_* string present), then routes arbitrary chain messages through the contract to perform actions the chain intended to block for wasm contracts.
**Insight:** When a security control is enforced by metadata baked into an artifact at build time (a compiler-generated string), the artifact producer controls the check; look for the missing runtime re-validation on the consuming side.

