For Phase 3 we prepared a specific deceptive zone whose purpose is to trap your transfers and let the zone ‘root’ users to claim them on the counterparty chains.
For Phase 3 we prepared a specific deceptive zone whose purpose is to trap your transfers and let the zone ‘root’ users to claim them on the counterparty chains.
That zone does not expose a vulnerability in IBC, neither it is something unexpected by people who made ICS: it’s merely an illustration of IBC threat model and how it can be used to steal user funds.
We modified createOutgoingPacket()
function to work like that:
Here’s the gist of how it’s done, and the full project.
So if someone was to transfer, say, doubloons to our deceptive chain, they couldn’t take it back - but any root user can redeem fake tokens for real tokens on an origin chain.
That means that a regular user who sends funds to a deceptive chain can’t cash them out on an origin chain - they’ve basically lost they funds. But it’s not apparent, because internal transfers on the zone work fine, and until a user tries to redeem the transferred token they won’t see any problems.
Moreover, malicious root token holder can redeem those tokens instead of an original sender or transferred token holders, and that wouldn’t be apparent too without aggregate analysis of all transfers across all channels.
We deployed it on responsible-3 zone (heads up: responsible was an approved sockpuppet account of p2p all along; it didn’t compete in earlier phases where scarcity and/or account throughput were an issue).
An unsuspecting user makes a transfer of 100 very valuable ptp tokens to responsible-3:
>rly tx transfer p2p-org-3 responsible-3 100ptp true cosmos16zx4s8nculu94vhm07fd3qlg8g7grtj0xk49dg
I[2020-06-03|18:21:59.489] ✔ [p2p-org-3]@{50776} - msg(0:transfer) hash(962733C0568867D6F4EA70417EB1E747FCC136396E3E020D5351DAD011ACBE6D)
I[2020-06-03|18:22:09.218] ✔ [responsible-3]@{50793} - msg(0:update_client,1:ics04/opaque) hash(87D2802713DB702334AB843CAD488841E5A3E1A7C95DCB0DA0344E5039A77674)
They now have transferred tokens in the wallet, but can they transfer them back?
>rly q bal responsible-3
100transfer/fmqnwnlqii/ptp
>rly tx transfer responsible-3 p2p-org-3 100ptp false cosmos16zx4s8nculu94vhm07fd3qlg8g7grtj0xk49dg
I[2020-06-03|18:56:09.666] ✘ [responsible-3]@{51200} - msg(0:transfer) err(sdk:4:failed to execute message; message index: 0: need to be root user to send ibc source=false transfers: unauthorized)
Error: failed to send first transaction
No, they can’t. Here comes a root user:
>rly q bal responsible-3
100000000000root,975000rsp
They don’t have any 100transfer/fmqnwnlqii/ptp
tokens, but they can redeem 100ptp on p2p-org-3 anyway:
>rly tx transfer responsible-3 p2p-org-3 100ptp false cosmos1hazzkmrvxcrxvxv98daslkw0a7uax5djqgn20d
I[2020-06-03|18:58:41.425] ✔ [responsible-3]@{51230} - msg(0:transfer) hash(24456218B05964F3B7B57EFD1F25E2CEEDA9BAAEBC957D0A6E315D801929E093)
I[2020-06-03|18:58:49.540] ✔ [p2p-org-3]@{51217} - msg(0:update_client,1:ics04/opaque) hash(769158A9735DF93496F08F631E5D1AB04CCF081DFC132700E25C970D33DF74DB)
>rly q bal p2p-org-3
100ptp
The prolonged existence of actively malicious “rootchains” is not realistic - people wouldn’t use it for anything - but we expect people might deploy temporary ones for fishing or scamming purpose when IBC connections are permissionless and IBC-enabled wallets allow arbitrary chains to be added.
More than that, any sufficiently complicated IBC-enabled blockchain can become a “rootchain” due to vulnerability, especially if we’re talking about complex smart contract chains and dynamic IBC like on Agoric or CosmWASM chains. Both trapping the funds on receiving chain forever or dishonest redeeming on source chain can be a result of an exploit on undertested code.
We think that the community should build tools for total supply observability across chains and means to swiftly stop IBC transfers with malicious or vulnerable zones or applications via governance to prevent user fund loss.
The best way to support our contribution is to stake ATOM with P2P Validador.
P2P Validator is a world-leading non-custodial staking provider securing more than $3 billion by over 10,000 delegators/nominators across 25+ high-class networks. We've been validating in Cosmos Hub since the first day of mainnet. P2P Validator provides comprehensive due-diligence and invested its own funds in ATOM in 2017 intending to support Cosmos network in the long term.
Web: https://p2p.org
Stake ATOM with us: p2p.org/cosmos
Twitter: @p2pvalidator
Telegram: https://t.me/P2Pstaking
<h1 id="cosmos-game-of-zones-phase-3-double-spend-via-a-double-sign"><strong>Cosmos' Game of Zones Phase 3: Double Spend via a Double Sign</strong></h1><p>We'll show how malicious validators (or validator keys thieves) can double-spend via IBC transfers using vanilla Tendermint, cosmos-sdk and relayer software.</p><p>For an experiment we have two chains: <code>p2p-org-3</code> and <code>responsible-3</code>. On p2p-org-3 there are 1000, no more and no less, of very valuable tokens with <code>scarce</code> denom. Using our trick we can make <code>responsible-3</code> accept a total sum of <code>2000scarce</code> via a channel.</p><h2 id="double-spend-via-a-double-sign-step-by-step"><strong>Double spend via a double sign step by step</strong></h2><p>To double spend we:</p><ol><li>Open a channel from p2p-org-3 to responsible-3</li><li>Stop a single validator of p2p-org-3, replicated it in two copies (let's call them <code>p2p-org-3.1</code> and <code>p2p-org-3.2</code>, though they still have an original chain-id of <code>p2p-org-3</code>) and start again in two different exemplars.</li></ol><pre><code>p2p-org-3.2$ rly q bal p2p-org-3 100000000000ptp,1000scarce p2p-org-3.2$ rly q bal responsible-3 100000000000root,996000rsp,10transfer/hvigvvmjhcqwerty/ptp </code></pre><p>3. Send 1000 scarce from <code>p2p-org-3.1</code>to <code>responsible-3</code>.</p><pre><code>p2p-org-3.1$ rly tx transfer p2p-org-3 responsible-3 1000scarce true $(rly ch addr responsible-3) I[2020-06-04|23:36:45.775] ✔ [p2p-org-3]@{68672} - msg(0:transfer) hash(13628DFA68099121C323DB7C2369489E1AFB71C2737B3D92B1BACAF5A9CFBB01) I[2020-06-04|23:36:56.725] ✔ [responsible-3]@{68908} - msg(0:update_client,1:ics04/opaque) hash(50F3730A339AE60A1FDB4FADF484EA8FDC870E9E46C8362BEE328D7D324FDDE8) p2p-org-3.1$ rly q bal p2p-org-3 99999999500ptp p2p-org-3.1$ rly q bal responsible-3 100000000000root,995500rsp,10transfer/hvigvvmjhcqwerty/ptp,1000transfer/hvigvvmjhcqwerty/scarce </code></pre><p>4. Switch to <code>p2p-org-3.2</code>'s terminal - there we still have <code>1000scarce</code></p><pre><code>p2p-org-3.2$ rly q bal p2p-org-3 100000000000ptp,1000scarce p2p-org-3.2$ rly q bal responsible-3 100000000000root,995500rsp,10transfer/hvigvvmjhcqwerty/ptp,1000transfer/hvigvvmjhcqwerty/scarce </code></pre><p>5. Send a bogus transfer (<code>100ptp</code>) from <code>p2p-org-3.2</code> to <code>responsible-3</code> - it fails on <code>responsible-3</code> but we bump <code>p2p-org-3.2</code>'s packet count by one to be able to send further transfers succesfully.</p><pre><code>p2p-org-3.2$ rly tx transfer p2p-org-3 responsible-3 100ptp true $(rly ch addr responsible-3) I[2020-06-04|23:39:07.369] ✔ [p2p-org-3]@{68700} - msg(0:transfer) hash(EB8CAE3CDE96FF9073B54B5E6F70C43B83DA13A30E06D833AA107CEB94EE6279) I[2020-06-04|23:39:14.274] ✘ [responsible-3]@{0} - msg(0:update_client,1:ics04/opaque) err(client:15:couldn't verify counterparty packet commitment: key mismatch on operation #0: expected commitments/ports/transfer/channels/hvigvvmjhcqwerty/packets/3 but got commitments/ports/transfer/channels/hvigvvmjhcqwerty/packets/2: packet commitment verification failed) </code></pre><p>6. Succesfully send 1000 scarce from <code>p2p-org-3.2</code>to <code>responsible-3</code>.</p><pre><code>p2p-org-3.2$ rly tx transfer p2p-org-3 responsible-3 1000scarce true $(rly ch addr responsible-3) I[2020-06-04|23:40:02.589] ✔ [p2p-org-3]@{68711} - msg(0:transfer) hash(83DFA4FB75D22220ECD94F134D8A8AE5BC0D0075D2DA6021B8DA6C4688E28787) I[2020-06-04|23:40:12.237] ✔ [responsible-3]@{68947} - msg(0:update_client,1:ics04/opaque) hash(DD11048F41B6D0955EAC84D311DEF5DAD9A3F446398A59293C82A62D84F6B506) p2p-org-3.2$ rly q bal p2p-org-3 99999998900ptp gaia@ibc3-p2p-validator-2:/home/deploy$ rly q bal responsible-3 100000000000root,995000rsp,10transfer/hvigvvmjhcqwerty/ptp,2000transfer/hvigvvmjhcqwerty/scarce </code></pre><p>We think that if there's ever a real attack with stolen keys or malicious validators involved, it'll be carried out with a combination of running a fork + using modified software that can issue arbitrary IBC packets (like our own RootChain).</p><hr><p><em><em>The best way to support our contribution is to <a href="https://p2p.org/cosmos?utm_source=blog&utm_medium=economy&utm_campaign=phase3_post">stake ATOM with P2P Validador</a>.</em></em></p><hr><p><a href="https://p2p.org/?utm_source=blog&utm_medium=economy&utm_campaign=phase3_post">P2P Validator</a> is a world-leading non-custodial staking provider securing more than $3 billion by over 10,000 delegators/nominators across 25+ high-class networks. We've been validating in Cosmos Hub since the first day of mainnet. P2P Validator provides comprehensive due-diligence and invested its own funds in ATOM in 2017 intending to support Cosmos network in the long term.</p><p><strong><strong>Web:</strong></strong><a href="https://p2p.org/?utm_source=blog&utm_medium=economy&utm_campaign=phase3_post"> https://p2p.org</a></p><p><strong><strong>Stake ATOM with us:</strong></strong> <a href="https://p2p.org/cosmos?utm_source=blog&utm_medium=economy&utm_campaign=phase3_post">p2p.org/cosmos</a></p><p><strong><strong>Twitter:</strong></strong><a href="https://twitter.com/p2pvalidator?ref=p2p.org"> @p2pvalidator</a></p><p><strong><strong>Telegram:</strong></strong> <a href="https://t.me/P2Pstaking?ref=p2p.org">https://t.me/P2Pstaking</a></p>
from p2p validator
<p><em><em>This guide will walk you through the steps of creating Polkadot account and receiving individual address to <a href="https://p2p.org/economy/claim-dot-with-polkadotjs">claim DOT</a> tokens and <a href="https://p2p.org/economy/polkadot-nomination-guide">start nominating</a>.</em></em></p><p><a href="https://p2p.org/economy/create-account-in-polkadot-network#create-an-account-using-polkadotjs-ui">Create an account using Polkadot.JS UI</a></p><p><a href="https://p2p.org/economy/create-account-in-polkadot-network#create-an-account-using-polkadotjs-browser-extension">Create an account using Polkadot.JS browser extension</a></p><h1 id="create-an-account-using-polkadotjs-ui"><strong>Create an account using PolkadotJS UI</strong></h1><p>Visit <a href="https://polkadot.js.org/apps/?ref=p2p.org#/accounts">Polkadot UI</a>, go to <code>Settings</code> tab and select <code>address prefix</code>.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/1-4.png" class="kg-image" alt loading="lazy" width="1899" height="859" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/1-4.png 600w, https://p2p.org/economy/content/images/size/w1000/2020/09/1-4.png 1000w, https://p2p.org/economy/content/images/size/w1600/2020/09/1-4.png 1600w, https://p2p.org/economy/content/images/2020/09/1-4.png 1899w" sizes="(min-width: 720px) 720px"></figure><p>In a dropdown menu select Polkadot (live).</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/2-7.png" class="kg-image" alt loading="lazy" width="1899" height="857" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/2-7.png 600w, https://p2p.org/economy/content/images/size/w1000/2020/09/2-7.png 1000w, https://p2p.org/economy/content/images/size/w1600/2020/09/2-7.png 1600w, https://p2p.org/economy/content/images/2020/09/2-7.png 1899w" sizes="(min-width: 720px) 720px"></figure><p>Set the node/endpoint. Choose one hosted by Parity or Web3 as on screenshot below and click <code>Save & Reload</code>.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/3-6.png" class="kg-image" alt loading="lazy" width="1901" height="859" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/3-6.png 600w, https://p2p.org/economy/content/images/size/w1000/2020/09/3-6.png 1000w, https://p2p.org/economy/content/images/size/w1600/2020/09/3-6.png 1600w, https://p2p.org/economy/content/images/2020/09/3-6.png 1901w" sizes="(min-width: 720px) 720px"></figure><p>Go to <code>Account</code> tab and press <code>Add account</code> button. Polkadot mainnet address should start with "1".</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/4-3.png" class="kg-image" alt loading="lazy" width="1906" height="859" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/4-3.png 600w, https://p2p.org/economy/content/images/size/w1000/2020/09/4-3.png 1000w, https://p2p.org/economy/content/images/size/w1600/2020/09/4-3.png 1600w, https://p2p.org/economy/content/images/2020/09/4-3.png 1906w" sizes="(min-width: 720px) 720px"></figure><p>Complete all the required fields and save all information in a secure place. For future ease add in the name of the account “stash” to identify it easily in the future or add a tag after creation. You will be able to download and store your encrypted keystore locally.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/5-3.png" class="kg-image" alt loading="lazy" width="1902" height="856" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/5-3.png 600w, https://p2p.org/economy/content/images/size/w1000/2020/09/5-3.png 1000w, https://p2p.org/economy/content/images/size/w1600/2020/09/5-3.png 1600w, https://p2p.org/economy/content/images/2020/09/5-3.png 1902w" sizes="(min-width: 720px) 720px"></figure><p>Press <code>Save</code> and backup your account.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/6-1.png" class="kg-image" alt loading="lazy" width="1901" height="863" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/6-1.png 600w, https://p2p.org/economy/content/images/size/w1000/2020/09/6-1.png 1000w, https://p2p.org/economy/content/images/size/w1600/2020/09/6-1.png 1600w, https://p2p.org/economy/content/images/2020/09/6-1.png 1901w" sizes="(min-width: 720px) 720px"></figure><p>For secure staking you will need to have at least two accounts:</p><p><strong><strong>Stash</strong></strong> - the primary account that holds the funds. The funds can be kept in a cold wallet and all bonded DOT are locked. After unbonding, users must wait for 28 days before they can access the locked funds.</p><p><strong><strong>Controller</strong></strong> - a separate account to control and perform staking commands for stash account, like changing nominations, starting or stopping nominating and so on. It needs to have sufficient funds in DOT to pay for transaction fees when actions are taken.</p><p>Now you have created one account that initially will perform both functions. It will appear in your <code>Accounts</code> tab. <strong><strong>After enablement of token transfers</strong></strong>, it is recommended to create a separate account, send 1 DOT to it and use it as a controller.</p><h1 id="create-an-account-using-polkadotjs-browser-extension"><strong>Create an account using PolkadotJS browser extension</strong></h1><p>As an alternative way of creating Polkadot account you can use Polkadot.JS browser extension. It is available for Chrome and Mozilla users.</p><p>First install the extension:</p><ul><li><a href="https://addons.mozilla.org/en-US/firefox/addon/polkadot-js-extension?ref=p2p.org">Mozilla</a></li><li><a href="https://chrome.google.com/webstore/detail/polkadot%7Bjs%7D-extension/mopnmbcafieddcagagdcbnhejhlodfdd?hl=en&ref=p2p.org">Chrome</a></li></ul><p>You will see the orange logo in the menu bar.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/7-1.png" class="kg-image" alt loading="lazy" width="1877" height="766" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/7-1.png 600w, https://p2p.org/economy/content/images/size/w1000/2020/09/7-1.png 1000w, https://p2p.org/economy/content/images/size/w1600/2020/09/7-1.png 1600w, https://p2p.org/economy/content/images/2020/09/7-1.png 1877w" sizes="(min-width: 720px) 720px"></figure><p>Open the PolkadotJS plugin and press <code>Create New Account</code> or simply press the cross in the middle.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/8-1.png" class="kg-image" alt loading="lazy" width="800" height="887" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/8-1.png 600w, https://p2p.org/economy/content/images/2020/09/8-1.png 800w" sizes="(min-width: 720px) 720px"></figure><p>Write down or copy your seed phrase and go to the next step. If you will try to paste it before finishing the process, extension window will close so you will need to repeat this step.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/9-1.png" class="kg-image" alt loading="lazy" width="800" height="887" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/9-1.png 600w, https://p2p.org/economy/content/images/2020/09/9-1.png 800w" sizes="(min-width: 720px) 720px"></figure><p>Choose the name of account and set a secure password. Press the orange button.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/10.png" class="kg-image" alt loading="lazy" width="800" height="887" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/10.png 600w, https://p2p.org/economy/content/images/2020/09/10.png 800w" sizes="(min-width: 720px) 720px"></figure><p>You will see the account in the extension menu. Now you can paste a seed phrase if you copied it in a previous step. Now check that address displays as a Polkadot mainnet address that should start from "1". Press a "gear" in the right top corner. In the dropdown menu choose Polkadot (live). Click <code>back</code> and you will see that address will transform. Now you can copy it to save as a plain text.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/11.png" class="kg-image" alt loading="lazy" width="800" height="885" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/11.png 600w, https://p2p.org/economy/content/images/2020/09/11.png 800w" sizes="(min-width: 720px) 720px"></figure><p>Download a backup JSON by pressing three dots and choosing <code>Export Account</code>. The extension will ask you to enter the password which you specified in a previous step.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/12.png" class="kg-image" alt loading="lazy" width="800" height="887" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/12.png 600w, https://p2p.org/economy/content/images/2020/09/12.png 800w" sizes="(min-width: 720px) 720px"></figure><p>Now you can visit <a href="https://polkadot.js.org/apps/?ref=p2p.org#/accounts">Polkadot UI</a> and let the extension to add your account. If there was no such intention you can simply press <code>Restore JSON</code> and drug the backup file saved in a previous step. Even if you haven't changed the address format to Polkadot (live) in extension it still can be imported to the <a href="https://polkadot.js.org/apps/?ref=p2p.org#/accounts">Polkadot UI</a> and transformed in a <code>Settings</code> tab.</p><figure class="kg-card kg-image-card"><img src="https://p2p.org/economy/content/images/2020/09/13.png" class="kg-image" alt loading="lazy" width="1899" height="860" srcset="https://p2p.org/economy/content/images/size/w600/2020/09/13.png 600w, https://p2p.org/economy/content/images/size/w1000/2020/09/13.png 1000w, https://p2p.org/economy/content/images/size/w1600/2020/09/13.png 1600w, https://p2p.org/economy/content/images/2020/09/13.png 1899w" sizes="(min-width: 720px) 720px"></figure><p>For secure staking you will need to have at least two accounts:</p><p><strong><strong>Stash</strong></strong> - the primary account that holds the funds. The funds can be kept in a cold wallet and all bonded DOT are locked. After unbonding, users must wait for 28 days before they can access the locked funds.</p><p><strong><strong>Controller</strong></strong> - a separate account to control and perform staking commands for stash account, like changing nominations, starting or stopping nominating and so on. It needs to have sufficient funds in DOT to pay for transaction fees when actions are taken.</p><p>Now you have created one account that initially will perform both functions. It will appear in your <code>Accounts</code> tab. <strong><strong>After enablement of token transfers</strong></strong>, it is recommended to create a separate account, send 1 DOT to it and use it as a controller.</p><h1 id="about-p2p-validator"><strong>About P2P Validator</strong></h1><p><a href="https://p2p.org/?utm_source=blog&utm_medium=economy&utm_campaign=polkadot_create_account">P2P Validator</a> is a world-leading non-custodial staking provider securing more than $3 billion by over 10,000 delegators/nominators across 25+ high-class networks. We have been present in all Polkadot testnets and have been actively participating on Kusama network since the beginning. P2P Validator invested its own funds in Polkadot in 2017 and intends to support the network in the long term.</p><hr><p><em><em>Now you have an account in Polkadot. The next step is to <a href="https://p2p.org/economy/how-to-claim-dot-tokens-with-pokadot-js">claim DOT</a> and <a href="https://p2p.org/economy/how-to-nominate-validators-in-polkadot">start nominating</a>. If you have any questions, join our <a href="https://t.me/P2Pstaking?ref=p2p.org">Telegram chat</a> or contact Alex via [email protected], we will be happy to help.</em></em></p><hr><p><strong><strong>Web:</strong></strong><a href="https://p2p.org/?utm_source=blog&utm_medium=economy&utm_campaign=polkadot_create_account"> https://p2p.org</a></p><p><strong><strong>Stake DOT with us:</strong></strong> <a href="https://p2p.org/polkadot?utm_source=blog&utm_medium=economy&utm_campaign=polkadot_create_account">https://p2p.org/polkadot</a></p><p><strong><strong>Twitter:</strong></strong><a href="https://twitter.com/p2pvalidator?ref=p2p.org"> @p2pvalidator</a></p><p><strong><strong>Telegram:</strong></strong> <a href="https://t.me/P2Pstaking?ref=p2p.org">https://t.me/P2Pstaking</a></p>
from p2p validator