idnits 2.17.1 draft-gont-v6ops-ra-guard-implementation-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- -- The document has an IETF Trust Provisions (28 Dec 2009) Section 6.c(ii) Publication Limitation clause. If this document is intended for submission to the IESG for publication, this constitutes an error. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (January 5, 2012) is 4488 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Outdated reference: A later version (-03) exists of draft-gont-6man-nd-extension-headers-01 Summary: 1 error (**), 0 flaws (~~), 2 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 IPv6 Operations Working Group (v6ops) F. Gont 3 Internet-Draft UK CPNI 4 Intended status: Informational January 5, 2012 5 Expires: July 8, 2012 7 Implementation Advice for IPv6 Router Advertisement Guard (RA-Guard) 8 draft-gont-v6ops-ra-guard-implementation-00 10 Abstract 12 The IPv6 Router Advertisement Guard (RA-Guard) mechanism is commonly 13 employed to mitigate attack vectors based on forged ICMPv6 Router 14 Advertisement messages. Many existing IPv6 deployments rely on RA- 15 Guard as the first line of defense against the aforementioned attack 16 vectors. However, some implementations of RA-Guard have been found 17 to be prone to circumvention by employing IPv6 Extension Headers. 18 This document describes the evasion techniques that affect the 19 aforementioned implementations, and provides advice on the 20 implementation of RA-Guard, such that that evasion vectors are 21 eliminated. 23 Status of this Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. This document may not be modified, 27 and derivative works of it may not be created, and it may not be 28 published except as an Internet-Draft. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at http://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on July 8, 2012. 42 Copyright Notice 44 Copyright (c) 2012 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (http://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 60 2. Evasion techniques for some Router Advertisement Guard (RA 61 Guard) implementations . . . . . . . . . . . . . . . . . . . . 4 62 2.1. Attack Vector based on IPv6 Extension Headers . . . . . . 4 63 2.2. Attack vector based on IPv6 fragmentation . . . . . . . . 4 64 3. RA-Guard implementation advice . . . . . . . . . . . . . . . . 8 65 4. Other Implications . . . . . . . . . . . . . . . . . . . . . . 9 66 5. Security Considerations . . . . . . . . . . . . . . . . . . . 10 67 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 11 68 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 12 69 7.1. Normative References . . . . . . . . . . . . . . . . . . . 12 70 7.2. Informative References . . . . . . . . . . . . . . . . . . 12 71 Appendix A. Changes from previous versions of the draft (to 72 be removed by the RFC Editor before publication 73 of this document as a RFC . . . . . . . . . . . . . . 13 74 A.1. Changes from draft-gont-v6ops-ra-guard-evasion-01 . . . . 13 75 Appendix B. Assessment tools . . . . . . . . . . . . . . . . . . 14 76 Appendix C. Advice and guidance to vendors . . . . . . . . . . . 15 77 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 16 79 1. Introduction 81 IPv6 Router Advertisement Guard (RA-Guard) is a mitigation technique 82 for attack vectors based on ICMPv6 Router Advertisement messages. 83 [RFC6104] describes the problem statement of "Rogue IPv6 Router 84 Advertisements", and [RFC6105] specifies the "IPv6 Router 85 Advertisement Guard" functionality. 87 The basic concept behind RA-Guard is that a layer-2 device filters 88 ICMPv6 Router Advertisement messages, according to a number of 89 different criteria. The most basic filtering criterion is that 90 Router Advertisement messages are discarded by the layer-2 device 91 unless they are received on a specified port of the layer-2 device. 92 Clearly, the effectiveness of the RA Guard mitigation relies on the 93 ability of the layer-2 device to identify ICMPv6 Router Advertisement 94 messages. 96 Some popular RA-Guard implementations have been found to be possible 97 to circumvent by employing IPv6 extension headers [CPNI-IPv6]. This 98 document describes such evasion techniques, and provides advice to 99 RA-Guard implementers such that the aforementioned evasion vectors 100 can be eliminated. 102 It should be noted that the aforementioned techniques could also be 103 exploited to evade network monitoring tools such as NDPMon [NDPMon], 104 ramond [ramond], and rafixd [rafixd], and could probably be exploited 105 to perform stealth DHCPv6 attacks. 107 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 108 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 109 document are to be interpreted as described in RFC 2119 [RFC2119]. 111 2. Evasion techniques for some Router Advertisement Guard (RA Guard) 112 implementations 114 The following subsections describe two different vectors that have 115 been found to be effective for the evasion of popular implementations 116 of the RA-Guard protection. Section 2.1 describes an attack vector 117 based on the use of IPv6 Extension Headers with the ICMPv6 Router 118 Advertisement messages, which may be used to circumvent the RA-Guard 119 protection of those implementations that fail to process an entire 120 IPv6 header chain when trying to identify the ICMPv6 Router 121 Advertisement messages. Section 2.2 describes an attack method based 122 on the use of IPv6 fragmentation, possibly in conjunction with the 123 use of IPv6 Extension Headers. This later vector has been found to 124 be effective with all existing implementations of the RA-Guard 125 mechanism. 127 2.1. Attack Vector based on IPv6 Extension Headers 129 While there is currently no legitimate use for IPv6 Extension Headers 130 in ICMPv6 Router Advertisement messages, Neighbor Discovery 131 implementations allow the use of Extension Headers with these 132 messages, by simply ignoring the received options. Some RA-Guard 133 implementations simply try to identify ICMPv6 Router Advertisement 134 messages by looking at the "Next Header" field of the fixed IPv6 135 header, rather than following the entire header chain. As a result, 136 such implementations fail to identify any ICMPv6 Router Advertisement 137 messages that include any Extension Headers (for example, Hop by Hop 138 Options header, Destination Options Header, etc.), and can be easily 139 circumvented. 141 The following figure illustrates the structure of ICMPv6 Router 142 Advertisement messages that implement this evasion technique: 144 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 145 |NH=60| |NH=58| | | 146 +-+-+-+ +-+-+-+ + + 147 | IPv6 header | Dst Opt Hdr | ICMPv6 Router Advertisement | 148 + + + + 149 | | | | 150 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 152 2.2. Attack vector based on IPv6 fragmentation 154 This section presents a different attack vector, which has been found 155 to be effective against all implementations of RA-Guard. The basic 156 idea behind this attack vector is that if the forged ICMPv6 Router 157 Advertisement is fragmented into at least two fragments, the layer-2 158 device implementing "RA-Guard" would be unable to identify the attack 159 packet, and would thus fail to block it. 161 A first variant of this attack vector would be an original ICMPv6 162 Router Advertisement message preceded with a Destination Options 163 Header, that results in two fragments. The following figure 164 illustrates the "original" attack packet, prior to fragmentation, and 165 the two resulting fragments which are actually sent as part of the 166 attack. 168 Original packet: 170 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 171 |NH=60| |NH=58| | | 172 +-+-+-+ +-+-+-+ + + 173 | IPv6 header | Dst Opt Hdr | ICMPv6 RA | 174 + + + + 175 | | | | 176 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 178 First fragment: 180 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 181 |NH=44| |NH=60| |NH=58| | 182 +-+-+-+ +-+-+-+ +-+-+-+ + 183 | IPv6 Header | Frag Hdr | Dst Opt Hdr | 184 + + + + 185 | | | | 186 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 188 Second fragment: 190 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 191 |NH=44| |NH=60| | | | 192 +-+-+-+ +-+-+-+ + + + 193 | IPv6 header | Frag Hdr | Dst Opt Hdr | ICMPv6 RA | 194 + + + + + 195 | | | | | 196 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 198 It should be noted that the "Hdr Ext Len" field of the Destination 199 Options Header is present in the first fragment (rather than the 200 second). Therefore, it is impossible for a device processing only 201 the second fragment to locate the ICMPv6 header contained in that 202 fragment, since it is unknown how many bytes should be "skipped" to 203 get to the next header following the Destination Options Header. 205 Thus, by leveraging the use of the Fragment Header together with the 206 use of the Destination Options header, the attacker is able to 207 conceal the type and contents of the ICMPv6 message he is sending (an 208 ICMPv6 Router Advertisement in this example). Unless the layer-2 209 device were to implement IPv6 fragment reassembly, it would be 210 impossible for the device to identify the ICMPv6 type of the message. 212 A layer-2 device could, however, at least detect that that an 213 ICMPv6 message (or some type) is being sent, since the "Next 214 Header" field of the Destination Options header contained in the 215 first fragment is set to "58" (ICMPv6). 217 This idea can be taken further, such that it is also impossible for 218 the layer-2 device to detect that the attacker is sending an ICMPv6 219 message in the first place. This can be achieved with an original 220 ICMPv6 Router Advertisement message preceded with two Destination 221 Options Headers, that results in two fragments. The following figure 222 illustrates the "original" attack packet, prior to fragmentation, and 223 the two resulting packets which are actually sent as part of the 224 attack. 226 Original packet: 228 +-+-+-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 229 |NH=60| |NH=60| |NH=58| | | 230 +-+-+-+ +-+-+-+ +-+-+-+ + + 231 | IPv6 header | Dst Opt Hdr | Dst Opt Hdr | ICMPv6 RA | 232 + + + + + 233 | | | | | 234 +-+-+-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 236 First fragment: 238 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 239 |NH=44| |NH=60| |NH=60| | 240 +-+-+-+ +-+-+-+ +-+-+-+ + 241 | IPv6 header | Frag Hdr | Dst Opt Hdr | 242 + + + + 243 | | | | 244 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 246 Second fragment: 248 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 249 |NH=44| |NH=60| | |NH=58| | | 250 +-+-+-+ +-+-+-+ + +-+-+-+ + + 251 | IPv6 header | Frag Hdr | Dst O Hdr | Dst Opt Hdr | ICMPv6 RA | 252 + + + + + + 253 | | | | | | 254 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 256 In this variant, the "Next Header" field of the Destination Options 257 header contained in the first fragment is set "60" (Destination 258 Options header), and thus it is impossible for a device processing 259 only the first fragment to detect that an ICMPv6 message is being 260 sent in the first place. 262 The second fragment presents the same challenges as the second 263 fragment of the previous variant. That is, it would be impossible 264 for a device processing only the second fragment to locate the second 265 Destination Options header (and hence the ICMPv6 header), since the 266 "Hdr Ext Len" field of the first Destination Options header is 267 present in the first fragment (rather than the second). 269 3. RA-Guard implementation advice 271 The following filtering rules MUST be implemented as part of an "RA- 272 Guard" implementation, such that the possible vulnerabilities 273 discussed in this document are eliminated: 275 o When trying to identify an ICMPv6 Router Advertisement message, 276 follow the IPv6 header chain, enforcing a limit on the maximum 277 number of Extension Headers that is allowed for each packet. If 278 such limit is exceeded, block the packet. 280 o If the layer-2 device is unable to identify whether the packet is 281 an ICMPv6 Router Advertisement message or not (i.e., the packet is 282 a fragment, and the necessary information is missing), and the 283 IPv6 Source Address of the packet is a link-local address or the 284 unspecified address (::), block the packet. 286 o In all other cases, pass the packet as usual. 288 This filtering policy assumes that host implementations require that 289 the IPv6 Source Address of ICMPv6 Router Advertisement messages be a 290 link-local address, and that they discard the packet if this check 291 fails, as required by the current IETF specifications [RFC4861]. 293 4. Other Implications 295 A similar concept to that of "RA-Guard" has been implemented for 296 protecting against forged DHCPv6 messages. Such protection can be 297 circumvented with the same techniques discussed in this document, and 298 the counter-measures for such evasion attack are analogous to those 299 described in Section 3 of this document. 301 5. Security Considerations 303 This document describes a number of techniques that have been found 304 to be effective to circumvent popular RA-Guard implementations. 306 The most effective and efficient mitigation for these attacks would 307 be to prohibit the use of some IPv6 extension headers with Router 308 Advertisement messages (as proposed by 309 [I-D.gont-6man-nd-extension-headers]). However, since such 310 mitigation would require an update to existing implementations, it 311 cannot be relied upon in the short or near term. 313 6. Acknowledgements 315 The author would like to thank Ran Atkinson, Karl Auer, Robert 316 Downie, David Farmer, Marc Heuse, Arturo Servin, and Gunter van de 317 Velde, for providing valuable comments on earlier versions of this 318 document. 320 This document resulted from the project "Security Assessment of the 321 Internet Protocol version 6 (IPv6)" [CPNI-IPv6], carried out by 322 Fernando Gont on behalf of the UK Centre for the Protection of 323 National Infrastructure (CPNI). The author would like to thank the 324 UK CPNI, for their continued support. 326 7. References 328 7.1. Normative References 330 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 331 Requirement Levels", BCP 14, RFC 2119, March 1997. 333 [RFC4861] Narten, T., Nordmark, E., Simpson, W., and H. Soliman, 334 "Neighbor Discovery for IP version 6 (IPv6)", RFC 4861, 335 September 2007. 337 7.2. Informative References 339 [RFC6104] Chown, T. and S. Venaas, "Rogue IPv6 Router Advertisement 340 Problem Statement", RFC 6104, February 2011. 342 [RFC6105] Levy-Abegnoli, E., Van de Velde, G., Popoviciu, C., and J. 343 Mohacsi, "IPv6 Router Advertisement Guard", RFC 6105, 344 February 2011. 346 [I-D.gont-6man-nd-extension-headers] 347 Gont, F. and U. CPNI, "Security Implications of the Use of 348 IPv6 Extension Headers with IPv6 Neighbor Discovery", 349 draft-gont-6man-nd-extension-headers-01 (work in 350 progress), June 2011. 352 [CPNI-IPv6] 353 Gont, F., "Security Assessment of the Internet Protocol 354 version 6 (IPv6)", UK Centre for the Protection of 355 National Infrastructure, (available on request). 357 [NDPMon] "NDPMon - IPv6 Neighbor Discovery Protocol Monitor", 358 . 360 [rafixd] "rafixd", . 363 [ramond] "ramond", . 365 [THC-IPV6] 366 "THC-IPV6", . 368 Appendix A. Changes from previous versions of the draft (to be removed 369 by the RFC Editor before publication of this document as a 370 RFC 372 A.1. Changes from draft-gont-v6ops-ra-guard-evasion-01 374 o The contents were updated to reflect that the evasion 375 vulnerabilities are based on implementation flaws, rather than on 376 the RA-Guard "concept" itself. 378 o The I-D now focuses on providing advice to RA-Guard implementers. 380 Appendix B. Assessment tools 382 CPNI has produced assessment tools (which have not yet been made 383 publicly available) to assess RA-Guard implementations with respect 384 to the issues described in this document. If you think that you 385 would benefit from these tools, we might be able to provide a copy of 386 the tools (please contact Fernando Gont at fernando@gont.com.ar). 388 [THC-IPV6] is a publicly-available set of tools that implements some 389 of the techniques described in this document. 391 Appendix C. Advice and guidance to vendors 393 Vendors are urged to contact CSIRTUK (csirt@cpni.gsi.gov.uk) if they 394 think they may be affected by the issues described in this document. 395 As the lead coordination centre for these issues, CPNI is well placed 396 to give advice and guidance as required. 398 CPNI works extensively with government departments and agencies, 399 commercial organisations and the academic community to research 400 vulnerabilities and potential threats to IT systems especially where 401 they may have an impact on Critical National Infrastructure's (CNI). 403 Other ways to contact CPNI, plus CPNI's PGP public key, are available 404 at http://www.cpni.gov.uk. 406 Author's Address 408 Fernando Gont 409 Centre for the Protection of National Infrastructure 411 Email: fgont@si6networks.com 412 URI: http://www.cpni.gov.uk