Capture HTTP GET packets from a variety of browser platforms. Compute the maximum HTTP payload size (the size of the HTTP protocol data unit) and subtract the length of the URL path in the GET request. This length represents the "HTTP overhead." Now add 54 bytes (for the Ethernet, IP and TCP headers) and the length of the longest path in your document root. If you are serving active content, you must include the longest possible query string as you consider the longest possible path. This number represents the longest legitimate packet you should ever receive.
Suppose your total is 700 bytes. A firewall rule to drop excessive packets would look like this:
iptables -A INPUT -i eth0 -p tcp --dport 80 -m length --length 701:1536 -j DROPImplement such a firewall rule and test it, first sending a legitimate request, and then increasing the size of the request by manually typing additional query string characters on the end of the original query string. Use iptables -L -v to examine the dropped packet and bytes counts associated with your request.
What are the logistical difficulties in implementing such a rule on an enterprise server?
©2008, Kenneth R. Koehler. All Rights Reserved. This document may be freely reproduced provided that this copyright notice is included.
Please send comments or suggestions to the author.