{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/8282","repository_url":"https://api.github.com/repos/bitcoin/bitcoin","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/8282/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/8282/comments","events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/8282/events","html_url":"https://github.com/bitcoin/bitcoin/pull/8282","id":162739771,"number":8282,"title":"net: Feeler connections to increase online addrs in the tried table.","user":{"login":"EthanHeilman","id":274814,"avatar_url":"https://avatars.githubusercontent.com/u/274814?v=3","gravatar_id":"","url":"https://api.github.com/users/EthanHeilman","html_url":"https://github.com/EthanHeilman","followers_url":"https://api.github.com/users/EthanHeilman/followers","following_url":"https://api.github.com/users/EthanHeilman/following{/other_user}","gists_url":"https://api.github.com/users/EthanHeilman/gists{/gist_id}","starred_url":"https://api.github.com/users/EthanHeilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EthanHeilman/subscriptions","organizations_url":"https://api.github.com/users/EthanHeilman/orgs","repos_url":"https://api.github.com/users/EthanHeilman/repos","events_url":"https://api.github.com/users/EthanHeilman/events{/privacy}","received_events_url":"https://api.github.com/users/EthanHeilman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bitcoin/bitcoin/labels/P2P","name":"P2P","color":"006b75"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-06-28T17:19:43Z","updated_at":"2016-07-01T21:08:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/8282","html_url":"https://github.com/bitcoin/bitcoin/pull/8282","diff_url":"https://github.com/bitcoin/bitcoin/pull/8282.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/8282.patch"},"body":"These changes implement countermeasures 3 (feeler connections) suggested in our paper: \"Eclipse Attacks on Bitcoin’s Peer-to-Peer Network\".\r\n\r\nDesign:\r\n=========\r\nWe observe that a node's resistance to eclipse attacks grows as the number of online addresses in the tried table grows. To increase the number of online addresses in the tried table the following logic is implemented in net.cpp's ThreadOpenConnections:\r\n\r\n1. Every 2 minutes a short lived *feeler connection* is made to a randomly selected address in new.\r\n2. If the tested address is online and running bitcoind, this address is moved to the tried table.\r\n3. The feeler connection to the tested address is closed.\r\n\r\nOnly one feeler connection is attempted at any one time and feeler connections are only attempted after all outgoing connections slots of filled.\r\n\r\nAdvantages:\r\n=========\r\n\r\n* In our paper we sample several peer lists. We found that a large percentage of addresses in tried tables are stale IP addresses (the lowest was 72 percent stale, the highest was 95 percent stale). This large number of stale IP addresses increases the risk of eclipse attacks. This change remedies this by ensuring that the tried table grows quickly and contains many recently online addresses.\r\n\r\n* Not only do feeler connections provide a direct benefit to the node doing the testing but the tested node, if online, learns about our node and adds it to its tried table (conferring herd immunity even under partial deployment).\r\n\r\n* Countermeasure 3 (test-before-evict) builds on the feeler connections introduced in this change. This is the first step to deploying countermeasure 3.\r\n\r\nRisk mitigation:\r\n========\r\n\r\n* To limit the network impact of the feeler connections we only make one new connection every 2 minutes. Compared with other networking tasks that bitcoind performs the bandwidth increase is very slight.\r\n\r\n* To avoid issues of synchronization we introduce a random sleep of between 0 and 1000 milliseconds prior to making a feeler connection.\r\n\r\n* To avoid threading issues the feeler connections are made in the same thread as non-feeler connections.\r\n\r\nTest plan:\r\n=========\r\n1. I'm currently running two EC2 nodes with public IP addresses. One is running this pull request and the other is running standard bitcoind. Both are running with arg -debug=1. At the end of the week I will post results from the logs looking at differences in the size of the tried table and examining the logs for any errors. I will also use the peer.dat files generated from this test to evaluate each nodes resistance to eclipse attacks.\r\n\r\n2. I will also use packet captures to ensure behavior and bandwidth behaves as expected.\r\n\r\n3. I invite anyone would like to help to run standard and feeler connection nodes and email me (Ethan.R.Heilman@gmail.com) the pcaps, logs and peers.dat files. I will post the results of this analysis here.\r\n\r\nThis change was suggested as Countermeasure 4 in\r\n[Eclipse Attacks on Bitcoin’s Peer-to-Peer Network](https://eprint.iacr.org/2015/263.pdf),\r\nEthan Heilman, Alison Kendler, Aviv Zohar, Sharon Goldberg.\r\nePrint Archive Report 2015/263. March 2015."},"comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/230047759","html_url":"https://github.com/bitcoin/bitcoin/pull/8282#issuecomment-230047759","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/8282","id":230047759,"user":{"login":"EthanHeilman","id":274814,"avatar_url":"https://avatars.githubusercontent.com/u/274814?v=3","gravatar_id":"","url":"https://api.github.com/users/EthanHeilman","html_url":"https://github.com/EthanHeilman","followers_url":"https://api.github.com/users/EthanHeilman/followers","following_url":"https://api.github.com/users/EthanHeilman/following{/other_user}","gists_url":"https://api.github.com/users/EthanHeilman/gists{/gist_id}","starred_url":"https://api.github.com/users/EthanHeilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EthanHeilman/subscriptions","organizations_url":"https://api.github.com/users/EthanHeilman/orgs","repos_url":"https://api.github.com/users/EthanHeilman/repos","events_url":"https://api.github.com/users/EthanHeilman/events{/privacy}","received_events_url":"https://api.github.com/users/EthanHeilman/received_events","type":"User","site_admin":false},"created_at":"2016-07-01T21:08:57Z","updated_at":"2016-07-01T21:08:57Z","body":"I added a simple test and an assert to ensure that that fFeelers are set false by default and don't get assigned to incoming connection."}}
{"actor":{"display_login":"EthanHeilman"}}