idnits 2.17.1 draft-gont-v6ops-ra-guard-evasion-01.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 doesn't use any RFC 2119 keywords, yet seems to have RFC 2119 boilerplate text. -- The document date (June 8, 2011) is 4706 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-00 Summary: 1 error (**), 0 flaws (~~), 3 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 June 8, 2011 5 Expires: December 10, 2011 7 IPv6 Router Advertisement Guard (RA-Guard) Evasion 8 draft-gont-v6ops-ra-guard-evasion-01 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. This document describes possible ways in which current RA- 17 Guard implementations can be circumvented, and discusses possible 18 mitigations. 20 Status of this Memo 22 This Internet-Draft is submitted in full conformance with the 23 provisions of BCP 78 and BCP 79. This document may not be modified, 24 and derivative works of it may not be created, and it may not be 25 published except as an Internet-Draft. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at http://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on December 10, 2011. 39 Copyright Notice 41 Copyright (c) 2011 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (http://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 57 2. Router Advertisement Guard (RA Guard) Evasion Vulnerability . 4 58 2.1. Attack Vector based on IPv6 Extension Headers . . . . . . 4 59 2.2. Attack vector based on IPv6 fragmentation . . . . . . . . 4 60 3. Mitigations . . . . . . . . . . . . . . . . . . . . . . . . . 8 61 4. Other Implications . . . . . . . . . . . . . . . . . . . . . . 9 62 5. Security Considerations . . . . . . . . . . . . . . . . . . . 10 63 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 11 64 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 12 65 7.1. Normative References . . . . . . . . . . . . . . . . . . . 12 66 7.2. Informative References . . . . . . . . . . . . . . . . . . 12 67 Appendix A. Changes from previous versions of the draft (to 68 be removed by the RFC Editor before publication 69 of this document as a RFC . . . . . . . . . . . . . . 13 70 A.1. Changes from draft-gont-v6ops-ra-guard-evasion-00 . . . . 13 71 Appendix B. Assessment tools . . . . . . . . . . . . . . . . . . 14 72 Appendix C. Advice and guidance to vendors . . . . . . . . . . . 15 73 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 16 75 1. Introduction 77 IPv6 Router Advertisement Guard (RA-Guard) is a mitigation technique 78 for attack vectors based on ICMPv6 Router Advertisement messages. 79 [RFC6104] describes the problem statement of "Rogue IPv6 Router 80 Advertisements", and [RFC6105] specifies the "IPv6 Router 81 Advertisement Guard" functionality. 83 The basic concept behind RA-Guard is that a layer-2 device filters 84 ICMPv6 Router Advertisement messages, according to a number of 85 different criteria. The most basic filtering criterion is that 86 Router Advertisement messages are discarded by the layer-2 device 87 unless they are received on a specified port of the layer-2 device. 88 Clearly, the effectiveness of the RA Guard mitigation relies on the 89 ability of the layer-2 device to identify ICMPv6 Router Advertisement 90 messages. 92 As part of the project "Security Assessment of the Internet Protocol 93 version 6 (IPv6)" [CPNI-IPv6], we have devised two techniques for 94 circumventing the RA-Guard protection, which are described in the 95 following sections of this document. These techniques, and the 96 corresponding tools to assess their effectiveness, had so far been 97 made available only to vendors, in the hopes that they could 98 implement counter-measures before they were publicly disclosed. 99 However, since there has been some public discussion about these 100 issues, it was deemed as appropriate to publish the present document. 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. Router Advertisement Guard (RA Guard) Evasion Vulnerability 113 The following subsections describe two different vectors for evading 114 the RA-Guard protection. Section 2.1 describes an attack vector 115 based on the use of IPv6 Extension Headers with the ICMPv6 Router 116 Advertisement messages, which may be used to circumvent the RA-Guard 117 protection of those implementations that fail to process an entire 118 IPv6 header chain when trying to identify the ICMPv6 Router 119 Advertisement messages. Section 2.2 describes an attack method based 120 on the use of IPv6 fragmentation, possibly in conjunction with the 121 use of IPv6 Extension Headers. This later vector is expected to be 122 effective with all existing implementations of the RA-Guard 123 functionality. 125 2.1. Attack Vector based on IPv6 Extension Headers 127 While there is currently no legitimate use for IPv6 Extension Headers 128 in ICMPv6 Router Advertisement messages, Neighbor Discovery 129 implementations allow the use of Extension Headers with these 130 messages, by simply ignoring the received options. We believe that 131 some implementations may simply try to identify ICMPv6 Router 132 Advertisement messages by looking at the "Next Header" field of the 133 fixed IPv6 header, rather than following the entire header chain. As 134 a result, these implementations would fail to identify any ICMPv6 135 Router Advertisement messages that include any Extension Headers (for 136 example, Hop by Hop Options header, Destination Options Header, 137 etc.). 139 The following figure illustrates the structure of ICMPv6 Router 140 Advertisement messages that implement this RA-Guard evasion 141 technique: 143 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 144 |NH=60| |NH=58| | | 145 +-+-+-+ +-+-+-+ + + 146 | IPv6 header | Dst Opt Hdr | ICMPv6 Router Advertisement | 147 + + + + 148 | | | | 149 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 151 2.2. Attack vector based on IPv6 fragmentation 153 While the attack vector described in Section 2.1 may be effective 154 with implementations that fail to process the entire header chain, it 155 can easily be mitigated by an RA-Guard implementation, since all the 156 information needed to identify ICMPv6 Router Advertisement messages 157 is present in the attack packets. 159 This section presents a different attack vector, which aims at making 160 it virtually impossible for a layer-2 device to identify ICMPv6 161 Router Advertisements by leveraging the IPv6 Fragment Header. The 162 basic idea behind this attack vector is that if the forged ICMPv6 163 Router Advertisement is fragmented into at least two fragments, the 164 layer-2 device implementing "RA-Guard" would be unable to identify 165 the attack packet, and would thus fail to block it. 167 A first variant of this attack vector would be an original ICMPv6 168 Router Advertisement message preceded with a Destination Options 169 Header, that results in two fragments. The following figure 170 illustrates the "original" attack packet, prior to fragmentation, and 171 the two resulting fragments which are actually sent as part of the 172 attack. 174 Original packet: 176 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 177 |NH=60| |NH=58| | | 178 +-+-+-+ +-+-+-+ + + 179 | IPv6 header | Dst Opt Hdr | ICMPv6 RA | 180 + + + + 181 | | | | 182 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 184 First fragment: 186 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 187 |NH=44| |NH=60| |NH=58| | 188 +-+-+-+ +-+-+-+ +-+-+-+ + 189 | IPv6 Header | Frag Hdr | Dst Opt Hdr | 190 + + + + 191 | | | | 192 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 194 Second fragment: 196 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 197 |NH=44| |NH=60| | | | 198 +-+-+-+ +-+-+-+ + + + 199 | IPv6 header | Frag Hdr | Dst Opt Hdr | ICMPv6 RA | 200 + + + + + 201 | | | | | 202 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 204 It should be noted that the "Hdr Ext Len" field of the Destination 205 Options Header is present in the first fragment (rather than the 206 second). Therefore, it would be impossible for a device processing 207 only the second fragment to locate the ICMPv6 header contained in 208 that fragment, since it is unknown how many bytes should be "skipped" 209 to get to the next header following the Destination Options Header. 211 Thus, by leveraging the use of the Fragment Header together with the 212 use of the Destination Options header, the attacker is able to 213 conceal the type and contents of the ICMPv6 message he is sending (an 214 ICMPv6 Router Advertisement in this example). Unless the layer-2 215 device were to implement IPv6 fragment reassembly, it would be 216 impossible for the device to identify the ICMPv6 type of the message. 218 A layer-2 device could, however, at least detect that that an 219 ICMPv6 message (or some type) is being sent, since the "Next 220 Header" field of the Destination Options header contained in the 221 first fragment is set to "58" (ICMPv6). 223 It is possible to take this idea further, such that it is also 224 impossible for the layer-2 device to detect that the attacker is 225 sending an ICMPv6 message in the first place. This can be achieved 226 with an original ICMPv6 Router Advertisement message preceded with 227 two Destination Options Headers, that results in two fragments. The 228 following figure illustrates the "original" attack packet, prior to 229 fragmentation, and the two resulting packets which are actually sent 230 as part of the attack. 232 Original packet: 234 +-+-+-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 235 |NH=60| |NH=60| |NH=58| | | 236 +-+-+-+ +-+-+-+ +-+-+-+ + + 237 | IPv6 header | Dst Opt Hdr | Dst Opt Hdr | ICMPv6 RA | 238 + + + + + 239 | | | | | 240 +-+-+-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 242 First fragment: 244 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 245 |NH=44| |NH=60| |NH=60| | 246 +-+-+-+ +-+-+-+ +-+-+-+ + 247 | IPv6 header | Frag Hdr | Dst Opt Hdr | 248 + + + + 249 | | | | 250 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 252 Second fragment: 254 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 255 |NH=44| |NH=60| | |NH=58| | | 256 +-+-+-+ +-+-+-+ + +-+-+-+ + + 257 | IPv6 header | Frag Hdr | Dst O Hdr | Dst Opt Hdr | ICMPv6 RA | 258 + + + + + + 259 | | | | | | 260 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 262 In this variant, the "Next Header" field of the Destination Options 263 header contained in the first fragment is set "60" (Destination 264 Options header), and thus it is impossible for a device processing 265 only the first fragment to detect that an ICMPv6 message is being 266 sent in the first place. 268 The second fragment presents the same challenges as the second 269 fragment of the previous variant. That is, it would be impossible 270 for a device processing only the second fragment to locate the second 271 Destination Options header (and hence the ICMPv6 header), since the 272 "Hdr Ext Len" field of the first Destination Options header is 273 present in the first fragment (rather than the second). 275 3. Mitigations 277 The most effective and efficient mitigation for the RA-Guard evasion 278 vulnerability discussed in this document would be to prohibit the use 279 of IPv6 Extension Headers in Neighbor Discovery messages, as proposed 280 in [I-D.gont-6man-nd-extension-headers]. 282 Nevertheless, an administrator might want to mitigate these 283 vulnerabilities by deploying more advanced filtering. The following 284 filtering rules could be implemented as part of an "RA-Guard" 285 implementation, such that the vulnerabilities discussed in this 286 document can be mitigated: 288 o When trying to identify an ICMPv6 Router Advertisement message, 289 follow the IPv6 header chain, enforcing a limit on the maximum 290 number of Extension Headers that is allowed for each packet. If 291 such limit is exceeded, block the packet. 293 o If the layer-2 device is unable to identify whether the packet is 294 an ICMPv6 Router Advertisement message or not (i.e., the packet is 295 a fragment, and the necessary information is missing), and the 296 IPv6 Source Address of the packet is a link-local address or the 297 unspecified address (::), block the packet. 299 o In all other cases, pass the packet as usual. 301 This filtering policy assumes that host implementations require that 302 the IPv6 Source Address of ICMPv6 Router Advertisement messages be a 303 link-local address, and that they discard the packet if this check 304 fails, as required by the current IETF specifications [RFC4861]. 305 Unfortunately, it should be noted that the aforementioned filtering 306 policy might be inefficient to implement (if at all possible), and 307 might also result (at least in theory) in false positives. 309 4. Other Implications 311 A similar concept to that of "RA-Guard" has been implemented for 312 protecting against forged DHCPv6 messages. Such protection can be 313 circumvented with the same techniques discussed in this document, and 314 the counter-measures for such evasion attack are analogous to those 315 described in Section 3 of this document. 317 5. Security Considerations 319 This document describes a number of techniques to circumvent a 320 mechanism known as "RA-Guard", which many organizations deploy as a 321 "first line of defense" against attacks based on forged Router 322 Advertisements. 324 The most effective and efficient mitigation for these attacks would 325 be to prohibit the use of IPv6 extension headers (as proposed by 326 [I-D.gont-6man-nd-extension-headers]), such that the RA-Guard 327 protection cannot be easily circumvented. However, since this 328 mitigation requires an update to existing implementations, in the 329 short term some network administrators might want to mitigate these 330 issues by implemented the more advanced filtering policy described in 331 Section 3. 333 6. Acknowledgements 335 The author would like to thank Karl Auer, Robert Downie, David 336 Farmer, Marc Heuse, and Arturo Servin, for providing valuable 337 comments on earlier versions of this document. 339 This document resulted from the project "Security Assessment of the 340 Internet Protocol version 6 (IPv6)" [CPNI-IPv6], carried out by 341 Fernando Gont on behalf of the UK Centre for the Protection of 342 National Infrastructure (CPNI). The author would like to thank the 343 UK CPNI, for their continued support. 345 7. References 347 7.1. Normative References 349 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 350 Requirement Levels", BCP 14, RFC 2119, March 1997. 352 [RFC4861] Narten, T., Nordmark, E., Simpson, W., and H. Soliman, 353 "Neighbor Discovery for IP version 6 (IPv6)", RFC 4861, 354 September 2007. 356 7.2. Informative References 358 [RFC6104] Chown, T. and S. Venaas, "Rogue IPv6 Router Advertisement 359 Problem Statement", RFC 6104, February 2011. 361 [RFC6105] Levy-Abegnoli, E., Van de Velde, G., Popoviciu, C., and J. 362 Mohacsi, "IPv6 Router Advertisement Guard", RFC 6105, 363 February 2011. 365 [I-D.gont-6man-nd-extension-headers] 366 Gont, F. and U. CPNI, "Security Implications of the Use of 367 IPv6 Extension Headers with IPv6 Neighbor Discovery", 368 draft-gont-6man-nd-extension-headers-00 (work in 369 progress), May 2011. 371 [CPNI-IPv6] 372 Gont, F., "Security Assessment of the Internet Protocol 373 version 6 (IPv6)", UK Centre for the Protection of 374 National Infrastructure, (to be published). 376 [NDPMon] "NDPMon - IPv6 Neighbor Discovery Protocol Monitor", 377 . 379 [rafixd] "rafixd", . 382 [ramond] "ramond", . 384 [THC-IPV6] 385 "THC-IPV6", . 387 Appendix A. Changes from previous versions of the draft (to be removed 388 by the RFC Editor before publication of this document as a 389 RFC 391 A.1. Changes from draft-gont-v6ops-ra-guard-evasion-00 393 o Minor editorial changes 395 o The discussion of the challenge represented by a combination of 396 fragmentation and Destination Options headers was improved/ 397 clarified. 399 o In Section 2.2, in the illustration of the second variant of the 400 attack (fragmentation combined with two Destination Optios 401 headers), the figure corresponding to the "first fragment" was 402 corrected. 404 o Clarified the filtering rules in Section 3. 406 Appendix B. Assessment tools 408 CPNI has produced assessment tools, which have not yet been made 409 publicly available. If you think that you would benefit from these 410 tools to assess the security of your network or of your RA-Guard 411 implementation, we might be able to provide a copy of the tools 412 (please contact Fernando Gont at fernando@gont.com.ar). 414 [THC-IPV6] is a publicly-available set of tools that implements some 415 of the techniques described in this document. 417 Appendix C. Advice and guidance to vendors 419 Vendors are urged to contact CSIRTUK (csirt@cpni.gsi.gov.uk) if they 420 think they may be affected by the issues described in this document. 421 As the lead coordination centre for these issues, CPNI is well placed 422 to give advice and guidance as required. 424 CPNI works extensively with government departments and agencies, 425 commercial organisations and the academic community to research 426 vulnerabilities and potential threats to IT systems especially where 427 they may have an impact on Critical National Infrastructure's (CNI). 429 Other ways to contact CPNI, plus CPNI's PGP public key, are available 430 at http://www.cpni.gov.uk. 432 Author's Address 434 Fernando Gont 435 Centre for the Protection of National Infrastructure 437 Email: fernando@gont.com.ar 438 URI: http://www.gont.com.ar