Skip to content
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

Make resilient to DDOS attack #45

Open
connorcarpenter opened this issue Apr 21, 2022 · 1 comment
Open

Make resilient to DDOS attack #45

connorcarpenter opened this issue Apr 21, 2022 · 1 comment
Labels
feature desired new functionality naia pertaining to naia crates

Comments

@connorcarpenter
Copy link
Member

Could someone, given a public IP address of a NaiaServer, and clever usage of this open-source code (a modified or unmodified NaiaClient) DDOS our server? How can we protect against this?

I'm definitely looking for advice / input here, so if you've got any, please tell me.

Possibly Useful Additions:

  1. On a per-IP-address basis, allow some "suspicion" value to be accumulated for suspicious behavior. "suspicion" degrades slowly over time, but after some max level, terminates the connection. Every time the IP-address attempts to re-establish the connection thereafter, "suspicion" is raised.

If the IP-address "suspicion" levels are sufficiently high, blacklist the IP. The IP may only be allowed to re-connect once "suspicion" levels have degraded to some necessary minimum (unless placed on the blacklist). We may require some ability to clear a Server's blacklist manually ?

  1. https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L236 at this point is useful, to refresh the connection with the client, but we should be checking whether there has been an established connection AFTER reading the packet_type from the StandardHeader.

This would allow us to detect when a client is sending packets of a type that typically precedes Connection establishment. Some of this is expected, but too many packets, especially after a long duration, should raise "suspicion" levels.

  1. At this point: https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L288 we are receiving ClientConnectRequest packets AFTER the Connection has been established ... this should raise "suspicion" levels.

  2. Non-matching Challenge Timestamps should raise "suspicion" levels. https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L303

  3. Invalid ServerDigest should raise "suspicion" levels: https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L326

  4. Unsuccessful Auth attempts should raise "suspicion" levels: https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L341

  5. Pings, Data, and Heartbeat packets from un-authed clients should raise "suspicion" levels: https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L386, https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L406, https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L441

  6. Invalid PacketType from StandardHeader should raise "suspicion" levels: https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L449

  7. Errors should raise "suspicion" levels: https://github.com/naia-rs/naia/blob/984673ebe65b0f38e76973f56081d8b9e53bc7c0/server/src/naia_server.rs#L453

@connorcarpenter connorcarpenter added naia pertaining to naia crates feature desired new functionality labels Apr 21, 2022
@Veritius
Copy link
Contributor

Ideally, the termination threshold for suspicion would be optional and set on a per-app basis in config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature desired new functionality naia pertaining to naia crates
Projects
None yet
Development

No branches or pull requests

2 participants