-
Notifications
You must be signed in to change notification settings - Fork 352
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
Fix for chain impersonation problem. Fix for incomplete channel create
#1066
Conversation
channel create
@soareschen You recently refactored the code in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not run the code yet, but here are some of my comments.
When I follow the instructions I get:
|
weird, if I do:
|
A few thoughts triggered by this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @adizere! Looks good to me to merge. We may consider opening some issues in the future to reduce the effect of these types of attacks but definitely a very good start.
Captured Anca's thoughts in a discussion, so let's follow up there -- #1092 |
…te` (informalsystems#1066) * Countermeasure that fixes informalsystems#1038 * Tentative fix for informalsystems#1064 * Better fix for the impersonation problem * Better log message. Handle (TryOpen, Init) case * Changelog * Better error, added doc comment, less clones. * Clarify the intent of method do_chan_open_ack_confirm_step * Removed some unnecessary clones * Moved check_channel_counterparty to chain::counterparty * Fully specified error in case of failure in check_channel_counterparty * Used port+channel instead of socket * Fix small typo in error variant * Removed chan counterparty verification in ft-transfer. Co-authored-by: Anca Zamfir <[email protected]>
Closes: #1038
Closes: #1064
For testing instructions for issue 1064, see the description within that issue for more details.
The basic command that is undergoing changes here is
hermes create channel
.Testing for 1038
You will need two configuration files for Hermes.
~/.hermes/config.toml
~/.hermes/config_fake.toml
You will also need to use this for
gm
. Make sure that thebinary
option in that file points to the correct path to your hermes binary.killall gaiad
andgm stop
gm
chains were running before,gm reset
them to clear their state./scripts/dev-env ~/.hermes/config.toml ibc-0 ibc-1
and wait for it finishibc-1
on grpc port9091
will be our real chain where the ft-transfer should arriveconfig.toml
gm start
&&gm hermes keys
ibc-1
, but this gaia is running on a different grpc port27041
ibc-1
that is fakeconfig_fake.toml
hermes create channel ibc-0 ibc-1 --port-a transfer --port-b transfer
ibc-0:channel-0
----> realibc-1:channel-1
hermes -c ~/.hermes/config_fake.toml create channel ibc-0 ibc-1 --port-a transfer --port-b transfer
ibc-0:channel-1
----> fakeibc-1:channel-1
now submit an ft-transfer on
ibc-0
, on endibc-0:channel-1
, destined to arrive to the fakeibc-1
chain,hermes -c ~/.hermes/config_fake.toml tx raw ft-transfer ibc-1 ibc-0 transfer channel-1 9999 -o 1000
try to submit an ft-transfer on
ibc-0
, on endibc-0:channel-1
, destined to arrive to the realibc-1
chain-c
option to use the config of the realibc-1
chainibc-0:channel-1
to submit this transfer: this specific channel end onibc-0
corresponds to a counterparty channel endibc-1:channel-0
, which in turn has counterpartyibc-0:channel-0
; in other words, this command should fail, because the counterparty on the destination chain (namely,ibc-0:channel-0
) does not match the source channel (ibc-0:channel-1
):hermes tx raw ft-transfer ibc-1 ibc-0 transfer channel-1 9999 -o 1000
For contributor use:
docs/
) and code comments.Files changed
in the Github PR explorer.