Null-packet Protection 
37 comments If you're running a linux dedicated server and you don't have root access to set up iptable rules to mitigate these recent DoS attacks, you can now fix this from within Lua.
Just drop patch.so into sys/lua/patch.so and add
into server.lua.

Notice how the server is still processing new packets after null-packets are sent into it.
Just drop patch.so into sys/lua/patch.so and add
Code:
1
require 'sys.lua.patch'
into server.lua.

Notice how the server is still processing new packets after null-packets are sent into it.

Comments
37 commentsLog in!
You need to log in to be able to write comments!Log in

@
floria: You completely misunderstood
Yates's comment. Not everybody is a Linux-geek especially when setting up iptable rules and exceptions within firewall configuration. Proper teaching and learning won't hurt but you can't apply to every single person as not everybody likes to read much.
Are you a Linux newbie? Get this tool! Can't set up iptable rules due to lack of administrative rights for some reason? Get this tool!


Are you a Linux newbie? Get this tool! Can't set up iptable rules due to lack of administrative rights for some reason? Get this tool!


Very useful for those who are not or cannot into Linux.
Dude Linux can be used in almost all pc's around the world. You can even use cs2d dedicated without graphical interface. You don't even need to install a linux distro in order to run it. And if you are not on Linux, download a freaking Ubuntu distro and run it into a VM. That's all: Linux > Windows.


It very nice
i think need add in debug like it "Caught a null packet from 127.0.0.1:2343".

i think need add in debug like it "Caught a null packet from 127.0.0.1:2343".
Yes, it's effectively the same thing. This script is targeted at people who don't have access to iptables for whatever reason, as long as they can upload scripts, they can still seek protection.
A friend of mine said this script is the same of: sudo iptables -A INPUT -p udp -m length --length 0:28 -j DROP
The description tells me its compatible with Linux, it does not tell anything about windows and so I was asking to make sure.

@
Mami Tomoe: If the description tells you that it's compatible with Linux dedicated servers, then what do you think?

@
mrc: is it still on-going? Furthermore, have you restarted your server since your original iptable rule? These rules are not persistent unless you are explicit about such things.
One of the things to note is that if ./cs2d_dedicated is inundated with random packets, it will take forever to process everything, but nevertheless, if you look at the log or the standard output of the process, it will still run smoothly. More importantly, it shouldn't crash. If your server is getting DDoSed and your process runs out of available space because of the incoming packets, then it means that the attacker is sending a sequence of well-formed packets that CS2D understands one after the other to trigger non-trivial workload. If I were you, I would set up a passive sniffer on 36963 and create a frequency table of the occurrence of each packet type broken down by each minute. Next time you get taken down, consult this histogram to see what's going on, and then create an iptable rule based on that.

One of the things to note is that if ./cs2d_dedicated is inundated with random packets, it will take forever to process everything, but nevertheless, if you look at the log or the standard output of the process, it will still run smoothly. More importantly, it shouldn't crash. If your server is getting DDoSed and your process runs out of available space because of the incoming packets, then it means that the attacker is sending a sequence of well-formed packets that CS2D understands one after the other to trigger non-trivial workload. If I were you, I would set up a passive sniffer on 36963 and create a frequency table of the occurrence of each packet type broken down by each minute. Next time you get taken down, consult this histogram to see what's going on, and then create an iptable rule based on that.