Friday, June 4, 2010

ACLs to mitigate spoofed IP addresses

ACL (COMMON) ENTREE FORMULA:
Permit/Deny [protocol] [sourceIP] [InvertedSourceMask] [DestinationIP] [InvertedDestMask] eq [optionalPort#]




Ok, here is a subject that I have been going back and forth on in a forum. First we will use some logic. You have private IP addresses that are non routable on the internet (10.0.0.0 192.168.0.0 172.16.0.0 127.0.0.0 etc.), so we conclude that these addresses should never being entering the outside of your firewall.

Just looking at that angle, we can then put some deny statements on our OUTSIDE inbound interface (traffic from the internet) to deny them before we permit traffic to our web servers.

deny ip 10.0.0.0 0.255.255.255 any
deny ip 172.16.0.0 0.15.255.255 any
deny ip 192.168.0.0 0.0.255.255 any
permit tcp any [webserverIP] eq 80



Remembering that ACLs are read sequentially from the top, we have just denied anyone who tried to spoof their source IP as a private address from accessing our web server, and allowed everyone else on the internet in on port 80. We can rely on the implicit deny at the end to block all traffic to any other ports on our webserver.


Now what if there is a user inside your network trying to spoof IP addresses. I would suggest having ACLs on each of your routers. If building A has a subnet of 172.16.45.0/24, then you can apply an ACL such as the following to make sure ONLY addresses from inside that subnet are allowed out. (You need to allow it to any, unless you want to specify every website your users are allowed to visit... unlikely.)

permit ip 172.16.45.0 0.0.0.255 any

Unless of course you have a proxy server, then you can really tighten your ACL with:

permit tcp 172.16.45.0 0.0.0.255 [webProxyIP] 0.0.0.0 eq 8080

this allows ONLY your subnet (no other spoofed IPs) to access ONLY your proxy server ONLY on port 8080.


Basically, you just need to draw out your network, and write ACLs to make sure only those addresses that you have provided (DHCP or STATIC) are allowed to be used as source addresses. Also remember that private IP addresses should NEVER be entering your network from your ISP.

Thursday, June 3, 2010

LISP

I don't believe it is part of the CCNP yet, but cisco is pushing LISP and it could show up in the future. LISP (Locator ID Separation Protocol) is an open standard created by cisco. It attempts to reduce complexity and simplify Routing over the internet.

LISP separates the routing locator from the endpoint identifier into two numbering spaces. Primarily, this means routers will have far smaller routing tables if the routing table only has to hold the route portion of addresses. The host portion of the address is encapsulated inside the route headed packet. This is also intended to make multi-homing far easier, aimed at medium to small sized businesses. Multi-homing is "load leveling" between separate ISPs.

LISP works between LISP and non LISP networks, LISP IPv4 to IPv6, and two LISP IPv6 sites can communicate overtop of an IPv4 ISP network between them (or IPv4 to IPv4 over a fully IPv6 network).

More information at lisp4.cisco.com
Facebook is one of the big beta testers at www.lisp4.facebook.com

Wednesday, June 2, 2010

Format Change

I played around with the colors and format to make the bold commands pop out more. Also stretches width with browser so my graphics aren't permanently shortened. Anyone have thoughts feel free to comment. I can go back to black and gray or some other color scheme without much problem.

DAI (Dynamic Arp Inspection)

First, if anyone doesn't know about DHCP snooping, you may want to read the previous post about it, although all you need to know in regard to DAI is that you need to turn DHCP snooping on, and it will collect a database of IP/MAC/Interface/Leasetime/etc. of all DHCP requests it sees. You can also statically add addresses for static IP'd devices.

Next, I'll quickly explain ARP and CAM tables. Every switch stores a copy of what mac address(es) are located off each interface in a CAM table (content addressable memory). If the host hasn't sent or received a packet in a while (or is unplugged), the mac address will time-out and be removed from the cam table. To find that mac address next time a packet comes, the switch must broadcast (flood) out packets to all switch ports and wait for a response.

ARP is the address resolution protocol. Routers keep an ARP table, or a list of what IP addresses match what mac addresses. (view with the command: show IP arp) The router is then able to rewrite the destination mac address on incoming packets to the matching IP/MAC entree so that the layer 2 edge switches can find the host (since layer 2 switches ONLY understand mac addresses, know your OSI model).

For example: The diagram describes a regular ARP request. The router must flood out an ARP request to find the destination host's mac address, re-write the packet header and then is able to send the packet. (This ARP request/cam table fill, is why the first ping of a host that hasn't sent packets lately or is new to the network will always fail. The second or third will work correctly.)





Now, what if people didn't play so nicely. What if a malicious host on port 2 of the layer 2 switch responded to the ARP request before the real client saying THEY had mac address bbbb.1111.bbbb and IP address 192.168.5.3. The router would update it's ARP table to match 192.168.5.3 with mac bbbb.1111.bbbb, and the switch would include the mac in it's cam table for port 2. Any new packets sent to 192.168.5.3 would be sent to the malicious host, who can then forward it to the real host after assessing it's contents if it wishes. This attack is known as ARP spoofing or ARP poisening.

Enter Dynamic ARP inspection. DAI works similar to DHCP snooping, in that all ports need to be set as either trusted or untrusted. All packets entering an untrusted port are intercepted and checked, while trusted ports (switch uplinks) pass traffic without DAI checking anything. If a packet enters an untrusted port but doesn't match the information gathered either statically or in the DHCP snooping database, the packet is dropped and a log message created.

Commands: (Assuming you already have DHCP snooping running) turn on DAI on client vlans.

Switch(config)#ip arp inspection vlan vlan range

All switch ports in those vlans are now considered un-trusted. Make any switch uplinks or explicitly trusted ports trusted with the interface command

switch(config-if)#ip arp inspection trust

For static IPs that are not included in the DHCP snooping database, you can use an access-list. (Note that this is not a regular ACL as it includes a mac address and only the sender information. This is specifically an arp ACL)

arp access-list aclName
permit ip host senderIP mac host sender Mac Address [log]
(repeat this as needed for more static entrees)
exit
ip arp inspection filter aclName vlan Vlan range



One further thing you can do. By default this only checks the ARP reply's message body, you can also verify the ARP reply's packet header for further security.

ip arp inspection validate {[src-mac] [dst-mac] [ip]}

Tuesday, June 1, 2010

IP Source Guard

Ok, so last time we talked about how DHCP snooping can mitigate a man-in-the-middle attack. This was when a rogue DHCP server sends out it's own DHCP replies with itself as the default gateway, snoops the packet, then sends it on to the true default gateway so users would never know anything was wrong. DHCP snooping blocks those untrusted DHCP replies and creates a binding table of all the client IP addresses. We can now look at IP Source Guard.

In general, IP addresses are assigned and used "on the honor system" with nothing in place to make sure clients are only using their own. Common uses are to disguise denial of service attacks. If a lot of requests could come from an IP address, but their is no return address to send the replies to, or to track down the offending computer.

Between vlans this might be simple to detect, if the 192.168.5.0 network is in vlan 5, then that network appearing out of any other vlan can be dropped. What about when the spoofed IP address is inside the proper vlan, the user is just using a random or stolen IP from inside it's own subnet?

IP source guard comes into play. Using the DHCP snooping database or statically entered bindings, all packets entering the switch verify that the port, IP address, and mac address all match the database or the packet is dropped.

Turn this feature on by entering each interface and adding:
Switch(config-if)#ip verify source [port-security]
(Port security can be added to verify the mac addresses).

show ip verify source will show you the status of your IP source guard configurations.