-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
autonat: don't use AutoNAT to discover addresses #2102
Comments
According to the address validation logic (see spec), an AutoNAT implementation will only accept dial-back requests originating from IP addresses that don't match the remote IP address of the connection that the request was received on. Since the node will only dial us back on addresses we send in the dial-back request, this means that assuming a spec-compliant peer, it should be impossible to discover new addresses via AutoNAT. At best, the logic we have is worthless. This mechanism however could be used by a malicious peer to feed us incorrect addresses. This is not a very interesting attack, since 1. the node will only advertise a single such address, and only until we've obtained a new AutoNAT observation (15 minutes refresh interval) and 2. it's not replacing any addresses, we're just adding this address to our list of addresses. |
STUN RFC suggests an attack here
Could this mechanism of using autonat for address discovery have been used to launch such attacks. The attacker runs a malicious autonat server and to all dialback requests it responds with the ip of the target. These dialback clients will then possibly advertise this address as their address for 15 minutes and this would lead to increased traffic on the target. Metrics on a kubo node show that a particular node doesn't get many dial requests so this would have been mostly fine. However we should keep this scenario in mind for future changes. @marten-seemann thoughts? |
Yes, there’s a million ways to have clients traffic some way. You don’t even need AutoNAT for that. libp2p comes with a number of address discovery mechanisms, and I bet you could use every single one of them. This is also not limited to libp2p. Every webserver can embed an image from a target in the HTML code. At some point you’ll need to accept the fact that if you’re running a publicly reachable server, you’ll have to deal with incoming connections. So what does mean for our DoS defenses? Realistically, all that we hope to achieve is making these attacks cumbersome enough that they’re not very attractive. Ideally, we can also achieve some smoothing, so an attacker is not able to create a short-lived burst of traffic that might be able to overwhelm a server, but realistically, there’s also just so much we can do. |
It's used in the PublicAddr method which is used by host.AllAddrs.
This seems to me that it is mostly redundant information with information received from the ObservedAddressManager.
Originally posted by @sukunrt in #2092 (comment)
The text was updated successfully, but these errors were encountered: