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

Introduce malicious behaviour in ICS3 TLA+ spec. #70

Closed
4 tasks done
adizere opened this issue May 20, 2020 · 4 comments · Fixed by informalsystems/basecoin-rs#81
Closed
4 tasks done

Introduce malicious behaviour in ICS3 TLA+ spec. #70

adizere opened this issue May 20, 2020 · 4 comments · Fixed by informalsystems/basecoin-rs#81
Assignees
Labels
O: new-feature Objective: cause to add a new feature or support
Milestone

Comments

@adizere
Copy link
Member

adizere commented May 20, 2020

Summary

We would like to model malicious behavior as part of ICS3 spec.

Problem Definition

Preliminary work on this has been started on the following branch: https://github.com/informalsystems/ibc-rs/tree/adi/ics3_tla_malicious
as part of the work in #58.

Discussion from ongoing work

Initially, the environment is non-malicious. The environment starts
acting maliciously once the connection on both chains transitions out
of state "UNINIT" (the initials state). It is important to
initialize the protocol like this, otherwise the env. can provoke a
deadlock. This can happen with the following sequence of actions:

  1. Environment injects a ICS3MsgInit to chain A with the following
    correct parameters:
    localEnd |-> [connectionID |-> "connAtoB",
                  clientID |-> "clientIDChainB"]
    remoteEnd |-> [connectionID |-> "connBtoA",
                   clientID |-> "clientIDChainA"]
  1. Environment injects, maliciously, a ICS3MsgInit to chain B with
    the following parameters:
    localEnd |-> [connectionID |-> "connBtoA",
                  clientID |-> "clientIDChainA"]
    remoteEnd |-> [connectionID |-> "connBtoA",
                   clientID |-> "clientIDChainA"]

Notice that the localEnd is correct, so chain B will validate and
process this message; the remoteEnd is incorrect, however, but chain
B is not able to validate that part of the connection, so it will
accept it as it is.

  1. Chain A processes the ICS3MsgInit (action HandleInitMsg) and
    updates its store.connection with the parameters from step 1 above.
    At this point, chain A "locks onto" these parameters and will not
    accept any others. Chain A also produces a ICS3MsgTry message.

  2. Chain B processes the ICS3MsgInit (action HandleInitMsg) and
    updates its store.connection with the parameters from step 2 above.
    Chain B "locks onto" these parameters and will not accept any others.
    At this step, chain B produces a ICS3MsgTry message with the local
    parameters from its connection.

Both chains will be locked on a different set of connection parameters,
and neither chain will accept their corresponding ICS3MsgTry, hence a
deadlock. To avoid this problem, we prevent the environment from
acting maliciously in the preliminary parts of the ICS3 protocol, until
both chains finish locking on the same set of connection parameters.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@adizere
Copy link
Member Author

adizere commented May 21, 2020

Related branch that includes prior work on this issue: https://github.com/informalsystems/ibc-rs/commits/adi/ics3_tla_malicious

@adizere adizere self-assigned this Jun 16, 2020
@adizere adizere added connection O: new-feature Objective: cause to add a new feature or support labels Jun 16, 2020
@adizere adizere added this to the 0.7-7mo milestone Jun 16, 2020
@istoilkovska
Copy link
Contributor

As far as I understand from your example above, the sequence of steps that causes a deadlock is not due to the malicious environment, but to the protocol itself. Selectively turning a faulty environment on or off may cause the specification to ignore some undesirable behaviors of the protocol that can appear in the implementation. The faulty environment is unpredictable and non-deterministic, and in my opinion, its behavior in the specification should not be restricted. Maybe it is better to rather think about how to improve the protocol and the specification such that it deals with this scenario.

@adizere
Copy link
Member Author

adizere commented Jun 29, 2020

The faulty environment is unpredictable and non-deterministic, and in my opinion, its behavior in the specification should not be restricted.

It would be great to leave the faulty relayer's behavior unrestricted. @istoilkovska proposes to fix the scenario above as follows:

One easy fix that comes to mind is that a chain should discard datagrams that have the same connection ID in both fields localConnectionID and remoteConnectionID. This is a purely syntactic check on the local chain side, and does not require checking if remoteConnectionID is a valid connection ID.

This fix has the advantage that it permits arbitrary behavior for malicious relayer(s). The disadvantage is that we're adding a syntactic check that might not be in line with the ICS3 module implementation. To summarize, I think the problem in this scenario arises because we’re capturing a single connection. It seems like we have two options at the moment:

  1. Prevent the relayer from initializing two distinct connections on each chain, or
  2. A syntactic check along the lines proposed above.

@adizere
Copy link
Member Author

adizere commented Jan 6, 2021

Closing, as this is o longer relevant (#404 supersedes it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O: new-feature Objective: cause to add a new feature or support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants