Skip to content

Add IBC and CosmWasm security comments.#4683

Open
mdulin2 wants to merge 1 commit intowormhole-foundation:mainfrom
mdulin2:CosmWasmWatcherImprovements
Open

Add IBC and CosmWasm security comments.#4683
mdulin2 wants to merge 1 commit intowormhole-foundation:mainfrom
mdulin2:CosmWasmWatcherImprovements

Conversation

@mdulin2
Copy link
Contributor

@mdulin2 mdulin2 commented Feb 20, 2026

  • Comments for various security invariants
  • A few variable changes to make the code easier to reason about.

* Comments for various security invariants
* A few variable changes to make the code easier to reason about.
eventType := gjson.Get(event.String(), "type")
if eventType.String() == "recv_packet" && chainID != vaa.ChainIDWormchain {

// SECURITY: Fix for IBC hallucinations vulnerability. Likely unnecessary now.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a link if you have one? I'm not sure future maintainers will know what this refers to.

continue
}

// SECURITY: Parsing must be more or the other at a time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// SECURITY: Parsing must be more or the other at a time.
// SECURITY: Parsing must be one or the other at a time.

?

// SECURITY: There is no 'action' attribute to differentiate between types on this message.
// In practice, all other events in CosmWasm contract will fail parsing
// because they are missing fields. So, there's a type confusion issue here
// but it's unexploitable. These contracts are unlikely to change as well.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// but it's unexploitable. These contracts are unlikely to change as well.
// but it's unexploitable.

Maybe this part could be more action-oriented? Like "This code should be revisited if the underlying CosmWasm contracts change."

}
chainId, ok := mappedAttributes["message.chain_id"]

// Effectively ignored
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this good or bad?

// SECURITY: The ibc watcher is the only watcher that can handle multiple chain IDs
// To make this safe, it has a mapping from channel ID to chain IDs that it uses
// This prevents chains like Solana and Ethereum from being emitted from.
// Prevents cross-chain attacks where Osmosis can emit an event for Injective as well.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just an example, or is there something specific to know about Osmosis and Injective?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants