-
Notifications
You must be signed in to change notification settings - Fork 226
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
(DoS vector?) Peers are removed from the routing table on Disconnect #45
Comments
The Kademlia paper assumes UDP so there isn't any concept of a disconnection. It only removes them when you try to send them a rpc message and it times out. |
Yes, I think that's right. To quote the white paper:
Eviction should happen if the following three conditions are met:
Eviction on disconnect is probably too aggressive. |
@JustinDrake hrm... youre right. We should fix this. |
We should probably set a reasonably short timeout on the eviction ping though, don't want to sit around for ages waiting on that. |
Awesome. I'd love to have this bug fixed for the public release of OpenBazaar 2.0 as it affects Duo. I'd be happy to help, e.g. by doing a code review. As mentioned in #31, we probably want to use the Kademlia
Yes. To speed things up further we can use heuristics such as:
|
@JustinDrake Sounds good. I'll try and get this done ASAP for you guys. |
@whyrusleeping Have you made any progress on this? It would be great to have this for the initial release of OpenBazaar 2.0. |
Just a quick note on the above thread, as I have recently been studying Kademlia for the Ethereum peer discovery protocol and have it fresh in my mind. The M&M paper contradicts itself somewhat in more than one place. The above observation that the oldest node in the k-bucket should be pinged is correct, but the paper supersedes itself towards the end of the document by advising against doing that, as it could cause a ping storm. They recommend maintaining a cache of possible replacement nodes, but as cpacia correctly points out, to only remove the oldest kbucket node when a meaningful rpc call fails at some later stage, replacing the oldest node with the most recent from the replacement cache. Just an FYI. |
@FrankSzendzielarz interesting observation, thank you! |
Let's please keep this issue on topic, if there are observations or comments unrelated to the disconnect behaviour please continue those in an appropriate issue. I am currently looking into the disconnect behaviour. |
Fixed. |
Currently when a peer disconnects, the peer is removed from the routing table. To me this seems needlessly aggressive. Shouldn't the Kademlia least-recently seen eviction policy deal with clearing inactive nodes? Certainly a node shouldn't be evicted from the routing table for a temporary disconnection.
I don't see this remove-on-disconnect policy in the Kademlia whitepaper, and to my eye it is a DoS attack vector. An attacker can flood a victim at the network level to force the temporary closure of all its connections. This would flush the node's routing state, and the attacker could then fill the victim's routing table with bad nodes.
Even in a non-hostile scenario, if a node is temporary shut off from the internet (e.g. for just a few minutes), then it needlessly has to repopulate its routing table from scratch.
Am I missing something obvious?
The text was updated successfully, but these errors were encountered: