idnits 2.17.00 (12 Aug 2021) /tmp/idnits9148/draft-vyncke-v6ops-happy-eyeballs-cookie-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. 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 Introduction section. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 6, 2015) is 2626 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Outdated reference: draft-ietf-httpbis-http2 has been published as RFC 7540 == Outdated reference: draft-ietf-softwire-map-t has been published as RFC 7599 -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) -- Obsolete informational reference (is this intentional?): RFC 6555 (Obsoleted by RFC 8305) -- Obsolete informational reference (is this intentional?): RFC 6824 (Obsoleted by RFC 8684) Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 IPv6 Operations E. Vyncke 3 Internet-Draft Cisco 4 Intended status: Informational March 6, 2015 5 Expires: September 7, 2015 7 HTTP State Management Mechanisms with Multiple Addresses User Agents 8 draft-vyncke-v6ops-happy-eyeballs-cookie-01 10 Abstract 12 HTTP servers usually save session states in their persistent storage 13 indexed by session cookies generated by the HTTP servers. It is up 14 to the HTTP user-agent to send this session cookie on each HTTP 15 request. Some HTTP servers check whether the cookie is associated 16 with the HTTP user-agent by the means of the user-agent IP address. 17 Everything linking a state to an IP address (such as OAuth access 18 code) to an IP address has the same issue. 20 If the Happy Eyeball mechanism is used to select between IPv6 and 21 IPv4, it may happen that while using the same HTTP server, some HTTP 22 requests are done over IPv6 and the others over IPv4, which leads to 23 two different sets of session states in the HTTP server. This has 24 the consequence of inconsistencies at the HTTP server. 26 The only purpose of this document is to document this issue in more 27 details than in section 8.2 of RFC 6883 including security 28 considerations and mitigations. 30 A similar problem arises with the use of non RFC 6888 compliant 31 Carrier-Grade NAT (CGN) devices used to access an IPv4-only HTTP 32 server or HTTP user-agent using multi-homing. 34 Status of This Memo 36 This Internet-Draft is submitted in full conformance with the 37 provisions of BCP 78 and BCP 79. 39 Internet-Drafts are working documents of the Internet Engineering 40 Task Force (IETF). Note that other groups may also distribute 41 working documents as Internet-Drafts. The list of current Internet- 42 Drafts is at http://datatracker.ietf.org/drafts/current/. 44 Internet-Drafts are draft documents valid for a maximum of six months 45 and may be updated, replaced, or obsoleted by other documents at any 46 time. It is inappropriate to use Internet-Drafts as reference 47 material or to cite them other than as "work in progress." 48 This Internet-Draft will expire on September 7, 2015. 50 Copyright Notice 52 Copyright (c) 2015 IETF Trust and the persons identified as the 53 document authors. All rights reserved. 55 This document is subject to BCP 78 and the IETF Trust's Legal 56 Provisions Relating to IETF Documents 57 (http://trustee.ietf.org/license-info) in effect on the date of 58 publication of this document. Please review these documents 59 carefully, as they describe your rights and restrictions with respect 60 to this document. Code Components extracted from this document must 61 include Simplified BSD License text as described in Section 4.e of 62 the Trust Legal Provisions and are provided without warranty as 63 described in the Simplified BSD License. 65 Table of Contents 67 1. HTTP Session Management with HTTP Cookie . . . . . . . . . . 2 68 1.1. Other Use of Session Cookies . . . . . . . . . . . . . . 3 69 1.2. new section . . . . . . . . . . . . . . . . . . . . . . . 3 70 2. Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 71 2.1. Happy Eyeballs Issue . . . . . . . . . . . . . . . . . . 4 72 2.2. Carrier-Grade NAT Issue . . . . . . . . . . . . . . . . . 4 73 2.3. Multiple Interfaces Issue . . . . . . . . . . . . . . . . 5 74 3. Mitigations . . . . . . . . . . . . . . . . . . . . . . . . . 5 75 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 76 5. Security Considerations . . . . . . . . . . . . . . . . . . . 6 77 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 6 78 7. Informative References . . . . . . . . . . . . . . . . . . . 6 79 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 7 81 1. HTTP Session Management with HTTP Cookie 83 HTTP requests are basically stateless, therefore if a HTTP server 84 requires to have some states associated to a HTTP user-agent (such as 85 user name, login state, history, shopping basket, ...), there is a 86 need to conserve those states. This is usually done by using a HTTP 87 cookie (see also RFC6265 [RFC6265]) identifying the session; also 88 called "session state cookie". 90 This session state cookie is generated by the HTTP server at the very 91 first HTTP request from a HTTP user-agent. The cookie is usually 92 opaque (often a random number) and has no semantic except as being an 93 index within the persistent storage of the HTTP server. This index 94 is used to access the complete state of the user-agent. This 95 mechanism is secure if the cookie is transferred with confidentiality 96 between the server and the user-agent. If the cookie transfer and 97 storage are not secured, then any hostile user-agent can reuse this 98 cookie to access the full original session states (including shopping 99 basket, payment details, ...); this attack is called 'session cookie 100 stealing'. This attack can happen if the HTTP traffic is intercepted 101 by a man-in-the-middle attack but a good use of Transport Level 102 Security RFC5246 [RFC5246] can prevent it. The attack can also 103 happen with some hostile scripting or other pieces of malware running 104 on the user agent, that could copy and send the session cookie to the 105 hostile user-agent; hence, it is not enough to use TLS to secure the 106 session cookies. 108 Some HTTP applications link the user-agent IP address (whether IPv6 109 or IPv4) to the session state, probably for additional security 110 checks in order to prevent session cookie stealing. This link leads 111 to some issues in a dual-stack world which are described in this 112 document. 114 The author knows about at least two large web sites having this 115 problem. It was so severe that those sites which were dual-stack had 116 to move back to being IPv4-only... until the application and its 117 security is updated. 119 1.1. Other Use of Session Cookies 121 Beside the use of session cookies by the HTTP server to keep states 122 on the server, the very same cookie is also sometimes used by Server 123 Load Balancing (SLB) mechanism to ensure that all HTTP requests from 124 the same user-agent (even if behind a NAT) are always sent to the 125 same physical HTTP server. This is required if the server persistent 126 storage is local to the server and is not shared by all the physical 127 servers behind the SLB. 129 1.2. new section 131 Actually the problem is more generic than the session cookie, 132 everything linking a state to an IP address has the same issue. This 133 includes OAuth [RFC6749] access tokens, bearer tokens, ... but also 134 other mechanisms such as rate limiting per IP address or access 135 control per IP address (for instance a captive portal for a guest 136 net). 138 2. Issues 140 Similar issues can be caused by Happy Eyeball RFC6555 [RFC6555], 141 Carrier-Grade NAT (CGN) and having multiple interface or being multi- 142 homed. 144 2.1. Happy Eyeballs Issue 146 When a HTTP user-agent uses the Happy Eyeball mechanism to access a 147 HTTP server, then, part of the HTTP requests can happen over IPv6 and 148 another part over IPv4 if the latency between IPv4 and IPv6 varies 149 quickly over time. If there is a link between the session cookie and 150 the user-agent IP address, then upon the first change of IP protocol 151 version, the states associated to the cookie will be invalidated and 152 will be deleted. Here is an example: 154 1. User-agent with IPv4 address, ADDR4, connect to the server by 155 using IPv4 because IPv6 is slower; the first request does not 156 have any HTTP cookie; 158 2. Server generates a new cookie C4 and stores in its persistent 159 storage that C4 is associated with address ADDR4; 161 3. User-agent continues his/her session using IPv4, on each new 162 request the HTTP server receives the cookie C4 and checks that 163 the user-agent address is indeed ADDR4; 165 4. Latency of IPv6 changes and becomes now faster than IPv4; 167 5. User-agent now uses its IPv6 address, ADDR6, to connect to the 168 same server and continues to use the same cookie C4 as the server 169 name is unchanged; 171 6. The server receives the HTTP request with the C4 cookie and 172 checks whether C4 is associated with ADDR6 which is not the 173 case... All session states are deleted and a new cookie, C6, is 174 generated and associated to the IPV6 address ADDR6; 176 7. The end-user becomes frustrated because he/she has to restart 177 his/her complete session from the beginning. 179 This cookie invalidation may have some security benefit but it 180 actually prevents a host using Happy Eyeballs to have a persistent 181 session with a dual-stack HTTP server; with painful consequences for 182 the user-experience: disconnection, loss of shopping basket, ... 184 2.2. Carrier-Grade NAT Issue 186 RFC6888 [RFC6888] describes the CGN requirements but not all CGN 187 implement them. Some CGN in the real world have a pool of IPv4 188 addresses and do not always use the same public IPv4 address for all 189 requests from a CGN client. This obviously leads to the same problem 190 as in section Section 2.1. This will happen for IPv4-only HTTP 191 servers. 193 Whether the CGN is used by IPv4 clients or by IPv6 clients (via NAT64 194 RFC6146 [RFC6146])does not make any difference to the problem. The 195 use of the address family translation by MAP-T MAP-T 196 [I-D.ietf-softwire-map-t] does not suffer from this issue for 197 IPv4-only HTTP servers since one subscriber is restricted to several 198 layer-4 ports from a single IPv4 address. 200 2.3. Multiple Interfaces Issue 202 When the HTTP user-agent has multiple interfaces, for example 3GPP 203 and Wi-Fi, the preferred IP address depends on the WiFi or 3GPP 204 availability. In this case, a similar issue to Section 2.1 also 205 happens as the session cookie can be linked first to the Wi-Fi IP 206 address then when the user-agent looses its Wi-Fi connectivity the 207 session cookie will be overwritten by a new session cookie linked to 208 the 3GPP address. 210 Whether the user-agent uses IPv4-only, IPv6-only or dual-stack has no 211 impact on the issue. 213 3. Mitigations 215 The obvious mitigation for this issue is NOT to link any HTTP state 216 management (including cookies) to any IP address of the HTTP user- 217 agent at the risk of increasing the risk of "session cookie 218 stealing". 220 The author also believes that: 222 Multipath TCP RFC6824 [RFC6824] hides completely the set of 223 addresses of the client to the application. Only the first 224 subflow's IP addresses are exposed to the application, even if a 225 later subflow uses a different address family; so, any session 226 cookie will be permanently linked to the first IP address used by 227 the HTTP user-agent; 229 HTTP/2 [I-D.ietf-httpbis-http2] multiplexes multiple HTTP sessions 230 over a single TCP connection, therefore, Happy Eyeball (or bad 231 CGN) sees only one TCP connection and a change of IP address will 232 never occur during the lifetime of this TCP connection. 234 4. IANA Considerations 236 This document contains no IANA considerations. 238 5. Security Considerations 240 The association of the session cookie with the user-agent IP address 241 has some security value as it can help prevent "session cookie 242 stealing" in some limited situations; this benefit should be balanced 243 with the lack of persistent session and the remaining vulnerability 244 if the HTTP session can be intercepted by a man-in-the-middle attack. 245 Moreover with more and more CGN being deployed, linked a session 246 cookie to an IP address shared by hundreds of subscribers is less 247 effective as the cookie could be reused by any subscribers using the 248 same shared public IP address. 250 6. Acknowledgements 252 The author would like to thank Brian Carpenter, Ray Hunter, Jeroen 253 Massar, Dan Metzler, Erik Nygren, Mark ZZZ Smith, Joe Touch, Dan Wing 254 and Andrew Yourtchenko for some discussions on this topic. Of 255 course, RFC6883 [RFC6883] has already mentionned this issue without 256 many details. 258 7. Informative References 260 [I-D.ietf-httpbis-http2] 261 Belshe, M., Peon, R., and M. Thomson, "Hypertext Transfer 262 Protocol version 2", draft-ietf-httpbis-http2-17 (work in 263 progress), February 2015. 265 [I-D.ietf-softwire-map-t] 266 Li, X., Bao, C., Dec, W., Troan, O., Matsushima, S., and 267 T. Murakami, "Mapping of Address and Port using 268 Translation (MAP-T)", draft-ietf-softwire-map-t-08 (work 269 in progress), December 2014. 271 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 272 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 274 [RFC6146] Bagnulo, M., Matthews, P., and I. van Beijnum, "Stateful 275 NAT64: Network Address and Protocol Translation from IPv6 276 Clients to IPv4 Servers", RFC 6146, April 2011. 278 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 279 April 2011. 281 [RFC6555] Wing, D. and A. Yourtchenko, "Happy Eyeballs: Success with 282 Dual-Stack Hosts", RFC 6555, April 2012. 284 [RFC6749] Hardt, D., "The OAuth 2.0 Authorization Framework", RFC 285 6749, October 2012. 287 [RFC6824] Ford, A., Raiciu, C., Handley, M., and O. Bonaventure, 288 "TCP Extensions for Multipath Operation with Multiple 289 Addresses", RFC 6824, January 2013. 291 [RFC6883] Carpenter, B. and S. Jiang, "IPv6 Guidance for Internet 292 Content Providers and Application Service Providers", RFC 293 6883, March 2013. 295 [RFC6888] Perreault, S., Yamagata, I., Miyakawa, S., Nakagawa, A., 296 and H. Ashida, "Common Requirements for Carrier-Grade NATs 297 (CGNs)", BCP 127, RFC 6888, April 2013. 299 Author's Address 301 Eric Vyncke 302 Cisco 303 De Kleetlaan 6a 304 Diegem 1831 305 Belgium 307 Phone: +32 2 778 4677 308 Email: evyncke@cisco.com