Some time ago I had a discussion with a friend. He disagreed with my recommendations on how to configure a border router and the firewall behind it. I claimed that in the border router between you and your ISP, configure the six rules to block most denial of service traffic; in the firewall, configure additional packet filtering and content inspection. He claimed that it’s better to repeat the router rules in the firewall, and if possible repeat the firewall rules in the router.
This struck me as disingenuous: “Why do the same work twice?” I asked. “It’s defense in depth,” came the expected reply. “If a bad guy gets through the router, maybe the firewall will stop him.”
No, it isn’t defense in depth. Defense in depth is about doing the correct things at all layers, and only things that are appropriate for each layer. When defense in depth degenerates into duplication of effort, the resulting security posture becomes more brittle and, arguably, less secure.
There are three kinds of vulnerabilities:
- Code: an error in the software that you fix with a patch
- Configuration: an error a human made while setting something up
- Circumvention: an error in a security policy that encourages people to look for ways to get around the policy
By far, the most commonly occuring type (according to some research from CERT) is the second: configuration vulnerabilities. Given that it’s far more likely for me to make a mistake in my rules than for the code in the router or firewall to be buggy, it’s far more likely for a bad guy to break in through my error-ridden rules than for him to break in through a code vulnerability in either device.
Complexity is the enemy of security. Simplicity always wins. Therefore, to keep a network simple (and more secure), ensure that your defense in depth measures are tuned and specific for each layer, not merely duplicates of something you’ve taken care of at another layer.
Blocking DOS attacks
Now, back to the title of this post. In a border router, you should have six rules that will block almost all denial of service attacks. Remember the attack against the Internet in February 2000? Mafiaboy, the 17-year-old Canadian script kiddie, brought down 11 sites using 75 computers in 52 countries to send 10,700 messages in 10 seconds, causing an estimated $1.7 billion in damages. (Canadian police discovered him from his boasting in chat rooms. In 2001 he pled guilty to 56 charges and was sentenced to two years in a juvenile detention center).
Why did Yahoo, Buy.com, eBay, CNN, Amazon.com, ZDNet, ETrade, Dell, and Excite all succumb to the attack? Because they lacked one or more of these six important rules. MSN and Microsoft were targeted, but because our routers have these rules, we escaped the attack. The rules:
- Block all inbound traffic where the source address is from your internal networks. Why in the world would there be traffic on the outside that originates from the inside? This is a sign that someone is spoofing you.
- Block all outbound traffic where the source address isn’t from your internal networks. This is the inverse of #1: there’s never any reason for your network to emit traffic that’s sourced from some other network. Somone on the inside is spoofing someone else (we have a term for such people: employee).
- Block all inbound and outbound traffic where the source or destination addresses are from the private address ranges. Defined in RFC1918, these addresses are for use in internal networks; ISPs agree not to route such traffic. Of course, ISPs make configuration mistakes, too; I’ve seen traffic with these addresses on the Internet. So don’t trust that your ISP is perfect, block the stuff yourself. And remember to include the Windows automatic private IP addressing block. The ranges, then, are: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and 169.254.0.0/16.
- Block all source-routed packets. Way back in 1970, when “routers” were Unix computers running a routing deamon, they weren’t all that reliable. So IP includes a provision for the headers of a packet to indicate the route the packet should take from its source to its destination. Source-routing was necessary then, but it’s completely unnecessary today: routers are some of the most reliable gear around. Source-routed traffic is the sign of an attack: drop it all.
- Block all broadcast packets, including directed broadcasts. Broadcasts are useful inside a network, but have pretty much zero utility between networks, so don’t let the stuff in (or out). And good old smurf attacks, still seen as a form of revenge in IRC, rely on directed broadcasts. [Thanks to Michael Dragone for suggesting this additional rule.]
- Block all packet fragments. Fragrouter is an old but wonderful tool, imminently useful for evading network intrusion detection. With it, an attacker can create packet fragments — TCP or UDP packets missing the TCP or UDP header — and, for example, map out your firewall policy and prod for holes and mistakes in your configuration. With one notable exception, fragments are generally not created, so there’s no reason to permit them into your network. What’s the exception? IPsec — or, more precisely, IKE authentication in IPsec. During the authentication sequence, IKE performs six round trips between the peers. As the peers negotiate a protection suite and exchange keys, IKE generates fragments: very rarely will the key fit in a single packet. So if you’re allowing IPsec between the Internet and something behind your border router, you’ll need to skip this final rule.
There you go. Program these six rules in your border router (and consider dropping whatever else you’ve got there now) and you, too, can tell the likes of Mafiaboy to go pound sand. Oh, and guess what? By being more secure yourself, you directly affect — negatively — the security posture of your neighbors and competitors! Did you ever think that a router configuration could become strategic competitive advantage? 🙂