Ipv6 Security Threats and Mitigation Eric Vyncke, Distinguished System Engineer [email protected] @Evyncke
Total Page:16
File Type:pdf, Size:1020Kb
Advanced IPv6 Security Threats and Mitigation Eric Vyncke, Distinguished System Engineer [email protected] @evyncke BRKSEC-3200 Session Objectives • Advanced IPv6 security topics like extension headers, transition options and dual stack environments • Including more details on attack • Main focus is on enterprise issues • Requirements: good knowledge of the IPv6 and IPsec protocols as well as IPv4 & IPv6 network security best practices (for example BRKSEC-2003 from www.ciscolive.com) 3 Roadmap For IPv6 Security Sessions BRKSEC-2003 Introduction to IPv6 Security: Threats and Mitigation www.ciscolive.com BRKSPG-2603 How to Securely Operate an IPv6 Network BRKSEC-3003 BRKSEC-3200 Advanced IPv6 Security in Advanced IPv6 Security: Operation the LAN Threats and Mitigation Architecture and design BRKSEC-3036 Advanced IPsec LTRSEC-3001 Advanced - IOS designs with FlexVPN FlexVPN Lab Dual-stack Products 4 For Your References... Reference • There are more slides in the hand-outs than presented during the class • Those slides are mainly for reference and are indicated by the book icon on the top right corner (as on this slide) • Some slides have also a call-out to another session (see below) BRKSEC- 3003 • Other slides are about demos and experiments (not to be repeated on a production network) 5 Agenda • Routing security • “Playing” with extension headers • More on tunnels and dual-stack • Enforcing a security policy • Summary “Experiment” with IPv6-only over WiFi at Cisco Live SSID: CL-NAT64 Passphrase: cl-nat64 6 Routing Security 7 IPv6 Bogon and Anti-Spoofing Filtering • Bogon filtering (data plane & BGP route-map): http://www.cymru.com/Bogons/ipv6.txt • Every network should implement two forms of anti-spoofing protections: • Prevent spoofed addresses from entering the network • Prevent the origination of packets containing spoofed source addresses • Anti-spoofing = uRPF Inter-Networking Device with uRPF Enabled IPv6 IPv6 Intranet X Intranet/Internet IPv6 Unallocated No Route to SrcAddr => Drop Source Address 8 For Your IPv6 uRPF and Cisco Devices Reference The Theory-Practice Gap • Supported everywhere except: • 7600 & Cat 6K • Sup720/32: no IPv6 uRPF at all • Sup 2T is OK • Cat 3750: no uRPF at all • GSR 12K • only strict mode • only with Engine 5, other engines uRPF not supported • requires IOS 12.0(31)S or IOS-XR rls 2.1 • ASR 5K • ASR 9K requires release 4.1.1 • Metro switch • ASA enables IPv4 and IPv6 uRPF in the same command • No VRF mode yet for IPv6 9 Remote Triggered Black Hole (RFC 5635) BGP update:BGP update: BGP update: BGP update: BGP update:BGP update: Block 2001:db8::bad BGP update Block 2001:db8::bad NOC 2001:db8::bad . BGP allows you to ”announce” a host/subnet IP address which you want to drop traffic to or from . By enabling BGP on selected choke points, it becomes possible to control traffic dynamically 10 How Does RTBH Work? • It’s Magic! • BGP allows specifying the next-hop IP address in routing updates. • Other routing protocols automatically use the announcing device IP address as the next-hop • By setting the next-hop of an IP address to the RFC 6666 discard prefix 100::/64, we can create a routing update containing this specific IP address • This routing update which when received, will merge the routing update with a pre- defined static route on the receiving router: • ipv6 route 100::/64 Null0 • Now, the routing table contains a routing entry specifying that traffic for this address, will be sent to the Null0 interface • By default: drop all packets to this address • By using loose uRPF: drop all packets from this address (because interface is Null0) • http://www.cisco.com/web/about/security/intelligence/ipv6_rtbh.html 11 Edge (Dropping) Router Configuration Do not DoS ourselves by generating ICMP interface Null0 no ipv6 unreachables Generic BGP configuration for IPv6 ! (to be localized of course and care must be taken to avoid router bgp 65444 forwarding RTBH specific routes outside of your AS) bgp router-id 10.10.10.2 neighbor 2001:db8::1 remote-as 65444 ! address-family ipv6 neighbor 2001:db8:::1 activate ! ipv6 route 100::/64 Null0 Static route for the RFC 6666 discard prefix to the Null0 12 Trigger (NOC) Router Configuration interface Null0 Generic BGP configuration for IPv6 no ipv6 unreachables (to be localized of course and care must be taken to avoid ! forwarding RTBH specific routes outside of your AS) router bgp 65444 bgp router-id 10.10.10.1 neighbor 2001:db8::2 remote-as 65444 no auto-summary st ! 1 part of the “magic” to send address-family IPv6 some route with the discard next- neighbor 2001:db8::2 activate hop network 2001:db8:0:ff::/64 redistribute static route-map ipv6-rm ! route-map ipv6-rm permit 10 2nd part of the “magic” all routes match tag 66 with a tag of 66 will be sent with set local-preference 200 the discard next-hop set origin igp set ipv6 next-hop 100::1 route-map ipv6-rm deny 20 13 Two Final Touches to RTBH ipv6 route 2001:db8::bad/128 100::1 tag 66 Create a static route to 2001:db8::bad with tag 66, this will trigger a BGP update with next-hop 100::1 and all edge routers will drop packets to 2001:db8::bad interface Gigabit0/0/1 ipv6 verify unicast source reachable-via any [allow-default] But, usually we want to drop packet FROM an address, so uRPF must be configured at the edge routers 14 Preventing IPv6 Routing Attacks Protocol Authentication • BGP, ISIS, EIGRP no change: • An MD5 authentication of the routing update • OSPFv3 has changed and pulled MD5 authentication from the protocol and instead rely on transport mode IPsec (for authentication and confidentiality) • But see 6506 7166 (but not widely implemented yet) • IPv6 routing attack best practices • Use traditional authentication mechanisms on BGP and IS-IS • Use IPsec to secure protocols such as OSPFv3 15 For Your Reference OSPF or EIGRP Authentication interface Ethernet0/0 ipv6 ospf 1 area 0 ipv6 ospf authentication ipsec spi 500 md5 1234567890ABCDEF1234567890ABCDEF interface Ethernet0/0 ipv6 authentication mode eigrp 100 md5 ipv6 authentication key-chain eigrp 100 MYCHAIN key chain MYCHAIN key 1 key-string 1234567890ABCDEF1234567890ABCDEF accept-lifetime local 12:00:00 Dec 31 2011 12:00:00 Jan 1 2012 send-lifetime local 00:00:00 Jan 1 2012 23:59:59 Dec 31 2013 No crypto maps, no ISAKMP: transport mode with static session keys 16 “Playing” with Extension Headers 17 Packet Forgery with SCAPY /1 • Scapy is a open source packet forgery tool built on Python • Powerful albeit complex to understand and to use: evyncke@host1:~# scapy Welcome to Scapy (2.1.0) >>> target="2001:db8:23:0:60de:29ff:fe15:2” >>> packet=IPv6(dst=target)/ICMPv6EchoRequest(id=0x1234, seq=RandShort(), data="ERIC") >>> sr1(packet) Begin emission: Finished to send 1 packets. Received 2 packets, got 1 answers, remaining 0 packets <IPv6 version=6L tc=0L fl=0L plen=12 nh=ICMPv6 hlim=62 src=2001:db8:23:0:60de:29ff:fe15:2 dst=2001:db8:1:0:60de:29ff:fe15:1 |<ICMPv6EchoReply type=Echo Reply code=0 cksum=0xdb04 id=0x1234 seq=0x956a data='ERIC' |>> 18 18 Packet Forgery with SCAPY /2 • Variable can be assigned a value with “=“ • Packets are built with the concatenation operator “/” • Headers are instantiated with default values (such as source address, checksum, next header, length, ...) all can be overwritten • Packet can be displayed in various format: ls(), packet.show() • Packet can be sent by • send(): simply send it • sr1(): send it and wait for one reply >>> target="2001:db8:23:0:60de:29ff:fe15:2” >>> packet=IPv6(dst=target)/ICMPv6EchoRequest(id=0x1234, seq=RandShort(), data="ERIC") 19 IPv6 Routing Header • Processed by intermediate routers • Three types • Type 0: similar to IPv4 source routing (multiple intermediate routers) • Type 2: used for mobile IPv6 • Type 3: used by RPL (Routing Protocol for Low-Power and Lossy Networks) • Type (4?): segment routing Next Header = IPv6 Basic Header 43 Routing Header Routing Header Routing Header Next Header Ext Hdr Length RHRouting Type Type Segments Left Routing Header Data 20 Type 0 Routing Header Amplification Attack • What if attacker sends a packet with RH containing • A -> B -> A -> B -> A -> B -> A -> B -> A .... • Packet will loop multiple time on the link A-B • An amplification attack! A B 21 Type 0 Routing Header Traffic Rebound . Rule on the Firewall . Allow proto tcp from any to webserver port 80 . Deny proto tcp from any to any Web Host1 src=host1,dst=web, payload proto=tcp, dport=80 rtheader=host2, segments left=1 src=host1, dst=host2 rtheader=web, segments left=0 payload proto=tcp, IPv6 dport=80 Network Host2 Firewall 22 Preventing Routing Header-0 Attacks • Apply same policy for IPv6 as for IPv4: • Block Routing Header type 0(RH-0) • Prevent processing at the intermediate nodes but forwarding is OK • no ipv6 source-route • Windows, Linux, Mac OS: default setting • IOS-XR before 4.0: a bug prevented the processing of RH-0 • IOS before 12.4(15)T: by default RH-0 were processed • At the edge to block forwarding • With an ACL blocking routing header • RFC 5095 (Dec 2007) RH-0 is deprecated • Default changed in IOS 12.4(15)T and IOS-XR 4.0 to ignore RH-0 • ASA drops all packets with any routing header • Type 2 and type 3 (+SR – type 4) are not dangerous and should be allowed 23 Let’s Try it With Scapy & Tcpdump a="2001:DB8:1::1" b="2001:DB8:23::2” route=[] for i in range(0, 30): route.append(a) route.append(b) packet=IPv6(dst=b,hlim=255)/IPv6ExtHdrRouting(addresses=route,type=0)/ICMPv6EchoRequest() sr1(packet) Using a recent IOS, the router refuses to process Routing Header Type 0 IP6 (hlim 63, next-header ICMPv6 (58) payload length: 384) 2001:db8:23::2 > scapy_host: [icmp6 sum ok] ICMP6, parameter problem, length 384, errorneous - octet 42 24 Let’s Try it Again With Ancient IOS, Scapy & Tcpdump Snapshot before: R1#sh ipv6 traffic interface ethernet 0/0 Ethernet0/0 IPv6 statistics: Rcvd: 26 total, 25 local destination 41 source-routed, 0 truncated ..