Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host chain allows overwriting of the active channel #768

Closed
3 tasks
colin-axner opened this issue Jan 19, 2022 · 5 comments · Fixed by #785
Closed
3 tasks

Host chain allows overwriting of the active channel #768

colin-axner opened this issue Jan 19, 2022 · 5 comments · Fixed by #785
Assignees
Labels
27-interchain-accounts type: bug Something isn't working as expected

Comments

@colin-axner
Copy link
Contributor

Summary

The host chain assumes the controller chain will never allow a channel to OPEN if it is not in the active channel mapping.

Problem Definition

OnChanOpenConfirm will overwrite an active channel. This is fine for creating a new active channel after the previous one closed, but if the controller chain allows two channels to be opened for the same port (by incorrectly accounting for active channels), then this will overwrite an existing active channel

Proposal

Be defensive. If an active channel exist, return an error. Please add a test case for this scenario


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@colin-axner colin-axner added type: bug Something isn't working as expected 27-interchain-accounts labels Jan 19, 2022
@colin-axner colin-axner added this to the Interchain Accounts milestone Jan 19, 2022
@crodriguezvega crodriguezvega moved this to Todo in ibc-go Jan 19, 2022
@colin-axner
Copy link
Contributor Author

@AdityaSripal I think this should be updated in the spec

@AdityaSripal
Copy link
Member

But if the controller chain rewrites the active channel, shouldn't the host chain just use the latest active channel? I fail to see an attack here

@seantking
Copy link
Contributor

The host chain assumes the controller chain will never allow a channel to OPEN if it is not in the active channel mapping.

I don't understand this point. The current architecture will allow a controller chain to initialize a new channel as many times as it likes. I don't understand why this would be a security issue.

The only potential vulnerability I see here is in the case where a relayer could spam channel creation after the first InitInterchainAccount and potentially stop packets from reaching the interchain account (by overwriting the active channel by spamming channel creation on the bound port for a specific interchain account).

@colin-axner
Copy link
Contributor Author

But if the controller chain rewrites the active channel, shouldn't the host chain just use the latest active channel? I fail to see an attack here

There's a race condition here though right? If chainA ACKs channel-1 and channel-2 on the same port. A relayer could decide which becomes the active channel on chainB by submitting the OpenConfirm in a certain order. We could end up in a state where the controller active channel does not equal the host active channel (and it cannot be fixed)

I think the host chain should defensively consider overwrites of an active channel on the controller chain as byzantine behaviour (not necessarily attacking, but something is going wrong)

@colin-axner
Copy link
Contributor Author

Action items:

  • Ensure only 1 active channel can be created on ACK by checking if active channel exists + and is open
  • document that host (in OpenConfirm) assumes controller only allows 1 channel to be ACK'd
  • ensure specs have this check
  • do defensive check in OpenTry

@seantking seantking moved this from Todo to In review in ibc-go Jan 25, 2022
@seantking seantking moved this from In review to In progress in ibc-go Jan 27, 2022
Repository owner moved this from In progress to Done in ibc-go Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
27-interchain-accounts type: bug Something isn't working as expected
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants