idnits 2.17.1 draft-ietf-tram-stunbis-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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (February 17, 2015) is 3356 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-09) exists of draft-ietf-tsvwg-sctp-dtls-encaps-00 == Outdated reference: A later version (-07) exists of draft-ietf-tsvwg-sctp-prpolicies-05 -- Possible downref: Non-RFC (?) normative reference: ref. 'ITU.V42.2002' ** Downref: Normative reference to an Informational RFC: RFC 1321 ** Downref: Normative reference to an Informational RFC: RFC 2104 ** Obsolete normative reference: RFC 2460 (Obsoleted by RFC 8200) ** Obsolete normative reference: RFC 2617 (Obsoleted by RFC 7235, RFC 7615, RFC 7616, RFC 7617) ** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 4013 (Obsoleted by RFC 7613) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 6347 (Obsoleted by RFC 9147) -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 3489 (Obsoleted by RFC 5389) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) -- Obsolete informational reference (is this intentional?): RFC 5245 (Obsoleted by RFC 8445, RFC 8839) -- Obsolete informational reference (is this intentional?): RFC 5389 (Obsoleted by RFC 8489) -- Obsolete informational reference (is this intentional?): RFC 5766 (Obsoleted by RFC 8656) Summary: 8 errors (**), 0 flaws (~~), 4 warnings (==), 9 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 TRAM M. Petit-Huguenin 3 Internet-Draft Impedance Mismatch 4 Obsoletes: 5389 (if approved) G. Salgueiro 5 Intended status: Standards Track J. Rosenberg 6 Expires: August 21, 2015 D. Wing 7 Cisco 8 R. Mahy 9 Plantronics 10 P. Matthews 11 Avaya 12 February 17, 2015 14 Session Traversal Utilities for NAT (STUN) 15 draft-ietf-tram-stunbis-01 17 Abstract 19 Session Traversal Utilities for NAT (STUN) is a protocol that serves 20 as a tool for other protocols in dealing with Network Address 21 Translator (NAT) traversal. It can be used by an endpoint to 22 determine the IP address and port allocated to it by a NAT. It can 23 also be used to check connectivity between two endpoints, and as a 24 keep-alive protocol to maintain NAT bindings. STUN works with many 25 existing NATs, and does not require any special behavior from them. 27 STUN is not a NAT traversal solution by itself. Rather, it is a tool 28 to be used in the context of a NAT traversal solution. 30 This document obsoletes RFC 5389. 32 Status of This Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at http://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on August 21, 2015. 49 Copyright Notice 51 Copyright (c) 2015 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (http://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 Table of Contents 66 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 67 2. Overview of Operation . . . . . . . . . . . . . . . . . . . . 4 68 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 7 69 4. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 7 70 5. STUN Message Structure . . . . . . . . . . . . . . . . . . . 9 71 6. Base Protocol Procedures . . . . . . . . . . . . . . . . . . 11 72 6.1. Forming a Request or an Indication . . . . . . . . . . . 11 73 6.2. Sending the Request or Indication . . . . . . . . . . . . 12 74 6.2.1. Sending over UDP or DTLS-over-UDP . . . . . . . . . . 13 75 6.2.2. Sending over TCP or TLS-over-TCP . . . . . . . . . . 14 76 6.2.3. Sending over SCTP-over-UDP or SCTP-over-DTLS-over-UDP 15 77 6.2.4. Sending over TLS-over-TCP or DTLS-over-UDP or SCTP- 78 over-DTLS-over-UDP . . . . . . . . . . . . . . . . . 16 79 6.3. Receiving a STUN Message . . . . . . . . . . . . . . . . 17 80 6.3.1. Processing a Request . . . . . . . . . . . . . . . . 18 81 6.3.1.1. Forming a Success or Error Response . . . . . . . 19 82 6.3.1.2. Sending the Success or Error Response . . . . . . 20 83 6.3.2. Processing an Indication . . . . . . . . . . . . . . 20 84 6.3.3. Processing a Success Response . . . . . . . . . . . . 20 85 6.3.4. Processing an Error Response . . . . . . . . . . . . 21 86 7. FINGERPRINT Mechanism . . . . . . . . . . . . . . . . . . . . 21 87 8. DNS Discovery of a Server . . . . . . . . . . . . . . . . . . 22 88 8.1. STUN URI Scheme Semantics . . . . . . . . . . . . . . . . 22 89 9. Authentication and Message-Integrity Mechanisms . . . . . . . 23 90 9.1. Short-Term Credential Mechanism . . . . . . . . . . . . . 24 91 9.1.1. HMAC Key . . . . . . . . . . . . . . . . . . . . . . 24 92 9.1.2. Forming a Request or Indication . . . . . . . . . . . 24 93 9.1.3. Receiving a Request or Indication . . . . . . . . . . 24 94 9.1.4. Receiving a Response . . . . . . . . . . . . . . . . 26 95 9.1.5. Sending Subsequent Requests . . . . . . . . . . . . . 26 96 9.2. Long-Term Credential Mechanism . . . . . . . . . . . . . 26 97 9.2.1. HMAC Key . . . . . . . . . . . . . . . . . . . . . . 27 98 9.2.2. Forming a Request . . . . . . . . . . . . . . . . . . 28 99 9.2.2.1. First Request . . . . . . . . . . . . . . . . . . 28 100 9.2.2.2. Subsequent Requests . . . . . . . . . . . . . . . 28 101 9.2.3. Receiving a Request . . . . . . . . . . . . . . . . . 28 102 9.2.4. Receiving a Response . . . . . . . . . . . . . . . . 30 103 10. ALTERNATE-SERVER Mechanism . . . . . . . . . . . . . . . . . 31 104 11. Backwards Compatibility with RFC 3489 . . . . . . . . . . . . 31 105 12. Basic Server Behavior . . . . . . . . . . . . . . . . . . . . 32 106 13. STUN Usages . . . . . . . . . . . . . . . . . . . . . . . . . 32 107 14. STUN Attributes . . . . . . . . . . . . . . . . . . . . . . . 33 108 14.1. MAPPED-ADDRESS . . . . . . . . . . . . . . . . . . . . . 34 109 14.2. XOR-MAPPED-ADDRESS . . . . . . . . . . . . . . . . . . . 35 110 14.3. USERNAME . . . . . . . . . . . . . . . . . . . . . . . . 36 111 14.4. MESSAGE-INTEGRITY . . . . . . . . . . . . . . . . . . . 36 112 14.5. MESSAGE-INTEGRITY2 . . . . . . . . . . . . . . . . . . . 37 113 14.6. FINGERPRINT . . . . . . . . . . . . . . . . . . . . . . 38 114 14.7. ERROR-CODE . . . . . . . . . . . . . . . . . . . . . . . 38 115 14.8. REALM . . . . . . . . . . . . . . . . . . . . . . . . . 40 116 14.9. NONCE . . . . . . . . . . . . . . . . . . . . . . . . . 40 117 14.10. PASSWORD-ALGORITHMS . . . . . . . . . . . . . . . . . . 40 118 14.11. PASSWORD-ALGORITHM . . . . . . . . . . . . . . . . . . . 41 119 14.12. UNKNOWN-ATTRIBUTES . . . . . . . . . . . . . . . . . . . 42 120 14.13. SOFTWARE . . . . . . . . . . . . . . . . . . . . . . . . 42 121 14.14. ALTERNATE-SERVER . . . . . . . . . . . . . . . . . . . . 42 122 15. Security Considerations . . . . . . . . . . . . . . . . . . . 42 123 15.1. Attacks against the Protocol . . . . . . . . . . . . . . 43 124 15.1.1. Outside Attacks . . . . . . . . . . . . . . . . . . 43 125 15.1.2. Inside Attacks . . . . . . . . . . . . . . . . . . . 43 126 15.2. Attacks Affecting the Usage . . . . . . . . . . . . . . 44 127 15.2.1. Attack I: Distributed DoS (DDoS) against a Target . 44 128 15.2.2. Attack II: Silencing a Client . . . . . . . . . . . 45 129 15.2.3. Attack III: Assuming the Identity of a Client . . . 45 130 15.2.4. Attack IV: Eavesdropping . . . . . . . . . . . . . . 45 131 15.3. Hash Agility Plan . . . . . . . . . . . . . . . . . . . 45 132 16. IAB Considerations . . . . . . . . . . . . . . . . . . . . . 46 133 17. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 46 134 17.1. STUN Methods Registry . . . . . . . . . . . . . . . . . 46 135 17.2. STUN Attribute Registry . . . . . . . . . . . . . . . . 47 136 17.3. STUN Error Code Registry . . . . . . . . . . . . . . . . 48 137 17.4. Password Algorithm Registry . . . . . . . . . . . . . . 48 138 17.4.1. Password Algorithms . . . . . . . . . . . . . . . . 48 139 17.4.1.1. Salted SHA256 . . . . . . . . . . . . . . . . . 49 140 17.5. STUN UDP and TCP Port Numbers . . . . . . . . . . . . . 49 141 18. Changes since RFC 5389 . . . . . . . . . . . . . . . . . . . 49 142 19. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 49 143 20. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 49 144 21. References . . . . . . . . . . . . . . . . . . . . . . . . . 50 145 21.1. Normative References . . . . . . . . . . . . . . . . . . 50 146 21.2. Informational References . . . . . . . . . . . . . . . . 52 147 Appendix A. C Snippet to Determine STUN Message Types . . . . . 53 148 Appendix B. Release notes . . . . . . . . . . . . . . . . . . . 54 149 B.1. Open Issues . . . . . . . . . . . . . . . . . . . . . . . 54 150 B.2. Modifications between draft-ietf-tram-stunbis-01 and 151 draft-ietf-tram-stunbis-00 . . . . . . . . . . . . . . . 54 152 B.3. Modifications between draft-salgueiro-tram-stunbis-02 and 153 draft-ietf-tram-stunbis-00 . . . . . . . . . . . . . . . 55 154 B.4. Modifications between draft-salgueiro-tram-stunbis-02 and 155 draft-salgueiro-tram-stunbis-01 . . . . . . . . . . . . . 55 156 B.5. Modifications between draft-salgueiro-tram-stunbis-01 and 157 draft-salgueiro-tram-stunbis-00 . . . . . . . . . . . . . 56 158 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 56 160 1. Introduction 162 The protocol defined in this specification, Session Traversal 163 Utilities for NAT, provides a tool for dealing with NATs. It 164 provides a means for an endpoint to determine the IP address and port 165 allocated by a NAT that corresponds to its private IP address and 166 port. It also provides a way for an endpoint to keep a NAT binding 167 alive. With some extensions, the protocol can be used to do 168 connectivity checks between two endpoints [RFC5245], or to relay 169 packets between two endpoints [RFC5766]. 171 In keeping with its tool nature, this specification defines an 172 extensible packet format, defines operation over several transport 173 protocols, and provides for two forms of authentication. 175 STUN is intended to be used in context of one or more NAT traversal 176 solutions. These solutions are known as STUN usages. Each usage 177 describes how STUN is utilized to achieve the NAT traversal solution. 178 Typically, a usage indicates when STUN messages get sent, which 179 optional attributes to include, what server is used, and what 180 authentication mechanism is to be used. Interactive Connectivity 181 Establishment (ICE) [RFC5245] is one usage of STUN. SIP Outbound 182 [RFC5626] is another usage of STUN. In some cases, a usage will 183 require extensions to STUN. A STUN extension can be in the form of 184 new methods, attributes, or error response codes. More information 185 on STUN usages can be found in Section 13. 187 2. Overview of Operation 189 This section is descriptive only. 191 /-----\ 192 // STUN \\ 193 | Server | 194 \\ // 195 \-----/ 197 +--------------+ Public Internet 198 ................| NAT 2 |....................... 199 +--------------+ 201 +--------------+ Private NET 2 202 ................| NAT 1 |....................... 203 +--------------+ 205 /-----\ 206 // STUN \\ 207 | Client | 208 \\ // Private NET 1 209 \-----/ 211 Figure 1: One Possible STUN Configuration 213 One possible STUN configuration is shown in Figure 1. In this 214 configuration, there are two entities (called STUN agents) that 215 implement the STUN protocol. The lower agent in the figure is the 216 client, and is connected to private network 1. This network connects 217 to private network 2 through NAT 1. Private network 2 connects to 218 the public Internet through NAT 2. The upper agent in the figure is 219 the server, and resides on the public Internet. 221 STUN is a client-server protocol. It supports two types of 222 transactions. One is a request/response transaction in which a 223 client sends a request to a server, and the server returns a 224 response. The second is an indication transaction in which either 225 agent -- client or server -- sends an indication that generates no 226 response. Both types of transactions include a transaction ID, which 227 is a randomly selected 96-bit number. For request/response 228 transactions, this transaction ID allows the client to associate the 229 response with the request that generated it; for indications, the 230 transaction ID serves as a debugging aid. 232 All STUN messages start with a fixed header that includes a method, a 233 class, and the transaction ID. The method indicates which of the 234 various requests or indications this is; this specification defines 235 just one method, Binding, but other methods are expected to be 236 defined in other documents. The class indicates whether this is a 237 request, a success response, an error response, or an indication. 238 Following the fixed header comes zero or more attributes, which are 239 Type-Length-Value extensions that convey additional information for 240 the specific message. 242 This document defines a single method called Binding. The Binding 243 method can be used either in request/response transactions or in 244 indication transactions. When used in request/response transactions, 245 the Binding method can be used to determine the particular "binding" 246 a NAT has allocated to a STUN client. When used in either request/ 247 response or in indication transactions, the Binding method can also 248 be used to keep these "bindings" alive. 250 In the Binding request/response transaction, a Binding request is 251 sent from a STUN client to a STUN server. When the Binding request 252 arrives at the STUN server, it may have passed through one or more 253 NATs between the STUN client and the STUN server (in Figure 1, there 254 were two such NATs). As the Binding request message passes through a 255 NAT, the NAT will modify the source transport address (that is, the 256 source IP address and the source port) of the packet. As a result, 257 the source transport address of the request received by the server 258 will be the public IP address and port created by the NAT closest to 259 the server. This is called a reflexive transport address. The STUN 260 server copies that source transport address into an XOR-MAPPED- 261 ADDRESS attribute in the STUN Binding response and sends the Binding 262 response back to the STUN client. As this packet passes back through 263 a NAT, the NAT will modify the destination transport address in the 264 IP header, but the transport address in the XOR-MAPPED-ADDRESS 265 attribute within the body of the STUN response will remain untouched. 266 In this way, the client can learn its reflexive transport address 267 allocated by the outermost NAT with respect to the STUN server. 269 In some usages, STUN must be multiplexed with other protocols (e.g., 270 [RFC5245], [RFC5626]). In these usages, there must be a way to 271 inspect a packet and determine if it is a STUN packet or not. STUN 272 provides three fields in the STUN header with fixed values that can 273 be used for this purpose. If this is not sufficient, then STUN 274 packets can also contain a FINGERPRINT value, which can further be 275 used to distinguish the packets. 277 STUN defines a set of optional procedures that a usage can decide to 278 use, called mechanisms. These mechanisms include DNS discovery, a 279 redirection technique to an alternate server, a fingerprint attribute 280 for demultiplexing, and two authentication and message-integrity 281 exchanges. The authentication mechanisms revolve around the use of a 282 username, password, and message-integrity value. Two authentication 283 mechanisms, the long-term credential mechanism and the short-term 284 credential mechanism, are defined in this specification. Each usage 285 specifies the mechanisms allowed with that usage. 287 In the long-term credential mechanism, the client and server share a 288 pre-provisioned username and password and perform a digest challenge/ 289 response exchange inspired by (but differing in details) to the one 290 defined for HTTP [RFC2617]. In the short-term credential mechanism, 291 the client and the server exchange a username and password through 292 some out-of-band method prior to the STUN exchange. For example, in 293 the ICE usage [RFC5245] the two endpoints use out-of-band signaling 294 to exchange a username and password. These are used to integrity 295 protect and authenticate the request and response. There is no 296 challenge or nonce used. 298 3. Terminology 300 In this document, the key words "MUST", "MUST NOT", "REQUIRED", 301 "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", 302 and "OPTIONAL" are to be interpreted as described in BCP 14, RFC 2119 303 [RFC2119] and indicate requirement levels for compliant STUN 304 implementations. 306 4. Definitions 308 STUN Agent: A STUN agent is an entity that implements the STUN 309 protocol. The entity can be either a STUN client or a STUN 310 server. 312 STUN Client: A STUN client is an entity that sends STUN requests and 313 receives STUN responses. A STUN client can also send indications. 314 In this specification, the terms STUN client and client are 315 synonymous. 317 STUN Server: A STUN server is an entity that receives STUN requests 318 and sends STUN responses. A STUN server can also send 319 indications. In this specification, the terms STUN server and 320 server are synonymous. 322 Transport Address: The combination of an IP address and port number 323 (such as a UDP or TCP port number). 325 Reflexive Transport Address: A transport address learned by a client 326 that identifies that client as seen by another host on an IP 327 network, typically a STUN server. When there is an intervening 328 NAT between the client and the other host, the reflexive transport 329 address represents the mapped address allocated to the client on 330 the public side of the NAT. Reflexive transport addresses are 331 learned from the mapped address attribute (MAPPED-ADDRESS or XOR- 332 MAPPED-ADDRESS) in STUN responses. 334 Mapped Address: Same meaning as reflexive address. This term is 335 retained only for historic reasons and due to the naming of the 336 MAPPED-ADDRESS and XOR-MAPPED-ADDRESS attributes. 338 Long-Term Credential: A username and associated password that 339 represent a shared secret between client and server. Long-term 340 credentials are generally granted to the client when a subscriber 341 enrolls in a service and persist until the subscriber leaves the 342 service or explicitly changes the credential. 344 Long-Term Password: The password from a long-term credential. 346 Short-Term Credential: A temporary username and associated password 347 that represent a shared secret between client and server. Short- 348 term credentials are obtained through some kind of protocol 349 mechanism between the client and server, preceding the STUN 350 exchange. A short-term credential has an explicit temporal scope, 351 which may be based on a specific amount of time (such as 5 352 minutes) or on an event (such as termination of a SIP dialog). 353 The specific scope of a short-term credential is defined by the 354 application usage. 356 Short-Term Password: The password component of a short-term 357 credential. 359 STUN Indication: A STUN message that does not receive a response. 361 Attribute: The STUN term for a Type-Length-Value (TLV) object that 362 can be added to a STUN message. Attributes are divided into two 363 types: comprehension-required and comprehension-optional. STUN 364 agents can safely ignore comprehension-optional attributes they 365 don't understand, but cannot successfully process a message if it 366 contains comprehension-required attributes that are not 367 understood. 369 RTO: Retransmission TimeOut, which defines the initial period of 370 time between transmission of a request and the first retransmit of 371 that request. 373 5. STUN Message Structure 375 STUN messages are encoded in binary using network-oriented format 376 (most significant byte or octet first, also commonly known as big- 377 endian). The transmission order is described in detail in Appendix B 378 of RFC791 [RFC0791]. Unless otherwise noted, numeric constants are 379 in decimal (base 10). 381 All STUN messages MUST start with a 20-byte header followed by zero 382 or more Attributes. The STUN header contains a STUN message type, 383 magic cookie, transaction ID, and message length. 385 0 1 2 3 386 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 387 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 388 |0 0| STUN Message Type | Message Length | 389 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 390 | Magic Cookie | 391 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 392 | | 393 | Transaction ID (96 bits) | 394 | | 395 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 397 Figure 2: Format of STUN Message Header 399 The most significant 2 bits of every STUN message MUST be zeroes. 400 This can be used to differentiate STUN packets from other protocols 401 when STUN is multiplexed with other protocols on the same port. 403 The message type defines the message class (request, success 404 response, failure response, or indication) and the message method 405 (the primary function) of the STUN message. Although there are four 406 message classes, there are only two types of transactions in STUN: 407 request/response transactions (which consist of a request message and 408 a response message) and indication transactions (which consist of a 409 single indication message). Response classes are split into error 410 and success responses to aid in quickly processing the STUN message. 412 The message type field is decomposed further into the following 413 structure: 415 0 1 416 2 3 4 5 6 7 8 9 0 1 2 3 4 5 418 +--+--+-+-+-+-+-+-+-+-+-+-+-+-+ 419 |M |M |M|M|M|C|M|M|M|C|M|M|M|M| 420 |11|10|9|8|7|1|6|5|4|0|3|2|1|0| 421 +--+--+-+-+-+-+-+-+-+-+-+-+-+-+ 423 Figure 3: Format of STUN Message Type Field 425 Here the bits in the message type field are shown as most significant 426 (M11) through least significant (M0). M11 through M0 represent a 427 12-bit encoding of the method. C1 and C0 represent a 2-bit encoding 428 of the class. A class of 0b00 is a request, a class of 0b01 is an 429 indication, a class of 0b10 is a success response, and a class of 430 0b11 is an error response. This specification defines a single 431 method, Binding. The method and class are orthogonal, so that for 432 each method, a request, success response, error response, and 433 indication are possible for that method. Extensions defining new 434 methods MUST indicate which classes are permitted for that method. 436 For example, a Binding request has class=0b00 (request) and 437 method=0b000000000001 (Binding) and is encoded into the first 16 bits 438 as 0x0001. A Binding response has class=0b10 (success response) and 439 method=0b000000000001, and is encoded into the first 16 bits as 440 0x0101. 442 Note: This unfortunate encoding is due to assignment of values in 443 [RFC3489] that did not consider encoding Indications, Success, and 444 Errors using bit fields. 446 The magic cookie field MUST contain the fixed value 0x2112A442 in 447 network byte order. In RFC 3489 [RFC3489], this field was part of 448 the transaction ID; placing the magic cookie in this location allows 449 a server to detect if the client will understand certain attributes 450 that were added in this revised specification. In addition, it aids 451 in distinguishing STUN packets from packets of other protocols when 452 STUN is multiplexed with those other protocols on the same port. 454 The transaction ID is a 96-bit identifier, used to uniquely identify 455 STUN transactions. For request/response transactions, the 456 transaction ID is chosen by the STUN client for the request and 457 echoed by the server in the response. For indications, it is chosen 458 by the agent sending the indication. It primarily serves to 459 correlate requests with responses, though it also plays a small role 460 in helping to prevent certain types of attacks. The server also uses 461 the transaction ID as a key to identify each transaction uniquely 462 across all clients. As such, the transaction ID MUST be uniformly 463 and randomly chosen from the interval 0 .. 2**96-1, and SHOULD be 464 cryptographically random. Resends of the same request reuse the same 465 transaction ID, but the client MUST choose a new transaction ID for 466 new transactions unless the new request is bit-wise identical to the 467 previous request and sent from the same transport address to the same 468 IP address. Success and error responses MUST carry the same 469 transaction ID as their corresponding request. When an agent is 470 acting as a STUN server and STUN client on the same port, the 471 transaction IDs in requests sent by the agent have no relationship to 472 the transaction IDs in requests received by the agent. 474 The message length MUST contain the size, in bytes, of the message 475 not including the 20-byte STUN header. Since all STUN attributes are 476 padded to a multiple of 4 bytes, the last 2 bits of this field are 477 always zero. This provides another way to distinguish STUN packets 478 from packets of other protocols. 480 Following the STUN fixed portion of the header are zero or more 481 attributes. Each attribute is TLV (Type-Length-Value) encoded. The 482 details of the encoding, and of the attributes themselves are given 483 in Section 14. 485 6. Base Protocol Procedures 487 This section defines the base procedures of the STUN protocol. It 488 describes how messages are formed, how they are sent, and how they 489 are processed when they are received. It also defines the detailed 490 processing of the Binding method. Other sections in this document 491 describe optional procedures that a usage may elect to use in certain 492 situations. Other documents may define other extensions to STUN, by 493 adding new methods, new attributes, or new error response codes. 495 6.1. Forming a Request or an Indication 497 When formulating a request or indication message, the agent MUST 498 follow the rules in Section 5 when creating the header. In addition, 499 the message class MUST be either "Request" or "Indication" (as 500 appropriate), and the method must be either Binding or some method 501 defined in another document. 503 The agent then adds any attributes specified by the method or the 504 usage. For example, some usages may specify that the agent use an 505 authentication method (Section 9) or the FINGERPRINT attribute 506 (Section 7). 508 If the agent is sending a request, it SHOULD add a SOFTWARE attribute 509 to the request. Agents MAY include a SOFTWARE attribute in 510 indications, depending on the method. Extensions to STUN should 511 discuss whether SOFTWARE is useful in new indications. 513 For the Binding method with no authentication, no attributes are 514 required unless the usage specifies otherwise. 516 All STUN messages sent over UDP or DTLS-over-UDP [RFC6347] SHOULD be 517 less than the path MTU, if known. 519 If the path MTU is unknown for UDP, messages SHOULD be the smaller of 520 576 bytes and the first-hop MTU for IPv4 [RFC1122] and 1280 bytes for 521 IPv6 [RFC2460]. This value corresponds to the overall size of the IP 522 packet. Consequently, for IPv4, the actual STUN message would need 523 to be less than 548 bytes (576 minus 20-byte IP header, minus 8-byte 524 UDP header, assuming no IP options are used). 526 If the path MTU is unknown for DTLS-over-UDP, the rules described in 527 the previous paragraph need to be adjusted to take into account the 528 size of the (13-byte) DTLS Record header, the MAC size, and the 529 padding size. 531 If a STUN client needs to send requests that are larger than the MTU, 532 or if an application envisions that a response would be larger then 533 the MTU, then it MUST use SCTP-over-UDP or SCTP-over-DTLS-over-UDP as 534 transport, unless the purpose of sending an oversized packet is to 535 probe for MTU characteristics (see [RFC5780]). 537 6.2. Sending the Request or Indication 539 The agent then sends the request or indication. This document 540 specifies how to send STUN messages over UDP, TCP, TLS-over-TCP, 541 DTLS-over-UDP, SCTP-over-UDP, or SCTP-over-DTLS-over-UDP; other 542 transport protocols may be added in the future. The STUN usage must 543 specify which transport protocol is used, and how the agent 544 determines the IP address and port of the recipient. Section 8 545 describes a DNS-based method of determining the IP address and port 546 of a server that a usage may elect to use. STUN may be used with 547 anycast addresses, but only with UDP and in usages where 548 authentication is not used. 550 At any time, a client MAY have multiple outstanding STUN requests 551 with the same STUN server (that is, multiple transactions in 552 progress, with different transaction IDs). Absent other limits to 553 the rate of new transactions (such as those specified by ICE for 554 connectivity checks or when STUN is run over TCP), a client SHOULD 555 space new transactions to a server by RTO and SHOULD limit itself to 556 ten outstanding transactions to the same server. 558 6.2.1. Sending over UDP or DTLS-over-UDP 560 When running STUN over UDP or STUN over DTLS-over-UDP [RFC7350], it 561 is possible that the STUN message might be dropped by the network. 562 Reliability of STUN request/response transactions is accomplished 563 through retransmissions of the request message by the client 564 application itself. STUN indications are not retransmitted; thus, 565 indication transactions over UDP or DTLS-over-UDP are not reliable. 567 A client SHOULD retransmit a STUN request message starting with an 568 interval of RTO ("Retransmission TimeOut"), doubling after each 569 retransmission. The RTO is an estimate of the round-trip time (RTT), 570 and is computed as described in RFC 6298 [RFC6298], with two 571 exceptions. First, the initial value for RTO SHOULD be greater than 572 500 ms. The exception cases for this "SHOULD" are when other 573 mechanisms are used to derive congestion thresholds (such as the ones 574 defined in ICE for fixed rate streams), or when STUN is used in non- 575 Internet environments with known network capacities. In fixed-line 576 access links, a value of 500 ms is RECOMMENDED. Second, the value of 577 RTO SHOULD NOT be rounded up to the nearest second. Rather, a 1 ms 578 accuracy SHOULD be maintained. As with TCP, the usage of Karn's 579 algorithm is RECOMMENDED [KARN87]. When applied to STUN, it means 580 that RTT estimates SHOULD NOT be computed from STUN transactions that 581 result in the retransmission of a request. 583 The value for RTO SHOULD be cached by a client after the completion 584 of the transaction, and used as the starting value for RTO for the 585 next transaction to the same server (based on equality of IP 586 address). The value SHOULD be considered stale and discarded after 587 10 minutes without any transactions to the same server. 589 Retransmissions continue until a response is received, or until a 590 total of Rc requests have been sent. Rc SHOULD be configurable and 591 SHOULD have a default of 7. If, after the last request, a duration 592 equal to Rm times the RTO has passed without a response (providing 593 ample time to get a response if only this final request actually 594 succeeds), the client SHOULD consider the transaction to have failed. 595 Rm SHOULD be configurable and SHOULD have a default of 16. A STUN 596 transaction over UDP or DTLS-over-UDP is also considered failed if 597 there has been a hard ICMP error [RFC1122]. For example, assuming an 598 RTO of 500ms, requests would be sent at times 0 ms, 500 ms, 1500 ms, 599 3500 ms, 7500 ms, 15500 ms, and 31500 ms. If the client has not 600 received a response after 39500 ms, the client will consider the 601 transaction to have timed out. 603 6.2.2. Sending over TCP or TLS-over-TCP 605 For TCP and TLS-over-TCP [RFC5246], the client opens a TCP connection 606 to the server. 608 In some usages of STUN, STUN is sent as the only protocol over the 609 TCP connection. In this case, it can be sent without the aid of any 610 additional framing or demultiplexing. In other usages, or with other 611 extensions, it may be multiplexed with other data over a TCP 612 connection. In that case, STUN MUST be run on top of some kind of 613 framing protocol, specified by the usage or extension, which allows 614 for the agent to extract complete STUN messages and complete 615 application layer messages. The STUN service running on the well- 616 known port or ports discovered through the DNS procedures in 617 Section 8 is for STUN alone, and not for STUN multiplexed with other 618 data. Consequently, no framing protocols are used in connections to 619 those servers. When additional framing is utilized, the usage will 620 specify how the client knows to apply it and what port to connect to. 621 For example, in the case of ICE connectivity checks, this information 622 is learned through out-of-band negotiation between client and server. 624 Reliability of STUN over TCP and TLS-over-TCP is handled by TCP 625 itself, and there are no retransmissions at the STUN protocol level. 626 However, for a request/response transaction, if the client has not 627 received a response by Ti seconds after it sent the SYN to establish 628 the connection, it considers the transaction to have timed out. Ti 629 SHOULD be configurable and SHOULD have a default of 39.5s. This 630 value has been chosen to equalize the TCP and UDP timeouts for the 631 default initial RTO. 633 In addition, if the client is unable to establish the TCP connection, 634 or the TCP connection is reset or fails before a response is 635 received, any request/response transaction in progress is considered 636 to have failed. 638 The client MAY send multiple transactions over a single TCP (or TLS- 639 over-TCP) connection, and it MAY send another request before 640 receiving a response to the previous. The client SHOULD keep the 641 connection open until it: 643 o has no further STUN requests or indications to send over that 644 connection, and 646 o has no plans to use any resources (such as a mapped address 647 (MAPPED-ADDRESS or XOR-MAPPED-ADDRESS) or relayed address 648 [RFC5766]) that were learned though STUN requests sent over that 649 connection, and 651 o if multiplexing other application protocols over that port, has 652 finished using that other application, and 654 o if using that learned port with a remote peer, has established 655 communications with that remote peer, as is required by some TCP 656 NAT traversal techniques (e.g., [RFC6544]). 658 At the server end, the server SHOULD keep the connection open, and 659 let the client close it, unless the server has determined that the 660 connection has timed out (for example, due to the client 661 disconnecting from the network). Bindings learned by the client will 662 remain valid in intervening NATs only while the connection remains 663 open. Only the client knows how long it needs the binding. The 664 server SHOULD NOT close a connection if a request was received over 665 that connection for which a response was not sent. A server MUST NOT 666 ever open a connection back towards the client in order to send a 667 response. Servers SHOULD follow best practices regarding connection 668 management in cases of overload. 670 6.2.3. Sending over SCTP-over-UDP or SCTP-over-DTLS-over-UDP 672 For SCTP-over-UDP [RFC6951] and SCTP-over-DTLS-over-UDP 673 [I-D.ietf-tsvwg-sctp-dtls-encaps], the client opens a Stream Control 674 Transmission Protocol (SCTP) connection to the server. 676 For some STUN usages, STUN is sent over SCTP as the only protocol 677 over the UDP association. In this case, it can be sent without the 678 aid of any additional demultiplexing. In other usages, or with other 679 extensions, it may be multiplexed with other data over a UDP 680 association. In that case, the SCTP source and destination ports 681 MUST be chosen so the two most significant bits are 0b11. 683 Reliability of STUN over SCTP-over-UDP and STUN over SCTP-over-DTLS- 684 over-UDP is handled by SCTP itself and there are no retransmissions 685 at the STUN protocol level. However, for a request/response 686 transaction, if the client has not received a response by Ti seconds 687 after it sent the INIT to establish the connection, it considers the 688 transaction to have timed out. Ti SHOULD be configurable and SHOULD 689 have a default of 39.5s. This value has been chosen to equalize the 690 SCTP-over-UDP, TCP, and UDP timeouts for the default initial RTO. 692 In addition, if the client is unable to establish the SCTP 693 connection, or the SCTP connection is reset or fails before a 694 response is received, any request/response transaction in progress is 695 considered to have failed. 697 The client MAY send multiple transactions over a single SCTP (or 698 SCTP-over-DTLS) connection and it MAY send another request before 699 receiving a response to the previous. Each transaction MUST use a 700 different SCTP stream ID. The client SHOULD keep the connection open 701 until it: 703 o has no further STUN requests or indications to send over that 704 connection, and 706 o has no plans to use any resources (such as a mapped address 707 (MAPPED-ADDRESS or XOR-MAPPED-ADDRESS) or relayed address 708 [RFC5766]) that were learned through STUN requests sent over that 709 connection, and 711 o has finished using all corresponding applications if multiplexing 712 other application protocols over that port 714 When using SCTP-over-UDP, the SCTP source port and destination port 715 MUST be selected so the two most significant bits are set to "1". 716 This permits multiplexing of STUN-over-UDP, STUN-over-SCTP-over-UDP, 717 DTLS, and RTP/RTCP on the same socket. 719 STUN indications MAY be sent unreliably by using the SCTP extension 720 in [RFC3758], augmented with the policies of 721 [I-D.ietf-tsvwg-sctp-prpolicies]. Each STUN usage MUST specify the 722 conditions under which STUN indications are sent reliably or not, and 723 MUST specify the policy for allocating an SCTP stream ID. The NAT 724 Discovery usage described in this document does not use STUN 725 indications. 727 At the server end, the server SHOULD keep the connection open and let 728 the client close it unless the server has determined that the 729 connection has timed out (for example, due to the client 730 disconnecting from the network). Bindings learned by the client will 731 remain valid in intervening NATs only while the connection remains 732 open. Only the client knows how long it needs the binding. The 733 server SHOULD NOT close a connection if a request was received over 734 that connection for which a response was not sent. A server MUST NOT 735 ever open a connection back towards the client in order to send a 736 response. Servers SHOULD follow best practices regarding connection 737 management in cases of overload. 739 6.2.4. Sending over TLS-over-TCP or DTLS-over-UDP or SCTP-over-DTLS- 740 over-UDP 742 When STUN is run by itself over TLS-over-TCP or DTLS-over-UDP or 743 SCTP-over-DTLS-over-UDP, the TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 and 744 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher suites MUST be 745 implemented and other cipher suites MAY be implemented. Perfect 746 Forward Secrecy (PFS) cipher suites MUST be preferred over non-PFS 747 cipher suites. Cipher suites with known weaknesses, such as those 748 based on (single) DES and RC4, MUST NOT be used. Implementations 749 MUST disable TLS-level compression. 751 When it receives the TLS Certificate message, the client SHOULD 752 verify the certificate and inspect the site identified by the 753 certificate. If the certificate is invalid or revoked, or if it does 754 not identify the appropriate party, the client MUST NOT send the STUN 755 message or otherwise proceed with the STUN transaction. The client 756 MUST verify the identity of the server using the following procedure. 758 STUN clients that are using the mechanism in Section 8, and that have 759 established that all DNS Resource Records from the Source Domain to 760 the Host Name are secure according to DNSsec [RFC4033] (i.e., that 761 the AD bit is set in all the DNS responses) MUST lookup a TLSA 762 Resource Record [RFC6698] for the protocol, port and Host Name 763 selected. If the TLSA Resource Record is secure then the STUN client 764 MUST use it to validate the certificate presented by the STUN server. 765 If there is no TLSA Resource Record or if the Resource Record is not 766 secure, then the client MUST fallback to the validation process 767 defined in Section 3.1 of RFC 2818 [RFC2818]. 769 Alternatively, a client MAY be configured with a set of domains or IP 770 addresses that are trusted. If a certificate is received that 771 identifies one of those trusted domains or IP addresses, the client 772 considers the identity of the server to be verified. 774 When STUN is multiplexed with other protocols over a TLS-over-TCP 775 connection or a DTLS-over-UDP or a SCTP-over-DTLS-over-UDP 776 association, the mandatory ciphersuites and TLS handling procedures 777 operate as defined by those protocols. 779 6.3. Receiving a STUN Message 781 This section specifies the processing of a STUN message. The 782 processing specified here is for STUN messages as defined in this 783 specification; additional rules for backwards compatibility are 784 defined in Section 11. Those additional procedures are optional, and 785 usages can elect to utilize them. First, a set of processing 786 operations is applied that is independent of the class. This is 787 followed by class-specific processing, described in the subsections 788 that follow. 790 When a STUN agent receives a STUN message, it first checks that the 791 message obeys the rules of Section 5. It checks that the first two 792 bits are 0, that the magic cookie field has the correct value, that 793 the message length is sensible, and that the method value is a 794 supported method. It checks that the message class is allowed for 795 the particular method. If the message class is "Success Response" or 796 "Error Response", the agent checks that the transaction ID matches a 797 transaction that is still in progress. If the FINGERPRINT extension 798 is being used, the agent checks that the FINGERPRINT attribute is 799 present and contains the correct value. If any errors are detected, 800 the message is silently discarded. In the case when STUN is being 801 multiplexed with another protocol, an error may indicate that this is 802 not really a STUN message; in this case, the agent should try to 803 parse the message as a different protocol. 805 The STUN agent then does any checks that are required by a 806 authentication mechanism that the usage has specified (see 807 Section 9). 809 Once the authentication checks are done, the STUN agent checks for 810 unknown attributes and known-but-unexpected attributes in the 811 message. Unknown comprehension-optional attributes MUST be ignored 812 by the agent. Known-but-unexpected attributes SHOULD be ignored by 813 the agent. Unknown comprehension-required attributes cause 814 processing that depends on the message class and is described below. 816 At this point, further processing depends on the message class of the 817 request. 819 6.3.1. Processing a Request 821 If the request contains one or more unknown comprehension-required 822 attributes, the server replies with an error response with an error 823 code of 420 (Unknown Attribute), and includes an UNKNOWN-ATTRIBUTES 824 attribute in the response that lists the unknown comprehension- 825 required attributes. 827 The server then does any additional checking that the method or the 828 specific usage requires. If all the checks succeed, the server 829 formulates a success response as described below. 831 When run over UDP or DTLS-over-UDP or SCTP-over-UDP or SCTP-over- 832 DTLS-over-UDP, a request received by the server could be the first 833 request of a transaction, or a retransmission. The server MUST 834 respond to retransmissions such that the following property is 835 preserved: if the client receives the response to the retransmission 836 and not the response that was sent to the original request, the 837 overall state on the client and server is identical to the case where 838 only the response to the original retransmission is received, or 839 where both responses are received (in which case the client will use 840 the first). The easiest way to meet this requirement is for the 841 server to remember all transaction IDs received over UDP or DTLS- 842 over-UDP and their corresponding responses in the last 40 seconds. 844 However, this requires the server to hold state, and will be 845 inappropriate for any requests which are not authenticated. Another 846 way is to reprocess the request and recompute the response. The 847 latter technique MUST only be applied to requests that are idempotent 848 (a request is considered idempotent when the same request can be 849 safely repeated without impacting the overall state of the system) 850 and result in the same success response for the same request. The 851 Binding method is considered to be idempotent. Note that there are 852 certain rare network events that could cause the reflexive transport 853 address value to change, resulting in a different mapped address in 854 different success responses. Extensions to STUN MUST discuss the 855 implications of request retransmissions on servers that do not store 856 transaction state. 858 6.3.1.1. Forming a Success or Error Response 860 When forming the response (success or error), the server follows the 861 rules of Section 6. The method of the response is the same as that 862 of the request, and the message class is either "Success Response" or 863 "Error Response". 865 For an error response, the server MUST add an ERROR-CODE attribute 866 containing the error code specified in the processing above. The 867 reason phrase is not fixed, but SHOULD be something suitable for the 868 error code. For certain errors, additional attributes are added to 869 the message. These attributes are spelled out in the description 870 where the error code is specified. For example, for an error code of 871 420 (Unknown Attribute), the server MUST include an UNKNOWN- 872 ATTRIBUTES attribute. Certain authentication errors also cause 873 attributes to be added (see Section 9). Extensions may define other 874 errors and/or additional attributes to add in error cases. 876 If the server authenticated the request using an authentication 877 mechanism, then the server SHOULD add the appropriate authentication 878 attributes to the response (see Section 9). 880 The server also adds any attributes required by the specific method 881 or usage. In addition, the server SHOULD add a SOFTWARE attribute to 882 the message. 884 For the Binding method, no additional checking is required unless the 885 usage specifies otherwise. When forming the success response, the 886 server adds a XOR-MAPPED-ADDRESS attribute to the response, where the 887 contents of the attribute are the source transport address of the 888 request message. For UDP and DTLS-over-UDP, this is the source IP 889 address and source UDP port of the request message. For TCP and TLS- 890 over-TCP, this is the source IP address and source TCP port of the 891 TCP connection as seen by the server. 893 6.3.1.2. Sending the Success or Error Response 895 The response (success or error) is sent over the same transport as 896 the request was received on. If the request was received over UDP or 897 DTLS-over-UDP, the destination IP address and port of the response 898 are the source IP address and port of the received request message, 899 and the source IP address and port of the response are equal to the 900 destination IP address and port of the received request message. If 901 the request was received over TCP or TLS-over-TCP, the response is 902 sent back on the same TCP connection as the request was received on. 904 6.3.2. Processing an Indication 906 If the indication contains unknown comprehension-required attributes, 907 the indication is discarded and processing ceases. 909 The agent then does any additional checking that the method or the 910 specific usage requires. If all the checks succeed, the agent then 911 processes the indication. No response is generated for an 912 indication. 914 For the Binding method, no additional checking or processing is 915 required, unless the usage specifies otherwise. The mere receipt of 916 the message by the agent has refreshed the "bindings" in the 917 intervening NATs. 919 Since indications are not re-transmitted over UDP or DTLS-over-UDP 920 (unlike requests), there is no need to handle re-transmissions of 921 indications at the sending agent. 923 6.3.3. Processing a Success Response 925 If the success response contains unknown comprehension-required 926 attributes, the response is discarded and the transaction is 927 considered to have failed. 929 The client then does any additional checking that the method or the 930 specific usage requires. If all the checks succeed, the client then 931 processes the success response. 933 For the Binding method, the client checks that the XOR-MAPPED-ADDRESS 934 attribute is present in the response. The client checks the address 935 family specified. If it is an unsupported address family, the 936 attribute SHOULD be ignored. If it is an unexpected but supported 937 address family (for example, the Binding transaction was sent over 938 IPv4, but the address family specified is IPv6), then the client MAY 939 accept and use the value. 941 6.3.4. Processing an Error Response 943 If the error response contains unknown comprehension-required 944 attributes, or if the error response does not contain an ERROR-CODE 945 attribute, then the transaction is simply considered to have failed. 947 The client then does any processing specified by the authentication 948 mechanism (see Section 9). This may result in a new transaction 949 attempt. 951 The processing at this point depends on the error code, the method, 952 and the usage; the following are the default rules: 954 o If the error code is 300 through 399, the client SHOULD consider 955 the transaction as failed unless the ALTERNATE-SERVER extension is 956 being used. See Section 10. 958 o If the error code is 400 through 499, the client declares the 959 transaction failed; in the case of 420 (Unknown Attribute), the 960 response should contain a UNKNOWN-ATTRIBUTES attribute that gives 961 additional information. 963 o If the error code is 500 through 599, the client MAY resend the 964 request; clients that do so MUST limit the number of times they do 965 this. 967 Any other error code causes the client to consider the transaction 968 failed. 970 7. FINGERPRINT Mechanism 972 This section describes an optional mechanism for STUN that aids in 973 distinguishing STUN messages from packets of other protocols when the 974 two are multiplexed on the same transport address. This mechanism is 975 optional, and a STUN usage must describe if and when it is used. The 976 FINGERPRINT mechanism is not backwards compatible with RFC3489, and 977 cannot be used in environments where such compatibility is required. 979 In some usages, STUN messages are multiplexed on the same transport 980 address as other protocols, such as the Real Time Transport Protocol 981 (RTP). In order to apply the processing described in Section 6, STUN 982 messages must first be separated from the application packets. 984 Section 5 describes three fixed fields in the STUN header that can be 985 used for this purpose. However, in some cases, these three fixed 986 fields may not be sufficient. 988 When the FINGERPRINT extension is used, an agent includes the 989 FINGERPRINT attribute in messages it sends to another agent. 990 Section 14.6 describes the placement and value of this attribute. 992 When the agent receives what it believes is a STUN message, then, in 993 addition to other basic checks, the agent also checks that the 994 message contains a FINGERPRINT attribute and that the attribute 995 contains the correct value. Section 6.3 describes when in the 996 overall processing of a STUN message the FINGERPRINT check is 997 performed. This additional check helps the agent detect messages of 998 other protocols that might otherwise seem to be STUN messages. 1000 8. DNS Discovery of a Server 1002 This section describes an optional procedure for STUN that allows a 1003 client to use DNS to determine the IP address and port of a server. 1004 A STUN usage must describe if and when this extension is used. To 1005 use this procedure, the client must know a STUN URI [RFC7064]; the 1006 usage must also describe how the client obtains this URI. Hard- 1007 coding a STUN URI into software is NOT RECOMMENDED in case the domain 1008 name is lost or needs to change for legal or other reasons. 1010 When a client wishes to locate a STUN server on the public Internet 1011 that accepts Binding request/response transactions, the STUN URI 1012 scheme is "stun". When it wishes to locate a STUN server that 1013 accepts Binding request/response transactions over a TLS, or DTLS, or 1014 SCTP-over-DTLS session, the URI scheme is "stuns". 1016 The syntax of the "stun" and "stuns" URIs are defined in Section 3.1 1017 of [RFC7064]. STUN usages MAY define additional URI schemes. 1019 8.1. STUN URI Scheme Semantics 1021 If the part contains an IP address, then this IP address is 1022 used directly to contact the server. A "stuns" URI containing an IP 1023 address MUST be rejected, unless the domain name is provided by the 1024 same mechanism that provided the STUN URI, and that domain name can 1025 be passed to the verification code. 1027 If the URI does not contain an IP address, the domain name contained 1028 in the part is resolved to a transport address using the SRV 1029 procedures specified in [RFC2782]. The DNS SRV service name is the 1030 content of the part. The protocol in the SRV lookup is the 1031 transport protocol the client will run STUN over: "udp" for UDP, 1032 "tcp" for TCP, and "sctp-udp" for SCTP-over-UDP. 1034 The procedures of RFC 2782 are followed to determine the server to 1035 contact. RFC 2782 spells out the details of how a set of SRV records 1036 is sorted and then tried. However, RFC 2782 only states that the 1037 client should "try to connect to the (protocol, address, service)" 1038 without giving any details on what happens in the event of failure. 1039 When following these procedures, if the STUN transaction times out 1040 without receipt of a response, the client SHOULD retry the request to 1041 the next server in the ordered defined by RFC 2782. Such a retry is 1042 only possible for request/response transmissions, since indication 1043 transactions generate no response or timeout. 1045 The default port for STUN requests is 3478, for both TCP and UDP. 1046 The default port for STUN over TLS and STUN over DTLS requests is 1047 5349. The default port for STUN over SCTP-over-UDP requests is XXXX. 1048 The default port for STUN over SCTP-over-DTLS-over-UDP requests is 1049 XXXX. Servers can run STUN over DTLS on the same port as STUN over 1050 UDP if the server software supports determining whether the initial 1051 message is a DTLS or STUN message. Servers can run STUN over TLS on 1052 the same port as STUN over TCP if the server software supports 1053 determining whether the initial message is a TLS or STUN message. 1055 Administrators of STUN servers SHOULD use these ports in their SRV 1056 records for UDP and TCP. In all cases, the port in DNS MUST reflect 1057 the one on which the server is listening. 1059 If no SRV records were found, the client performs an A or AAAA record 1060 lookup of the domain name. The result will be a list of IP 1061 addresses, each of which can be contacted at the default port using 1062 UDP or TCP, independent of the STUN usage. For usages that require 1063 TLS, the client connects to one of the IP addresses using the default 1064 STUN over TLS port. For usages that require DTLS, the client 1065 connects to one of the IP addresses using the default STUN over DTLS 1066 port. 1068 9. Authentication and Message-Integrity Mechanisms 1070 This section defines two mechanisms for STUN that a client and server 1071 can use to provide authentication and message integrity; these two 1072 mechanisms are known as the short-term credential mechanism and the 1073 long-term credential mechanism. These two mechanisms are optional, 1074 and each usage must specify if and when these mechanisms are used. 1075 Consequently, both clients and servers will know which mechanism (if 1076 any) to follow based on knowledge of which usage applies. For 1077 example, a STUN server on the public Internet supporting ICE would 1078 have no authentication, whereas the STUN server functionality in an 1079 agent supporting connectivity checks would utilize short-term 1080 credentials. An overview of these two mechanisms is given in 1081 Section 2. 1083 Each mechanism specifies the additional processing required to use 1084 that mechanism, extending the processing specified in Section 6. The 1085 additional processing occurs in three different places: when forming 1086 a message, when receiving a message immediately after the basic 1087 checks have been performed, and when doing the detailed processing of 1088 error responses. 1090 9.1. Short-Term Credential Mechanism 1092 The short-term credential mechanism assumes that, prior to the STUN 1093 transaction, the client and server have used some other protocol to 1094 exchange a credential in the form of a username and password. This 1095 credential is time-limited. The time limit is defined by the usage. 1096 As an example, in the ICE usage [RFC5245], the two endpoints use out- 1097 of-band signaling to agree on a username and password, and this 1098 username and password are applicable for the duration of the media 1099 session. 1101 This credential is used to form a message-integrity check in each 1102 request and in many responses. There is no challenge and response as 1103 in the long-term mechanism; consequently, replay is prevented by 1104 virtue of the time-limited nature of the credential. 1106 9.1.1. HMAC Key 1108 For short-term credentials the HMAC key is defined as follow: 1110 key = SASLprep(password) 1112 where SASLprep() is defined in RFC 4013 [RFC4013]. 1114 9.1.2. Forming a Request or Indication 1116 For a request or indication message, the agent MUST include the 1117 USERNAME, MESSAGE-INTEGRITY2, and MESSAGE-INTEGRITY attributes in the 1118 message. The HMAC for the MESSAGE-INTEGRITY attribute is computed as 1119 described in Section 14.4 and the HMAC for the MESSAGE-INTEGRITY2 1120 attributes is computed as described in Section 14.5. Note that the 1121 password is never included in the request or indication. 1123 9.1.3. Receiving a Request or Indication 1125 After the agent has done the basic processing of a message, the agent 1126 performs the checks listed below in order specified: 1128 o If the message does not contain 1) a MESSAGE-INTEGRITY or a 1129 MESSAGE-INTEGRITY2 attribute and 2) a USERNAME attribute: 1131 * If the message is a request, the server MUST reject the request 1132 with an error response. This response MUST use an error code 1133 of 400 (Bad Request). 1135 * If the message is an indication, the agent MUST silently 1136 discard the indication. 1138 o If the USERNAME does not contain a username value currently valid 1139 within the server: 1141 * If the message is a request, the server MUST reject the request 1142 with an error response. This response MUST use an error code 1143 of 401 (Unauthorized). 1145 * If the message is an indication, the agent MUST silently 1146 discard the indication. 1148 o If the MESSAGE-INTEGRITY2 attribute is present compute the value 1149 for the message integrity as described in Section 14.5, using the 1150 password associated with the username. If the MESSAGE-INTEGRITY2 1151 attribute is not present, and using the same password, compute the 1152 value for the message integrity as described in Section 14.4. If 1153 the resulting value does not match the contents of the MESSAGE- 1154 INTEGRITY2 attribute or the MESSAGE-INTEGRITY attribute: 1156 * If the message is a request, the server MUST reject the request 1157 with an error response. This response MUST use an error code 1158 of 401 (Unauthorized). 1160 * If the message is an indication, the agent MUST silently 1161 discard the indication. 1163 If these checks pass, the agent continues to process the request or 1164 indication. Any response generated by a server to a request that 1165 contains a MESSAGE-INTEGRITY2 attribute MUST include the MESSAGE- 1166 INTEGRITY2 attribute, computed using the password utilized to 1167 authenticate the request. Any response generated by a server to a 1168 request that contains only a MESSAGE-INTEGRITY attribute MUST include 1169 the MESSAGE-INTEGRITY attribute, computed using the password utilized 1170 to authenticate the request. The response MUST NOT contain the 1171 USERNAME attribute. 1173 If any of the checks fail, a server MUST NOT include a MESSAGE- 1174 INTEGRITY2, MESSAGE-INTEGRITY, or USERNAME attribute in the error 1175 response. This is because, in these failure cases, the server cannot 1176 determine the shared secret necessary to compute the MESSAGE- 1177 INTEGRITY2 or MESSAGE-INTEGRITY attributes. 1179 9.1.4. Receiving a Response 1181 The client looks for the MESSAGE-INTEGRITY2 or the MESSAGE-INTEGRITY 1182 attribute in the response. If present, the client computes the 1183 message integrity over the response as defined in Section 14.4 or 1184 Section 14.5, using the same password it utilized for the request. 1185 If the resulting value matches the contents of the MESSAGE-INTEGRITY 1186 or MESSAGE-INTEGRITY2 attribute, the response is considered 1187 authenticated. If the value does not match, or if both MESSAGE- 1188 INTEGRITY and MESSAGE-INTEGRITY2 were absent, the response MUST be 1189 discarded, as if it was never received. This means that retransmits, 1190 if applicable, will continue. 1192 9.1.5. Sending Subsequent Requests 1194 A client sending subsequent requests to the same server a MAY choose 1195 to send only the MESSAGE-INTEGRITY2 or the MESSAGE-INTEGRITY 1196 attribute depending upon the attribute that was received in the 1197 response to the initial request. 1199 9.2. Long-Term Credential Mechanism 1201 The long-term credential mechanism relies on a long-term credential, 1202 in the form of a username and password that are shared between client 1203 and server. The credential is considered long-term since it is 1204 assumed that it is provisioned for a user, and remains in effect 1205 until the user is no longer a subscriber of the system, or is 1206 changed. This is basically a traditional "log-in" username and 1207 password given to users. 1209 Because these usernames and passwords are expected to be valid for 1210 extended periods of time, replay prevention is provided in the form 1211 of a digest challenge. In this mechanism, the client initially sends 1212 a request, without offering any credentials or any integrity checks. 1213 The server rejects this request, providing the user a realm (used to 1214 guide the user or agent in selection of a username and password) and 1215 a nonce. The nonce provides the replay protection. It is a cookie, 1216 selected by the server, and encoded in such a way as to indicate a 1217 duration of validity or client identity from which it is valid. The 1218 client retries the request, this time including its username and the 1219 realm, and echoing the nonce provided by the server. The client also 1220 includes a message-integrity, which provides an HMAC over the entire 1221 request, including the nonce. The server validates the nonce and 1222 checks the message integrity. If they match, the request is 1223 authenticated. If the nonce is no longer valid, it is considered 1224 "stale", and the server rejects the request, providing a new nonce. 1226 In subsequent requests to the same server, the client reuses the 1227 nonce, username, realm, and password it used previously. In this 1228 way, subsequent requests are not rejected until the nonce becomes 1229 invalid by the server, in which case the rejection provides a new 1230 nonce to the client. 1232 Note that the long-term credential mechanism cannot be used to 1233 protect indications, since indications cannot be challenged. Usages 1234 utilizing indications must either use a short-term credential or omit 1235 authentication and message integrity for them. 1237 Since the long-term credential mechanism is susceptible to offline 1238 dictionary attacks, deployments SHOULD utilize passwords that are 1239 difficult to guess. In cases where the credentials are not entered 1240 by the user, but are rather placed on a client device during device 1241 provisioning, the password SHOULD have at least 128 bits of 1242 randomness. In cases where the credentials are entered by the user, 1243 they should follow best current practices around password structure. 1245 9.2.1. HMAC Key 1247 For long-term credentials that do not use a different algorithm, as 1248 specified by the PASSWORD-ALGORITHM attribute, the key is 16 bytes: 1250 key = MD5(username ":" realm ":" SASLprep(password)) 1252 Where MD5 is defined in RFC 1321 [RFC1321] and SASLprep() is defined 1253 in RFC 4013 [RFC4013]. 1255 The 16-byte key is formed by taking the MD5 hash of the result of 1256 concatenating the following five fields: (1) the username, with any 1257 quotes and trailing nulls removed, as taken from the USERNAME 1258 attribute (in which case SASLprep has already been applied); (2) a 1259 single colon; (3) the realm, with any quotes and trailing nulls 1260 removed; (4) a single colon; and (5) the password, with any trailing 1261 nulls removed and after processing using SASLprep. For example, if 1262 the username was 'user', the realm was 'realm', and the password was 1263 'pass', then the 16-byte HMAC key would be the result of performing 1264 an MD5 hash on the string 'user:realm:pass', the resulting hash being 1265 0x8493fbc53ba582fb4c044c456bdc40eb. 1267 The structure of the key when used with long-term credentials 1268 facilitates deployment in systems that also utilize SIP. Typically, 1269 SIP systems utilizing SIP's digest authentication mechanism do not 1270 actually store the password in the database. Rather, they store a 1271 value called H(A1), which is equal to the key defined above. 1273 When a PASSWORD-ALGORITHM is used, the key length and algorithm to 1274 use are described in Section 17.4.1. 1276 9.2.2. Forming a Request 1278 There are two cases when forming a request. In the first case, this 1279 is the first request from the client to the server (as identified by 1280 its IP address and port). In the second case, the client is 1281 submitting a subsequent request once a previous request/response 1282 transaction has completed successfully. Forming a request as a 1283 consequence of a 401 or 438 error response is covered in 1284 Section 9.2.4 and is not considered a "subsequent request" and thus 1285 does not utilize the rules described in Section 9.2.2.2. 1287 9.2.2.1. First Request 1289 If the client has not completed a successful request/response 1290 transaction with the server (as identified by hostname, if the DNS 1291 procedures of Section 8 are used, else IP address if not), it SHOULD 1292 omit the USERNAME, MESSAGE-INTEGRITY, MESSAGE-INTEGRITY2, REALM, 1293 NONCE, PASSWORD-ALGORITHMS, and PASSWORD-ALGORITHM attributes. In 1294 other words, the very first request is sent as if there were no 1295 authentication or message integrity applied. 1297 9.2.2.2. Subsequent Requests 1299 Once a request/response transaction has completed successfully, the 1300 client will have been presented a realm and nonce by the server, and 1301 selected a username and password with which it authenticated. The 1302 client SHOULD cache the username, password, realm, and nonce for 1303 subsequent communications with the server. When the client sends a 1304 subsequent request, it SHOULD include the USERNAME, REALM, NONCE, and 1305 PASSWORD-ALGORITHM attributes with these cached values. It SHOULD 1306 include a MESSAGE-INTEGRITY attribute or a MESSAGE-INTEGRITY2 1307 attribute, computed as described in Section 14.4 and Section 14.5 1308 using the cached password. The choice between the two attributes 1309 depends on the attribute received in the response to the first 1310 request. 1312 9.2.3. Receiving a Request 1314 After the server has done the basic processing of a request, it 1315 performs the checks listed below in the order specified: 1317 o If the message does not contain a MESSAGE-INTEGRITY or MESSAGE- 1318 INTEGRITY2 attribute, the server MUST generate an error response 1319 with an error code of 401 (Unauthorized). This response MUST 1320 include a REALM value. It is RECOMMENDED that the REALM value be 1321 the domain name of the provider of the STUN server. The response 1322 MUST include a NONCE, selected by the server. The server MAY 1323 support alternate password algorithms, in which case it can list 1324 them in preferential order in a PASSWORD-ALGORITHMS attribute. If 1325 the server adds a PASSWORD-ALGORITHMS attribute it MUST prepend 1326 the NONCE attribute value with the chracater string "obMatJos2". 1327 The response SHOULD NOT contain a USERNAME, MESSAGE-INTEGRITY or 1328 MESSAGE-INTEGRITY2 attribute. 1330 o If the message contains a MESSAGE-INTEGRITY or a MESSAGE- 1331 INTEGRITY2 attribute, but is missing the USERNAME, REALM, or NONCE 1332 attribute, the server MUST generate an error response with an 1333 error code of 400 (Bad Request). This response SHOULD NOT include 1334 a USERNAME, NONCE, REALM, MESSAGE-INTEGRITY or MESSAGE-INTEGRITY2 1335 attribute. 1337 o If the NONCE attribute starts with the value "obMatJos2" but the 1338 PASSWORD-ALGORITHMS attribute is not present or is not identical 1339 to the PASSWORD-ALGORITHMS attribute sent in the response, the 1340 server MUST generate an error response with an error code of 400 1341 (Bad Request). This response SHOULD NOT include a USERNAME, 1342 NONCE, REALM, MESSAGE-INTEGRITY, or MESSAGE-INTEGRITY2 attribute. 1344 o If the NONCE is no longer valid, the server MUST generate an error 1345 response with an error code of 438 (Stale Nonce). This response 1346 MUST include NONCE and REALM attributes and SHOULD NOT include the 1347 USERNAME, MESSAGE-INTEGRITY, or MESSAGE-INTEGRITY2 attribute. 1348 Servers can invalidate nonces in order to provide additional 1349 security. See Section 4.3 of [RFC2617] for guidelines. 1351 o If the username in the USERNAME attribute is not valid, the server 1352 MUST generate an error response with an error code of 401 1353 (Unauthorized). This response MUST include a REALM value. It is 1354 RECOMMENDED that the REALM value be the domain name of the 1355 provider of the STUN server. The response MUST include a NONCE, 1356 selected by the server. The response SHOULD NOT contain a 1357 USERNAME, MESSAGE-INTEGRITY or MESSAGE-INTEGRITY2 attribute. 1359 o If the MESSAGE-INTEGRITY2 attribute is present compute the value 1360 for the message integrity as described in Section 14.5, using the 1361 password associated with the username. Else, using the same 1362 password, compute the value for the message integrity as described 1363 in Section 14.4. If the resulting value does not match the 1364 contents of the MESSAGE-INTEGRITY attribute or the MESSAGE- 1365 INTEGRITY2 attribute, the server MUST reject the request with an 1366 error response. This response MUST use an error code of 401 1367 (Unauthorized). It MUST include REALM and NONCE attributes and 1368 SHOULD NOT include the USERNAME, MESSAGE-INTEGRITY, or MESSAGE- 1369 INTEGRITY2 attribute. 1371 If these checks pass, the server continues to process the request. 1372 Any response generated by the server (excepting the cases described 1373 above) MUST include both the MESSAGE-INTEGRITY and MESSAGE-INTEGRITY2 1374 attributes, computed using the username and password utilized to 1375 authenticate the request. The REALM, NONCE, and USERNAME attributes 1376 SHOULD NOT be included. 1378 9.2.4. Receiving a Response 1380 If the response is an error response with an error code of 401 1381 (Unauthorized), the client MUST test if the NONCE attribute value 1382 starts with the character string "obMatJos2". If the test succeeds 1383 and no PASSWORD-ALGORITHMS attribute is present, then the client MUST 1384 NOT retry the request with a new transaction. 1386 If the response is an error response with an error code of 401 1387 (Unauthorized), the client SHOULD retry the request with a new 1388 transaction. This request MUST contain a USERNAME, determined by the 1389 client as the appropriate username for the REALM from the error 1390 response. The request MUST contain the REALM, copied from the error 1391 response. The request MUST contain the NONCE, copied from the error 1392 response. If the response contains a PASSWORD-ALGORITHMS attribute, 1393 the request MUST contain the PASSWORD-ALGORITHMS attribute with the 1394 same content. If the response contains a PASSWORD-ALGORITHMS 1395 attribute, and this attribute contains at least one algorithm that is 1396 supported by the client then the request MUST contain a PASSWORD- 1397 ALGORITHM attribute with the first algorithm supported on the list. 1398 if the response contains a MESSAGE-INTEGRITY2 attribute then the 1399 request MUST contain a MESSAGE-INTEGRITY2 attribute, computed using 1400 the password associated with the username in the USERNAME attribute. 1401 Else the request MUST contain the MESSAGE-INTEGRITY attribute, 1402 computed using the password associated with the username in the 1403 USERNAME attribute. The client MUST NOT perform this retry if it is 1404 not changing the USERNAME or REALM or its associated password, from 1405 the previous attempt. 1407 If the response is an error response with an error code of 438 (Stale 1408 Nonce), the client MUST retry the request, using the new NONCE 1409 attribute supplied in the 438 (Stale Nonce) response. This retry 1410 MUST also include the USERNAME, REALM and either the MESSAGE- 1411 INTEGRITY or MESSAGE-INTEGRITY2 attributes. 1413 The client looks for the MESSAGE-INTEGRITY or MESSAGE-INTEGRITY2 1414 attribute in the response (either success or failure). If present, 1415 the client computes the message integrity over the response as 1416 defined in Section 14.4 or Section 14.5, using the same password it 1417 utilized for the request. If the resulting value matches the 1418 contents of the MESSAGE-INTEGRITY or MESSAGE-INTEGRITY2 attribute, 1419 the response is considered authenticated. If the value does not 1420 match, or if both MESSAGE-INTEGRITY and MESSAGE-INTEGRITY2 were 1421 absent, the response MUST be discarded, as if it was never received. 1422 This means that retransmits, if applicable, will continue. 1424 10. ALTERNATE-SERVER Mechanism 1426 This section describes a mechanism in STUN that allows a server to 1427 redirect a client to another server. This extension is optional, and 1428 a usage must define if and when this extension is used. 1430 A server using this extension redirects a client to another server by 1431 replying to a request message with an error response message with an 1432 error code of 300 (Try Alternate). The server MUST include an 1433 ALTERNATE-SERVER attribute in the error response. The error response 1434 message MAY be authenticated; however, there are uses cases for 1435 ALTERNATE-SERVER where authentication of the response is not possible 1436 or practical. 1438 A client using this extension handles a 300 (Try Alternate) error 1439 code as follows. The client looks for an ALTERNATE-SERVER attribute 1440 in the error response. If one is found, then the client considers 1441 the current transaction as failed, and reattempts the request with 1442 the server specified in the attribute, using the same transport 1443 protocol used for the previous request. That request, if 1444 authenticated, MUST utilize the same credentials that the client 1445 would have used in the request to the server that performed the 1446 redirection. If the client has been redirected to a server on which 1447 it has already tried this request within the last five minutes, it 1448 MUST ignore the redirection and consider the transaction to have 1449 failed. This prevents infinite ping-ponging between servers in case 1450 of redirection loops. 1452 11. Backwards Compatibility with RFC 3489 1454 In addition to the backward compatibility already described in 1455 Section 12 of [RFC5389], DTLS MUST NOT be used with RFC 3489 STUN 1456 [RFC3489] (also referred to as "classic STUN"). Any STUN request or 1457 indication without the magic cookie (see Section 6 of [RFC5389]) over 1458 DTLS MUST always result in an error. 1460 12. Basic Server Behavior 1462 This section defines the behavior of a basic, stand-alone STUN 1463 server. A basic STUN server provides clients with server reflexive 1464 transport addresses by receiving and replying to STUN Binding 1465 requests. 1467 The STUN server MUST support the Binding method. It SHOULD NOT 1468 utilize the short-term or long-term credential mechanism. This is 1469 because the work involved in authenticating the request is more than 1470 the work in simply processing it. It SHOULD NOT utilize the 1471 ALTERNATE-SERVER mechanism for the same reason. It MUST support UDP 1472 and TCP. It MAY support STUN over TCP/TLS or STUN over UDP/DTLS; 1473 however, DTLS and TLS provide minimal security benefits in this basic 1474 mode of operation. It MAY utilize the FINGERPRINT mechanism but MUST 1475 NOT require it. Since the stand-alone server only runs STUN, 1476 FINGERPRINT provides no benefit. Requiring it would break 1477 compatibility with RFC 3489, and such compatibility is desirable in a 1478 stand-alone server. Stand-alone STUN servers SHOULD support 1479 backwards compatibility with [RFC3489] clients, as described in 1480 Section 11. 1482 It is RECOMMENDED that administrators of STUN servers provide DNS 1483 entries for those servers as described in Section 8. 1485 A basic STUN server is not a solution for NAT traversal by itself. 1486 However, it can be utilized as part of a solution through STUN 1487 usages. This is discussed further in Section 13. 1489 13. STUN Usages 1491 STUN by itself is not a solution to the NAT traversal problem. 1492 Rather, STUN defines a tool that can be used inside a larger 1493 solution. The term "STUN usage" is used for any solution that uses 1494 STUN as a component. 1496 At the time of writing, three STUN usages are defined: Interactive 1497 Connectivity Establishment (ICE) [RFC5245], Client-initiated 1498 connections for SIP [RFC5626], and NAT Behavior Discovery [RFC5780]. 1499 Other STUN usages may be defined in the future. 1501 A STUN usage defines how STUN is actually utilized -- when to send 1502 requests, what to do with the responses, and which optional 1503 procedures defined here (or in an extension to STUN) are to be used. 1504 A usage would also define: 1506 o Which STUN methods are used. 1508 o What transports are used. If DTLS-over-UDP is used then 1509 implementing the denial-of-service countermeasure described in 1510 Section 4.2.1 of [RFC6347] is mandatory. 1512 o What authentication and message-integrity mechanisms are used. 1514 o The considerations around manual vs. automatic key derivation for 1515 the integrity mechanism, as discussed in [RFC4107]. 1517 o What mechanisms are used to distinguish STUN messages from other 1518 messages. When STUN is run over TCP, a framing mechanism may be 1519 required. 1521 o How a STUN client determines the IP address and port of the STUN 1522 server. 1524 o Whether backwards compatibility to RFC 3489 is required. 1526 o What optional attributes defined here (such as FINGERPRINT and 1527 ALTERNATE-SERVER) or in other extensions are required. 1529 In addition, any STUN usage must consider the security implications 1530 of using STUN in that usage. A number of attacks against STUN are 1531 known (see the Security Considerations section in this document), and 1532 any usage must consider how these attacks can be thwarted or 1533 mitigated. 1535 Finally, a usage must consider whether its usage of STUN is an 1536 example of the Unilateral Self-Address Fixing approach to NAT 1537 traversal, and if so, address the questions raised in RFC 3424 1538 [RFC3424]. 1540 14. STUN Attributes 1541 After the STUN header are zero or more attributes. Each attribute 1542 MUST be TLV encoded, with a 16-bit type, 16-bit length, and value. 1543 Each STUN attribute MUST end on a 32-bit boundary. As mentioned 1544 above, all fields in an attribute are transmitted most significant 1545 bit first. 1547 0 1 2 3 1548 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1549 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1550 | Type | Length | 1551 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1552 | Value (variable) .... 1553 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1555 Figure 4: Format of STUN Attributes 1557 The value in the length field MUST contain the length of the Value 1558 part of the attribute, prior to padding, measured in bytes. Since 1559 STUN aligns attributes on 32-bit boundaries, attributes whose content 1560 is not a multiple of 4 bytes are padded with 1, 2, or 3 bytes of 1561 padding so that its value contains a multiple of 4 bytes. The 1562 padding bits are ignored, and may be any value. 1564 Any attribute type MAY appear more than once in a STUN message. 1565 Unless specified otherwise, the order of appearance is significant: 1566 only the first occurrence needs to be processed by a receiver, and 1567 any duplicates MAY be ignored by a receiver. 1569 To allow future revisions of this specification to add new attributes 1570 if needed, the attribute space is divided into two ranges. 1571 Attributes with type values between 0x0000 and 0x7FFF are 1572 comprehension-required attributes, which means that the STUN agent 1573 cannot successfully process the message unless it understands the 1574 attribute. Attributes with type values between 0x8000 and 0xFFFF are 1575 comprehension-optional attributes, which means that those attributes 1576 can be ignored by the STUN agent if it does not understand them. 1578 The set of STUN attribute types is maintained by IANA. The initial 1579 set defined by this specification is found in Section 17.2. 1581 The rest of this section describes the format of the various 1582 attributes defined in this specification. 1584 14.1. MAPPED-ADDRESS 1586 The MAPPED-ADDRESS attribute indicates a reflexive transport address 1587 of the client. It consists of an 8-bit address family and a 16-bit 1588 port, followed by a fixed-length value representing the IP address. 1590 If the address family is IPv4, the address MUST be 32 bits. If the 1591 address family is IPv6, the address MUST be 128 bits. All fields 1592 must be in network byte order. 1594 The format of the MAPPED-ADDRESS attribute is: 1596 0 1 2 3 1597 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1598 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1599 |0 0 0 0 0 0 0 0| Family | Port | 1600 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1601 | | 1602 | Address (32 bits or 128 bits) | 1603 | | 1604 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1606 Figure 5: Format of MAPPED-ADDRESS Attribute 1608 The address family can take on the following values: 1610 0x01:IPv4 1611 0x02:IPv6 1613 The first 8 bits of the MAPPED-ADDRESS MUST be set to 0 and MUST be 1614 ignored by receivers. These bits are present for aligning parameters 1615 on natural 32-bit boundaries. 1617 This attribute is used only by servers for achieving backwards 1618 compatibility with RFC 3489 [RFC3489] clients. 1620 14.2. XOR-MAPPED-ADDRESS 1622 The XOR-MAPPED-ADDRESS attribute is identical to the MAPPED-ADDRESS 1623 attribute, except that the reflexive transport address is obfuscated 1624 through the XOR function. 1626 The format of the XOR-MAPPED-ADDRESS is: 1628 0 1 2 3 1629 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1630 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1631 |x x x x x x x x| Family | X-Port | 1632 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1633 | X-Address (Variable) 1634 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1636 Figure 6: Format of XOR-MAPPED-ADDRESS Attribute 1638 The Family represents the IP address family, and is encoded 1639 identically to the Family in MAPPED-ADDRESS. 1641 X-Port is computed by taking the mapped port in host byte order, 1642 XOR'ing it with the most significant 16 bits of the magic cookie, and 1643 then the converting the result to network byte order. If the IP 1644 address family is IPv4, X-Address is computed by taking the mapped IP 1645 address in host byte order, XOR'ing it with the magic cookie, and 1646 converting the result to network byte order. If the IP address 1647 family is IPv6, X-Address is computed by taking the mapped IP address 1648 in host byte order, XOR'ing it with the concatenation of the magic 1649 cookie and the 96-bit transaction ID, and converting the result to 1650 network byte order. 1652 The rules for encoding and processing the first 8 bits of the 1653 attribute's value, the rules for handling multiple occurrences of the 1654 attribute, and the rules for processing address families are the same 1655 as for MAPPED-ADDRESS. 1657 Note: XOR-MAPPED-ADDRESS and MAPPED-ADDRESS differ only in their 1658 encoding of the transport address. The former encodes the transport 1659 address by exclusive-or'ing it with the magic cookie. The latter 1660 encodes it directly in binary. RFC 3489 originally specified only 1661 MAPPED-ADDRESS. However, deployment experience found that some NATs 1662 rewrite the 32-bit binary payloads containing the NAT's public IP 1663 address, such as STUN's MAPPED-ADDRESS attribute, in the well-meaning 1664 but misguided attempt at providing a generic ALG function. Such 1665 behavior interferes with the operation of STUN and also causes 1666 failure of STUN's message-integrity checking. 1668 14.3. USERNAME 1670 The USERNAME attribute is used for message integrity. It identifies 1671 the username and password combination used in the message-integrity 1672 check. 1674 The value of USERNAME is a variable-length value. It MUST contain a 1675 UTF-8 [RFC3629] encoded sequence of less than 513 bytes, and MUST 1676 have been processed using SASLprep [RFC4013]. 1678 14.4. MESSAGE-INTEGRITY 1680 The MESSAGE-INTEGRITY attribute contains an HMAC-SHA1 [RFC2104] of 1681 the STUN message. The MESSAGE-INTEGRITY attribute can be present in 1682 any STUN message type. Since it uses the SHA1 hash, the HMAC will be 1683 20 bytes. The text used as input to HMAC is the STUN message, 1684 including the header, up to and including the attribute preceding the 1685 MESSAGE-INTEGRITY attribute. With the exception of the MESSAGE- 1686 INTEGRITY2 and FINGERPRINT attributes, which appear after MESSAGE- 1687 INTEGRITY, agents MUST ignore all other attributes that follow 1688 MESSAGE-INTEGRITY. 1690 The key for the HMAC depends on which credential mechanism is in use. 1691 Section 9.1.1 defines the key for the short-term credential mechanism 1692 and Section 9.2.1 defines the key for the long-term credential 1693 mechanism. Other credential mechanisms MUST define the key that is 1694 used for the HMAC. 1696 Based on the rules above, the hash used to construct MESSAGE- 1697 INTEGRITY includes the length field from the STUN message header. 1698 Prior to performing the hash, the MESSAGE-INTEGRITY attribute MUST be 1699 inserted into the message (with dummy content). The length MUST then 1700 be set to point to the length of the message up to, and including, 1701 the MESSAGE-INTEGRITY attribute itself, but excluding any attributes 1702 after it. Once the computation is performed, the value of the 1703 MESSAGE-INTEGRITY attribute can be filled in, and the value of the 1704 length in the STUN header can be set to its correct value -- the 1705 length of the entire message. Similarly, when validating the 1706 MESSAGE-INTEGRITY, the length field should be adjusted to point to 1707 the end of the MESSAGE-INTEGRITY attribute prior to calculating the 1708 HMAC. Such adjustment is necessary when attributes, such as 1709 FINGERPRINT, appear after MESSAGE-INTEGRITY. 1711 14.5. MESSAGE-INTEGRITY2 1713 The MESSAGE-INTEGRITY2 attribute contains an HMAC-SHA-256 [RFC2104] 1714 of the STUN message. The MESSAGE-INTEGRITY2 attribute can be present 1715 in any STUN message type. Since it uses the SHA-256 hash, the HMAC 1716 will be 32 bytes. The text used as input to HMAC is the STUN 1717 message, including the header, up to and including the attribute 1718 preceding the MESSAGE-INTEGRITY2 attribute. With the exception of 1719 the FINGERPRINT attribute, which appears after MESSAGE-INTEGRITY2, 1720 agents MUST ignore all other attributes that follow MESSAGE- 1721 INTEGRITY2. 1723 The key for the HMAC depends on which credential mechanism is in use. 1724 Section 9.1.1 defines the key for the short-term credential mechanism 1725 and Section 9.2.1 defines the key for the long-term credential 1726 mechanism. Other credential mechanism MUST define the key that is 1727 used for the HMAC. 1729 Based on the rules above, the hash used to construct MESSAGE- 1730 INTEGRITY2 includes the length field from the STUN message header. 1731 Prior to performing the hash, the MESSAGE-INTEGRITY2 attribute MUST 1732 be inserted into the message (with dummy content). The length MUST 1733 then be set to point to the length of the message up to, and 1734 including, the MESSAGE-INTEGRITY2 attribute itself, but excluding any 1735 attributes after it. Once the computation is performed, the value of 1736 the MESSAGE-INTEGRITY2 attribute can be filled in, and the value of 1737 the length in the STUN header can be set to its correct value -- the 1738 length of the entire message. Similarly, when validating the 1739 MESSAGE-INTEGRITY2, the length field should be adjusted to point to 1740 the end of the MESSAGE-INTEGRITY2 attribute prior to calculating the 1741 HMAC. Such adjustment is necessary when attributes, such as 1742 FINGERPRINT, appear after MESSAGE-INTEGRITY2. 1744 14.6. FINGERPRINT 1746 The FINGERPRINT attribute MAY be present in all STUN messages. The 1747 value of the attribute is computed as the CRC-32 of the STUN message 1748 up to (but excluding) the FINGERPRINT attribute itself, XOR'ed with 1749 the 32-bit value 0x5354554e (the XOR helps in cases where an 1750 application packet is also using CRC-32 in it). The 32-bit CRC is 1751 the one defined in ITU V.42 [ITU.V42.2002], which has a generator 1752 polynomial of x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1. 1753 When present, the FINGERPRINT attribute MUST be the last attribute in 1754 the message, and thus will appear after MESSAGE-INTEGRITY. 1756 The FINGERPRINT attribute can aid in distinguishing STUN packets from 1757 packets of other protocols. See Section 7. 1759 As with MESSAGE-INTEGRITY, the CRC used in the FINGERPRINT attribute 1760 covers the length field from the STUN message header. Therefore, 1761 this value must be correct and include the CRC attribute as part of 1762 the message length, prior to computation of the CRC. When using the 1763 FINGERPRINT attribute in a message, the attribute is first placed 1764 into the message with a dummy value, then the CRC is computed, and 1765 then the value of the attribute is updated. If the MESSAGE-INTEGRITY 1766 attribute is also present, then it must be present with the correct 1767 message-integrity value before the CRC is computed, since the CRC is 1768 done over the value of the MESSAGE-INTEGRITY attribute as well. 1770 14.7. ERROR-CODE 1772 The ERROR-CODE attribute is used in error response messages. It 1773 contains a numeric error code value in the range of 300 to 699 plus a 1774 textual reason phrase encoded in UTF-8 [RFC3629], and is consistent 1775 in its code assignments and semantics with SIP [RFC3261] and HTTP 1776 [RFC2616]. The reason phrase is meant for user consumption, and can 1777 be anything appropriate for the error code. Recommended reason 1778 phrases for the defined error codes are included in the IANA registry 1779 for error codes. The reason phrase MUST be a UTF-8 [RFC3629] encoded 1780 sequence of less than 128 characters (which can be as long as 763 1781 bytes). 1783 0 1 2 3 1784 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1785 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1786 | Reserved, should be 0 |Class| Number | 1787 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1788 | Reason Phrase (variable) .. 1789 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1791 Figure 7: ERROR-CODE Attribute 1793 To facilitate processing, the class of the error code (the hundreds 1794 digit) is encoded separately from the rest of the code, as shown in 1795 Figure 7. 1797 The Reserved bits SHOULD be 0, and are for alignment on 32-bit 1798 boundaries. Receivers MUST ignore these bits. The Class represents 1799 the hundreds digit of the error code. The value MUST be between 3 1800 and 6. The Number represents the error code modulo 100, and its 1801 value MUST be between 0 and 99. 1803 The following error codes, along with their recommended reason 1804 phrases, are defined: 1806 300 Try Alternate: The client should contact an alternate server for 1807 this request. This error response MUST only be sent if the 1808 request included a USERNAME attribute and a valid MESSAGE- 1809 INTEGRITY attribute; otherwise, it MUST NOT be sent and error 1810 code 400 (Bad Request) is suggested. This error response MUST 1811 be protected with the MESSAGE-INTEGRITY attribute, and receivers 1812 MUST validate the MESSAGE-INTEGRITY of this response before 1813 redirecting themselves to an alternate server. 1815 Note: Failure to generate and validate message integrity for 1816 a 300 response allows an on-path attacker to falsify a 300 1817 response thus causing subsequent STUN messages to be sent to 1818 a victim. 1820 400 Bad Request: The request was malformed. The client SHOULD NOT 1821 retry the request without modification from the previous 1822 attempt. The server may not be able to generate a valid 1823 MESSAGE-INTEGRITY for this error, so the client MUST NOT expect 1824 a valid MESSAGE-INTEGRITY attribute on this response. 1826 401 Unauthorized: The request did not contain the correct 1827 credentials to proceed. The client should retry the request 1828 with proper credentials. 1830 420 Unknown Attribute: The server received a STUN packet containing 1831 a comprehension-required attribute that it did not understand. 1832 The server MUST put this unknown attribute in the UNKNOWN- 1833 ATTRIBUTE attribute of its error response. 1835 438 Stale Nonce: The NONCE used by the client was no longer valid. 1836 The client should retry, using the NONCE provided in the 1837 response. 1839 500 Server Error: The server has suffered a temporary error. The 1840 client should try again. 1842 14.8. REALM 1844 The REALM attribute may be present in requests and responses. It 1845 contains text that meets the grammar for "realm-value" as described 1846 in RFC 3261 [RFC3261] but without the double quotes and their 1847 surrounding whitespace. That is, it is an unquoted realm-value (and 1848 is therefore a sequence of qdtext or quoted-pair). It MUST be a 1849 UTF-8 [RFC3629] encoded sequence of less than 128 characters (which 1850 can be as long as 763 bytes), and MUST have been processed using 1851 SASLprep [RFC4013]. 1853 Presence of the REALM attribute in a request indicates that long-term 1854 credentials are being used for authentication. Presence in certain 1855 error responses indicates that the server wishes the client to use a 1856 long-term credential for authentication. 1858 14.9. NONCE 1860 The NONCE attribute may be present in requests and responses. It 1861 contains a sequence of qdtext or quoted-pair, which are defined in 1862 RFC 3261 [RFC3261]. Note that this means that the NONCE attribute 1863 will not contain actual quote characters. See RFC 2617 [RFC2617], 1864 Section 4.3, for guidance on selection of nonce values in a server. 1865 It MUST be less than 128 characters (which can be as long as 763 1866 bytes). 1868 14.10. PASSWORD-ALGORITHMS 1870 The PASSWORD-ALGORITHMS attribute is present only in responses. It 1871 contains the list of algorithms that the server can use to derive the 1872 long-term password. 1874 The set of known algorithms is maintained by IANA. The initial set 1875 defined by this specification is found in Section 17.4. 1877 The attribute contains a list of algorithm numbers and variable 1878 length parameters. The algorithm number is a 16-bit value as defined 1879 in Section 17.4. The parameters start with the actual length of the 1880 parameters as a 16-bit value, followed by the parameters that are 1881 specific to each algorithm. The parameters are padded to a 32-bit 1882 boundary, in the same manner as an attribute. 1884 0 1 2 3 1885 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1886 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1887 | Algorithm 1 | Algorithm 1 Parameters Length | 1888 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1889 | Algorithm 1 Parameters (variable) 1890 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1891 | Algorithm 2 | Algorithm 2 Parameters Length | 1892 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1893 | Algorithm 2 Parameter (variable) 1894 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1895 | ... 1897 Figure 8: Format of PASSWORD-ALGORITHMS Attribute 1899 14.11. PASSWORD-ALGORITHM 1901 The PASSWORD-ALGORITHM attribute is present only in requests. It 1902 contains the algorithms that the server must use to derive the long- 1903 term password. 1905 The set of known algorithms is maintained by IANA. The initial set 1906 defined by this specification is found in Section 17.4. 1908 The attribute contains an algorithm number and variable length 1909 parameters. The algorithm number is a 16-bit value as defined in 1910 Section 17.4. The parameters starts with the actual length of the 1911 parameters as a 16-bit value, followed by the parameters that are 1912 specific to the algorithm. The parameters are padded to a 32-bit 1913 boundary, in the same manner as an attribute. 1915 0 1 2 3 1916 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1917 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1918 | Algorithm | Algorithm Parameters Length | 1919 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1920 | Algorithm Parameters (variable) 1921 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1923 Figure 9: Format of PASSWORD-ALGORITHM Attribute 1925 14.12. UNKNOWN-ATTRIBUTES 1927 The UNKNOWN-ATTRIBUTES attribute is present only in an error response 1928 when the response code in the ERROR-CODE attribute is 420. 1930 The attribute contains a list of 16-bit values, each of which 1931 represents an attribute type that was not understood by the server. 1933 0 1 2 3 1934 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1935 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1936 | Attribute 1 Type | Attribute 2 Type | 1937 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1938 | Attribute 3 Type | Attribute 4 Type ... 1939 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1941 Figure 10: Format of UNKNOWN-ATTRIBUTES Attribute 1943 Note: In [RFC3489], this field was padded to 32 by duplicating the 1944 last attribute. In this version of the specification, the normal 1945 padding rules for attributes are used instead. 1947 14.13. SOFTWARE 1949 The SOFTWARE attribute contains a textual description of the software 1950 being used by the agent sending the message. It is used by clients 1951 and servers. Its value SHOULD include manufacturer and version 1952 number. The attribute has no impact on operation of the protocol, 1953 and serves only as a tool for diagnostic and debugging purposes. The 1954 value of SOFTWARE is variable length. It MUST be a UTF-8 [RFC3629] 1955 encoded sequence of less than 128 characters (which can be as long as 1956 763 bytes). 1958 14.14. ALTERNATE-SERVER 1960 The alternate server represents an alternate transport address 1961 identifying a different STUN server that the STUN client should try. 1963 It is encoded in the same way as MAPPED-ADDRESS, and thus refers to a 1964 single server by IP address. The IP address family MUST be identical 1965 to that of the source IP address of the request. 1967 15. Security Considerations 1968 15.1. Attacks against the Protocol 1970 15.1.1. Outside Attacks 1972 An attacker can try to modify STUN messages in transit, in order to 1973 cause a failure in STUN operation. These attacks are detected for 1974 both requests and responses through the message-integrity mechanism, 1975 using either a short-term or long-term credential. Of course, once 1976 detected, the manipulated packets will be dropped, causing the STUN 1977 transaction to effectively fail. This attack is possible only by an 1978 on-path attacker. 1980 An attacker that can observe, but not modify, STUN messages in- 1981 transit (for example, an attacker present on a shared access medium, 1982 such as Wi-Fi), can see a STUN request, and then immediately send a 1983 STUN response, typically an error response, in order to disrupt STUN 1984 processing. This attack is also prevented for messages that utilize 1985 MESSAGE-INTEGRITY. However, some error responses, those related to 1986 authentication in particular, cannot be protected by MESSAGE- 1987 INTEGRITY. When STUN itself is run over a secure transport protocol 1988 (e.g., TLS), these attacks are completely mitigated. 1990 Depending on the STUN usage, these attacks may be of minimal 1991 consequence and thus do not require message integrity to mitigate. 1992 For example, when STUN is used to a basic STUN server to discover a 1993 server reflexive candidate for usage with ICE, authentication and 1994 message integrity are not required since these attacks are detected 1995 during the connectivity check phase. The connectivity checks 1996 themselves, however, require protection for proper operation of ICE 1997 overall. As described in Section 13, STUN usages describe when 1998 authentication and message integrity are needed. 2000 Since STUN uses the HMAC of a shared secret for authentication and 2001 integrity protection, it is subject to offline dictionary attacks. 2002 When authentication is utilized, it SHOULD be with a strong password 2003 that is not readily subject to offline dictionary attacks. 2004 Protection of the channel itself, using TLS, mitigates these attacks. 2005 However, STUN is most often run over UDP and in those cases, strong 2006 passwords are the only way to protect against these attacks. 2008 15.1.2. Inside Attacks 2010 A rogue client may try to launch a DoS attack against a server by 2011 sending it a large number of STUN requests. Fortunately, STUN 2012 requests can be processed statelessly by a server, making such 2013 attacks hard to launch. 2015 A rogue client may use a STUN server as a reflector, sending it 2016 requests with a falsified source IP address and port. In such a 2017 case, the response would be delivered to that source IP and port. 2018 There is no amplification of the number of packets with this attack 2019 (the STUN server sends one packet for each packet sent by the 2020 client), though there is a small increase in the amount of data, 2021 since STUN responses are typically larger than requests. This attack 2022 is mitigated by ingress source address filtering. 2024 Revealing the specific software version of the agent through the 2025 SOFTWARE attribute might allow them to become more vulnerable to 2026 attacks against software that is known to contain security holes. 2027 Implementers SHOULD make usage of the SOFTWARE attribute a 2028 configurable option. 2030 15.2. Attacks Affecting the Usage 2032 This section lists attacks that might be launched against a usage of 2033 STUN. Each STUN usage must consider whether these attacks are 2034 applicable to it, and if so, discuss counter-measures. 2036 Most of the attacks in this section revolve around an attacker 2037 modifying the reflexive address learned by a STUN client through a 2038 Binding request/response transaction. Since the usage of the 2039 reflexive address is a function of the usage, the applicability and 2040 remediation of these attacks are usage-specific. In common 2041 situations, modification of the reflexive address by an on-path 2042 attacker is easy to do. Consider, for example, the common situation 2043 where STUN is run directly over UDP. In this case, an on-path 2044 attacker can modify the source IP address of the Binding request 2045 before it arrives at the STUN server. The STUN server will then 2046 return this IP address in the XOR-MAPPED-ADDRESS attribute to the 2047 client, and send the response back to that (falsified) IP address and 2048 port. If the attacker can also intercept this response, it can 2049 direct it back towards the client. Protecting against this attack by 2050 using a message-integrity check is impossible, since a message- 2051 integrity value cannot cover the source IP address, since the 2052 intervening NAT must be able to modify this value. Instead, one 2053 solution to preventing the attacks listed below is for the client to 2054 verify the reflexive address learned, as is done in ICE [RFC5245]. 2055 Other usages may use other means to prevent these attacks. 2057 15.2.1. Attack I: Distributed DoS (DDoS) against a Target 2059 In this attack, the attacker provides one or more clients with the 2060 same faked reflexive address that points to the intended target. 2061 This will trick the STUN clients into thinking that their reflexive 2062 addresses are equal to that of the target. If the clients hand out 2063 that reflexive address in order to receive traffic on it (for 2064 example, in SIP messages), the traffic will instead be sent to the 2065 target. This attack can provide substantial amplification, 2066 especially when used with clients that are using STUN to enable 2067 multimedia applications. However, it can only be launched against 2068 targets for which packets from the STUN server to the target pass 2069 through the attacker, limiting the cases in which it is possible. 2071 15.2.2. Attack II: Silencing a Client 2073 In this attack, the attacker provides a STUN client with a faked 2074 reflexive address. The reflexive address it provides is a transport 2075 address that routes to nowhere. As a result, the client won't 2076 receive any of the packets it expects to receive when it hands out 2077 the reflexive address. This exploitation is not very interesting for 2078 the attacker. It impacts a single client, which is frequently not 2079 the desired target. Moreover, any attacker that can mount the attack 2080 could also deny service to the client by other means, such as 2081 preventing the client from receiving any response from the STUN 2082 server, or even a DHCP server. As with the attack in Section 15.2.1, 2083 this attack is only possible when the attacker is on path for packets 2084 sent from the STUN server towards this unused IP address. 2086 15.2.3. Attack III: Assuming the Identity of a Client 2088 This attack is similar to attack II. However, the faked reflexive 2089 address points to the attacker itself. This allows the attacker to 2090 receive traffic that was destined for the client. 2092 15.2.4. Attack IV: Eavesdropping 2094 In this attack, the attacker forces the client to use a reflexive 2095 address that routes to itself. It then forwards any packets it 2096 receives to the client. This attack would allow the attacker to 2097 observe all packets sent to the client. However, in order to launch 2098 the attack, the attacker must have already been able to observe 2099 packets from the client to the STUN server. In most cases (such as 2100 when the attack is launched from an access network), this means that 2101 the attacker could already observe packets sent to the client. This 2102 attack is, as a result, only useful for observing traffic by 2103 attackers on the path from the client to the STUN server, but not 2104 generally on the path of packets being routed towards the client. 2106 15.3. Hash Agility Plan 2108 This specification uses HMAC-SHA-1 for computation of the message 2109 integrity. If, at a later time, HMAC-SHA-1 is found to be 2110 compromised, the following is the remedy that will be applied. 2112 We will define a STUN extension that introduces a new message- 2113 integrity attribute, computed using a new hash. Clients would be 2114 required to include both the new and old message-integrity attributes 2115 in their requests or indications. A new server will utilize the new 2116 message-integrity attribute, and an old one, the old. After a 2117 transition period where mixed implementations are in deployment, the 2118 old message-integrity attribute will be deprecated by another 2119 specification, and clients will cease including it in requests. 2121 It is also important to note that the HMAC is done using a key that 2122 is itself computed using an MD5 of the user's password. The choice 2123 of the MD5 hash was made because of the existence of legacy databases 2124 that store passwords in that form. If future work finds that an HMAC 2125 of an MD5 input is not secure, and a different hash is needed, it can 2126 also be changed using this plan. However, this would require 2127 administrators to repopulate their databases. 2129 16. IAB Considerations 2131 The IAB has studied the problem of Unilateral Self-Address Fixing 2132 (UNSAF), which is the general process by which a client attempts to 2133 determine its address in another realm on the other side of a NAT 2134 through a collaborative protocol reflection mechanism (RFC3424 2135 [RFC3424]). STUN can be used to perform this function using a 2136 Binding request/response transaction if one agent is behind a NAT and 2137 the other is on the public side of the NAT. 2139 The IAB has suggested that protocols developed for this purpose 2140 document a specific set of considerations. Because some STUN usages 2141 provide UNSAF functions (such as ICE [RFC5245] ), and others do not 2142 (such as SIP Outbound [RFC5626]), answers to these considerations 2143 need to be addressed by the usages themselves. 2145 17. IANA Considerations 2147 IANA has created three new registries: a "STUN Methods Registry", a 2148 "STUN Attributes Registry", and a "STUN Error Codes Registry". IANA 2149 has also changed the name of the assigned IANA port for STUN from 2150 "nat-stun-port" to "stun". 2152 17.1. STUN Methods Registry 2154 A STUN method is a hex number in the range 0x000 - 0xFFF. The 2155 encoding of STUN method into a STUN message is described in 2156 Section 5. 2158 The initial STUN methods are: 2160 0x000: (Reserved) 2161 0x001: Binding 2162 0x002: (Reserved; was SharedSecret) 2164 STUN methods in the range 0x000 - 0x7FF are assigned by IETF Review 2165 [RFC5226]. STUN methods in the range 0x800 - 0xFFF are assigned by 2166 Designated Expert [RFC5226]. The responsibility of the expert is to 2167 verify that the selected codepoint(s) are not in use and that the 2168 request is not for an abnormally large number of codepoints. 2169 Technical review of the extension itself is outside the scope of the 2170 designated expert responsibility. 2172 17.2. STUN Attribute Registry 2174 A STUN Attribute type is a hex number in the range 0x0000 - 0xFFFF. 2175 STUN attribute types in the range 0x0000 - 0x7FFF are considered 2176 comprehension-required; STUN attribute types in the range 0x8000 - 2177 0xFFFF are considered comprehension-optional. A STUN agent handles 2178 unknown comprehension-required and comprehension-optional attributes 2179 differently. 2181 The initial STUN Attributes types are: 2183 Comprehension-required range (0x0000-0x7FFF): 2184 0x0000: (Reserved) 2185 0x0001: MAPPED-ADDRESS 2186 0x0002: (Reserved; was RESPONSE-ADDRESS) 2187 0x0003: (Reserved; was CHANGE-ADDRESS) 2188 0x0004: (Reserved; was SOURCE-ADDRESS) 2189 0x0005: (Reserved; was CHANGED-ADDRESS) 2190 0x0006: USERNAME 2191 0x0007: (Reserved; was PASSWORD) 2192 0x0008: MESSAGE-INTEGRITY 2193 0x0009: ERROR-CODE 2194 0x000A: UNKNOWN-ATTRIBUTES 2195 0x000B: (Reserved; was REFLECTED-FROM) 2196 0x0014: REALM 2197 0x0015: NONCE 2198 0x0020: XOR-MAPPED-ADDRESS 2199 0xXXXX: PASSWORD-ALGORITHM 2201 Comprehension-optional range (0x8000-0xFFFF) 2202 0x8022: SOFTWARE 2203 0x8023: ALTERNATE-SERVER 2204 0x8028: FINGERPRINT 2205 0xXXXX: PASSSORD-ALGORITHMS 2206 STUN Attribute types in the first half of the comprehension-required 2207 range (0x0000 - 0x3FFF) and in the first half of the comprehension- 2208 optional range (0x8000 - 0xBFFF) are assigned by IETF Review 2209 [RFC5226]. STUN Attribute types in the second half of the 2210 comprehension-required range (0x4000 - 0x7FFF) and in the second half 2211 of the comprehension-optional range (0xC000 - 0xFFFF) are assigned by 2212 Designated Expert [RFC5226]. The responsibility of the expert is to 2213 verify that the selected codepoint(s) are not in use, and that the 2214 request is not for an abnormally large number of codepoints. 2215 Technical review of the extension itself is outside the scope of the 2216 designated expert responsibility. 2218 17.3. STUN Error Code Registry 2220 A STUN error code is a number in the range 0 - 699. STUN error codes 2221 are accompanied by a textual reason phrase in UTF-8 [RFC3629] that is 2222 intended only for human consumption and can be anything appropriate; 2223 this document proposes only suggested values. 2225 STUN error codes are consistent in codepoint assignments and 2226 semantics with SIP [RFC3261] and HTTP [RFC2616]. 2228 The initial values in this registry are given in Section 14.7. 2230 New STUN error codes are assigned based on IETF Review [RFC5226]. 2231 The specification must carefully consider how clients that do not 2232 understand this error code will process it before granting the 2233 request. See the rules in Section 6.3.4. 2235 17.4. Password Algorithm Registry 2237 A Password Algorithm is a hex number in the range 0x0000 - 0xFFFF. 2239 The initial Password Algorithms are: 2241 0x0001: Salted SHA256 2243 Password Algorithms in the first half of the range (0x0000 - 0x7FFF) 2244 are assigned by IETF Review [RFC5226]. Password Algorithms in the 2245 second half of the range (0x8000 - 0xFFFF) are assigned by Designated 2246 Expert [RFC5226]. 2248 17.4.1. Password Algorithms 2250 The initial list of password algorithms is taken from 2251 [I-D.veltri-sip-alt-auth]. 2253 17.4.1.1. Salted SHA256 2255 The key length is 32 bytes and the parameters contains the salt. 2257 key = SHA256(username ":" realm ":" SASLprep(password) ":" salt) 2259 17.5. STUN UDP and TCP Port Numbers 2261 IANA has previously assigned port 3478 for STUN. This port appears 2262 in the IANA registry under the moniker "nat-stun-port". In order to 2263 align the DNS SRV procedures with the registered protocol service, 2264 IANA is requested to change the name of protocol assigned to port 2265 3478 from "nat-stun-port" to "stun", and the textual name from 2266 "Simple Traversal of UDP Through NAT (STUN)" to "Session Traversal 2267 Utilities for NAT", so that the IANA port registry would read: 2269 stun 3478/tcp Session Traversal Utilities for NAT (STUN) port 2270 stun 3478/udp Session Traversal Utilities for NAT (STUN) port 2272 In addition, IANA has assigned port number 5349 for the "stuns" 2273 service, defined over TCP and UDP. The UDP port is not currently 2274 defined; however, it is reserved for future use. 2276 18. Changes since RFC 5389 2278 This specification obsoletes RFC 5389 [RFC5389]. This specification 2279 differs from RFC 5389 in the following ways: 2281 o 2283 19. Contributors 2285 Christian Huitema and Joel Weinberger were original co-authors of RFC 2286 3489. 2288 20. Acknowledgements 2290 The authors of RFC 5389 would like to thank Cedric Aoun, Pete 2291 Cordell, Cullen Jennings, Bob Penfield, Xavier Marjou, Magnus 2292 Westerlund, Miguel Garcia, Bruce Lowekamp, and Chris Sullivan for 2293 their comments, and Baruch Sterman and Alan Hawrylyshen for initial 2294 implementations. Thanks for Leslie Daigle, Allison Mankin, Eric 2295 Rescorla, and Henning Schulzrinne for IESG and IAB input on this 2296 work. 2298 21. References 2300 21.1. Normative References 2302 [I-D.ietf-tsvwg-sctp-dtls-encaps] 2303 Jesup, R., Loreto, S., Stewart, R., and M. Tuexen, "DTLS 2304 Encapsulation of SCTP Packets for RTCWEB", draft-ietf- 2305 tsvwg-sctp-dtls-encaps-00 (work in progress), February 2306 2013. 2308 [I-D.ietf-tsvwg-sctp-prpolicies] 2309 Tuexen, M., Seggelmann, R., Stewart, R., and S. Loreto, 2310 "Additional Policies for the Partial Reliability Extension 2311 of the Stream Control Transmission Protocol", draft-ietf- 2312 tsvwg-sctp-prpolicies-05 (work in progress), November 2313 2014. 2315 [ITU.V42.2002] 2316 International Telecommunications Union, "Error-correcting 2317 Procedures for DCEs Using Asynchronous-to-Synchronous 2318 Conversion", ITU-T Recommendation V.42, 2002. 2320 [RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791, September 2321 1981. 2323 [RFC1122] Braden, R., "Requirements for Internet Hosts - 2324 Communication Layers", STD 3, RFC 1122, October 1989. 2326 [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, 2327 April 1992. 2329 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 2330 Hashing for Message Authentication", RFC 2104, February 2331 1997. 2333 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2334 Requirement Levels", BCP 14, RFC 2119, March 1997. 2336 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 2337 (IPv6) Specification", RFC 2460, December 1998. 2339 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 2340 Leach, P., Luotonen, A., and L. Stewart, "HTTP 2341 Authentication: Basic and Digest Access Authentication", 2342 RFC 2617, June 1999. 2344 [RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for 2345 specifying the location of services (DNS SRV)", RFC 2782, 2346 February 2000. 2348 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 2350 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 2351 10646", STD 63, RFC 3629, November 2003. 2353 [RFC3758] Stewart, R., Ramalho, M., Xie, Q., Tuexen, M., and P. 2354 Conrad, "Stream Control Transmission Protocol (SCTP) 2355 Partial Reliability Extension", RFC 3758, May 2004. 2357 [RFC4013] Zeilenga, K., "SASLprep: Stringprep Profile for User Names 2358 and Passwords", RFC 4013, February 2005. 2360 [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. 2361 Rose, "DNS Security Introduction and Requirements", RFC 2362 4033, March 2005. 2364 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 2365 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 2367 [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, 2368 "Computing TCP's Retransmission Timer", RFC 6298, June 2369 2011. 2371 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 2372 Security Version 1.2", RFC 6347, January 2012. 2374 [RFC6698] Hoffman, P. and J. Schlyter, "The DNS-Based Authentication 2375 of Named Entities (DANE) Transport Layer Security (TLS) 2376 Protocol: TLSA", RFC 6698, August 2012. 2378 [RFC6951] Tuexen, M. and R. Stewart, "UDP Encapsulation of Stream 2379 Control Transmission Protocol (SCTP) Packets for End-Host 2380 to End-Host Communication", RFC 6951, May 2013. 2382 [RFC7064] Nandakumar, S., Salgueiro, G., Jones, P., and M. Petit- 2383 Huguenin, "URI Scheme for the Session Traversal Utilities 2384 for NAT (STUN) Protocol", RFC 7064, November 2013. 2386 [RFC7350] Petit-Huguenin, M. and G. Salgueiro, "Datagram Transport 2387 Layer Security (DTLS) as Transport for Session Traversal 2388 Utilities for NAT (STUN)", RFC 7350, August 2014. 2390 21.2. Informational References 2392 [I-D.veltri-sip-alt-auth] 2393 Veltri, L., Salsano, S., and A. Polidoro, "HTTP digest 2394 authentication using alternate password storage schemes", 2395 draft-veltri-sip-alt-auth-00 (work in progress), April 2396 2008. 2398 [KARN87] Karn, P. and C. Partridge, "Improving Round-Trip Time 2399 Estimates in Reliable Transport Protocols", SIGCOMM 1987, 2400 August 1987. 2402 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 2403 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 2404 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 2406 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 2407 A., Peterson, J., Sparks, R., Handley, M., and E. 2408 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 2409 June 2002. 2411 [RFC3424] Daigle, L. and IAB, "IAB Considerations for UNilateral 2412 Self-Address Fixing (UNSAF) Across Network Address 2413 Translation", RFC 3424, November 2002. 2415 [RFC3489] Rosenberg, J., Weinberger, J., Huitema, C., and R. Mahy, 2416 "STUN - Simple Traversal of User Datagram Protocol (UDP) 2417 Through Network Address Translators (NATs)", RFC 3489, 2418 March 2003. 2420 [RFC4107] Bellovin, S. and R. Housley, "Guidelines for Cryptographic 2421 Key Management", BCP 107, RFC 4107, June 2005. 2423 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 2424 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 2425 May 2008. 2427 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 2428 (ICE): A Protocol for Network Address Translator (NAT) 2429 Traversal for Offer/Answer Protocols", RFC 5245, April 2430 2010. 2432 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 2433 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 2434 October 2008. 2436 [RFC5626] Jennings, C., Mahy, R., and F. Audet, "Managing Client- 2437 Initiated Connections in the Session Initiation Protocol 2438 (SIP)", RFC 5626, October 2009. 2440 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 2441 Relays around NAT (TURN): Relay Extensions to Session 2442 Traversal Utilities for NAT (STUN)", RFC 5766, April 2010. 2444 [RFC5780] MacDonald, D. and B. Lowekamp, "NAT Behavior Discovery 2445 Using Session Traversal Utilities for NAT (STUN)", RFC 2446 5780, May 2010. 2448 [RFC6544] Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach, 2449 "TCP Candidates with Interactive Connectivity 2450 Establishment (ICE)", RFC 6544, March 2012. 2452 Appendix A. C Snippet to Determine STUN Message Types 2454 Given a 16-bit STUN message type value in host byte order in msg_type 2455 parameter, below are C macros to determine the STUN message types: 2457 #define IS_REQUEST(msg_type) (((msg_type) & 0x0110) == 0x0000) 2458 #define IS_INDICATION(msg_type) (((msg_type) & 0x0110) == 0x0010) 2459 #define IS_SUCCESS_RESP(msg_type) (((msg_type) & 0x0110) == 0x0100) 2460 #define IS_ERR_RESP(msg_type) (((msg_type) & 0x0110) == 0x0110) 2462 A function to convert method and class into a message type: 2464 int type(int method, int cls) { 2465 return (method & 0x0F80) << 9 | (method & 0x0070) << 5 2466 | (method & 0x000F) | (cls & 0x0002) << 8 2467 | (cls & 0x0001) << 4; 2468 } 2470 A function to extract the method from the message type: 2472 int method(int type) { 2473 return (type & 0x3E00) >> 2 | (type & 0x00E0) >> 1 2474 | (type & 0x000F); 2475 } 2477 A function to extract the class from the message type: 2479 int cls(int type) { 2480 return (type & 0x0100) >> 7 | (type & 0x0010) >> 4; 2481 } 2483 Appendix B. Release notes 2485 This section must be removed before publication as an RFC. 2487 B.1. Open Issues 2489 1. Clean the IANA section. 2491 2. Fix bug on retransmission RTO in section 7.2. 2493 3. Integrate RFC 5769 (stun vectors) as examples 2495 4. Clarify whether it's valid to share nonces across TURN 2496 allocations. 2498 5. Clarify nonce behavior for both invalid and expired nonces. 2499 Right now only expired nonces are described. Define a new 2500 "invalid nonce" error code (presumably 438) 2502 6. This question was raised: If a STUN (TURN) client receives a "300 2503 Try Alternate" response to a STUN request sent over TLS, it 2504 should then connect to a different STUN server over TLS. What 2505 subjectAltName should it expect in the redirected-to server's 2506 certificate? 2508 7. Normatively reference the new ORIGIN RFC 2510 B.2. Modifications between draft-ietf-tram-stunbis-01 and draft-ietf- 2511 tram-stunbis-00 2513 o Add negotiation mechanism for new password algorithms. 2515 o Describe the MESSAGE-INTEGRITY/MESSAGE-INTEGRITY2 protocol. 2517 o Add support for SCTP to solve the fragmentation problem. 2519 o Merge RFC 7350: 2521 * Split the "Sending over..." sections in 3. 2523 * Add DTLS-over-UDP as transport. 2525 * Update the cipher suites and cipher/compression restrictions. 2527 * A stuns uri with an IP address is rejected. 2529 * Replace most of the RFC 3489 compatibility by a reference to 2530 the section in RFC 5389. 2532 * Update the STUN Usages list with transport applicability. 2534 o Merge RFC 7064: 2536 * DNS discovery is done from the URI. 2538 * Reorganized the text about default ports. 2540 o Add more C snippets. 2542 o Make clear that the cached RTO is discarded only if there is no 2543 new transations for 10 minutes. 2545 B.3. Modifications between draft-salgueiro-tram-stunbis-02 and draft- 2546 ietf-tram-stunbis-00 2548 o Draft adopted as WG item. 2550 B.4. Modifications between draft-salgueiro-tram-stunbis-02 and draft- 2551 salgueiro-tram-stunbis-01 2553 o Add definition of MESSAGE-INTEGRITY2. 2555 o Update text and reference from RFC 2988 to RFC 6298. 2557 o s/The IAB has mandated/The IAB has suggested/ (Errata #3737). 2559 o Fix the figure for the UNKNOWN-ATTRIBUTES (Errata #2972). 2561 o Fix section number and make clear that the original domain name is 2562 used for the server certificate verification. This is consistent 2563 with what RFC 5922 (section 4) is doing. (Errata #2010) 2565 o Remove text transitioning from RFC 3489. 2567 o Add definition of MESSAGE-INTEGRITY2. 2569 o Update text and reference from RFC 2988 to RFC 6298. 2571 o s/The IAB has mandated/The IAB has suggested/ (Errata #3737). 2573 o Fix the figure for the UNKNOWN-ATTRIBUTES (Errata #2972). 2575 o Fix section number and make clear that the original domain name is 2576 used for the server certificate verification. This is consistent 2577 with what RFC 5922 (section 4) is doing. (Errata #2010) 2579 B.5. Modifications between draft-salgueiro-tram-stunbis-01 and draft- 2580 salgueiro-tram-stunbis-00 2582 o Restore the RFC 5389 text. 2584 o Add list of open issues. 2586 Authors' Addresses 2588 Marc Petit-Huguenin 2589 Impedance Mismatch 2591 Email: marc@petit-huguenin.org 2593 Gonzalo Salgueiro 2594 Cisco 2595 7200-12 Kit Creek Road 2596 Research Triangle Park, NC 27709 2597 US 2599 Email: gsalguei@cisco.com 2601 Jonathan Rosenberg 2602 Cisco 2603 Edison, NJ 2604 US 2606 Email: jdrosen@cisco.com 2607 URI: http://www.jdrosen.net 2609 Dan Wing 2610 Cisco 2611 771 Alder Drive 2612 San Jose, CA 95035 2613 US 2615 Email: dwing@cisco.com 2616 Rohan Mahy 2617 Plantronics 2618 345 Encinal Street 2619 Santa Cruz, CA 95060 2620 US 2622 Email: rohan@ekabal.com 2624 Philip Matthews 2625 Avaya 2626 1135 Innovation Drive 2627 Ottawa, Ontario K2K 3G7 2628 Canada 2630 Phone: +1 613 592 4343 x224 2631 Email: philip_matthews@magma.ca