RTCWEB M. Perumal Internet-Draft Ericsson Intended status: Standards Track D. Wing Expires:March 19,April 30, 2015 R. Ravindranath T. Reddy Cisco Systems M. Thomson MozillaSeptember 15,October 27, 2014 STUN Usage for Consent Freshnessdraft-ietf-rtcweb-stun-consent-freshness-07draft-ietf-rtcweb-stun-consent-freshness-08 Abstract To prevent sending excessive traffic to an endpoint, periodic consent needs to be obtained from that remote endpoint. This document describes a consent mechanism using a new Session Traversal Utilities for NAT (STUN) usage.This same mechanism can also determine connection loss ("liveness") with a remote peer.Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire onMarch 19,April 30, 2015. Copyright Notice Copyright (c) 2014 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 3. Design Considerations . . . . . . . . . . . . . . . . . . . . 3 4. Solution . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4.1. Expiration of Consent . . . . . . . . . . . . . . . . . .43 4.2. Immediate Revocation of Consent . . . . . . . . . . . . . 5 5.Connection LivenessDiffServ Treatment for Consent . . . . . . . . . . . . . . . 5 6. DTLS applicability . . . . . . . . . .5 6. DiffServ Treatment for Consent packets. . . . . . . . . . . 6 7.W3CAPIImplicationsRecommendations . . . . . . . . . . . . . . . . . . . . . 6 8. Security Considerations . . . . . . . . . . . . . . . . . . . 6 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . .76 10. Acknowledgement . . . . . . . . . . . . . . . . . . . . . . .76 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 11.1. Normative References . . . . . . . . . . . . . . . . . . 7 11.2. Informative References . . . . . . . . . . . . . . . . . 7 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 8 1. Introduction To prevent attacks on peers,RTPendpoints have to ensure the remote peerwantsis willing to receive traffic. This is performed both when the session is first established to the remote peer using Interactive Connectivity Establishment ICE [RFC5245] connectivity checks, and periodically for the duration of the session using the procedures defined in this document. When a session is first established, ICE implementations obtain an initial consent to send by performing STUN connectivitychecks as part of ICE. That initial consent is not described further in this document and it is assumed that ICE is being used for that initial consent. Related to consent is loss of connectivity ("liveness"). Many applications want notification of connection loss to take appropriate actions (e.g., alert the user, try switching to a different interface).checks. This document describes a new STUN usage with exchange of request and response messagesto verifythat verifies the remote peer's ongoing consent to receivetraffic, and the absence of which fortraffic. This consent expires after a period of timeindicates a loss of liveness. When a (full)and needs to be continually renewed, which ensures that consent can be terminated. This applies to full ICEimplementation interworks with an ICE-lite implementation theimplementations. An ICE-lite implementation will not generate consent checks, but will justjustrespond to consent checks it receives. ICE-lite implementation do not require any changes to respond to consent checks. 2. Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. Consent:It is theThe mechanism of obtaining permission to sendtrafficto acertainremote transport address.This is the initialInitial consentto send traffic, whichis obtainedbyusing ICE or a TCP handshake. Consent Freshness:Permission to continue sending traffic to a certain transport address. This is performed by the procedure described in this document. Session Liveness: Detecting loss of connectivity to a certain transport address. This is performed by the procedure described in this document.Maintaining and renewing consent over time. Transport Address: The remote peer's IP address and(UDPUDP orTCP)TCP port number. 3. Design Considerations Although ICE requires periodic keepalive traffic to keep NAT bindings alive (Section 10 of [RFC5245], [RFC6263]), those keepalives are sent as STUN Indications which are send-and-forget, and do not evoke a response. A response is necessarybothfor consent to continue sendingtraffic, as well as to verify session liveness.traffic. Thus, we need a request/response mechanism for consent freshness. ICE can be used for that mechanism because ICE implementations are already required to continue listening for ICE messages, as described in section 10 of [RFC5245]. 4. Solution There are two ways consent to send traffic is revoked: expiration of consent and immediate revocation of consent, which are discussed in the following sections. 4.1. Expiration of Consent A WebRTC implementation [I-D.ietf-rtcweb-overview], which implements full ICE,MUST perform a combinedperforms consent freshnessand session livenesstest using STUN request/response as described below: An endpoint MUST NOT sendapplication data (e.g., RTP, RTCP, SCTP, DTLS), overpaced STUN connectivity checks toward any transportprotocol (e.g., UDP, TCP) on an ICE- initiated connectionaddress unless the receiving endpoint consents to receivethedata. That is, no application data (e.g., RTP or DTLS) can be sent until consent is obtained. After a successful ICE connectivity check on a particular transport address,subsequentconsent MUST be obtained following the procedure described in this document.The consent expires after a fixed amount of time. During ICE restartExplicit consentchecks MUST continuetobe sent on previously validated pair, and MUST be respondedsend is obtained by sending an STUN binding request toonthepreviously validated pair, untilremote peer's transport address and receiving a matching, authenticated, non-error STUN binding response from the remote peer's transport address. These STUN binding requests and responses are authenticated using the same short-term credentials as the initial ICErestart completes.exchange. Note: Although TCP has its own consent mechanism (TCP acknowledgements), consent is necessary over a TCP connection because it could be translated to a UDP connection (e.g., [RFC6062]).ExplicitInitial consentto sendisobtained by sendinggranted as a result of a successful ICE connectivity check on a particular transport address, and expires 30 seconds after an ICEbinding request tocandidate par has been selected. Once an ICE candidate pair has been selected, consent for theremote peer's Transport Address and receiving a matching, authenticated, non-errorICE candidate pairs lasts for 30 seconds. That is, if a valid STUN binding response corresponding to any STUN request sent in the last 30 seconds has not been received from the remote peer'sTransport Address. These ICE binding requests and responses are authenticated using the same short-term credentials astransport address, theinitial ICE exchange. Implementationsendpoint MUST ceasesending data if theirtransmission on that 5-tuple. STUN consent responses received after consentexpires.expiry do not re-establish consent, and may be discarded or cause an ICMP error. To prevent expiry of consent, a STUN binding requestMUSTcan be sentevery N milliseconds, where N is chosen randomly with eachperiodically. To prevent synchronization of consentcheck in thechecks, each interval[.8N, 1.2N] (to prevent network synchronization), where N SHOULDMUST be5000. Using the value 5000 millisecondsrandomized from between 0.8 andthat 20% randomization range, N would be1.2 times the basic period. Implementations SHOULD set a default interval of 5 seconds, resulting in avalueperiod between4000 and 6000. These STUN binding requests for consent are not re-transmitted.checks of 4 to 6 seconds. Each STUN binding request for consentre- calculates a new random value N andMUST use a new cryptographically-random [RFC4086] STUN transaction ID.The initial Consent to send traffic is obtained by ICE. Consent expires after 30 seconds. That is, if a validEach STUN binding requests for consent is transmitted once only. Hence, the sender cannot assume that it will receive a responsecorresponding tofor each consent request, and a response might be for a previous request (rather than for the most recently sent request). Consent expiration causes immediate termination of all outstanding STUN consent transactions. Each STUN transaction is maintained until one of the following criteria is fulfilled: o A STUNrequests sent in the last 30 seconds has not been received from the remote peer's Transport Address,response associated with theendpoint MUST cease transmission on that 5-tuple.transaction is received; or o A STUN response associated to a newer transaction is received. To meet the security needs of consent, an untrusted application (e.g.,JavaScript)JavaScript or signaling servers) MUST NOT be able to obtain or control the STUN transaction ID, because that enables spoofing of STUN responses, falsifying consent. To prevent attacks on the peer during ICE restart, an endpoint that continues to send traffic on the previously validated candidate pair during ICE restart MUST continue to perform consent freshness on that candidate pair as described earlier. While TCP affords some protection from off-path attackers ([RFC5961], [RFC4953]), there is still a risk an attacker could cause a TCP sender to sendpacketsforever by spoofing ACKs. To prevent such an attack, consent checks MUST be performed over all transport connections, including TCP. In this way, an off-path attacker spoofing TCP segments can not cause a TCP sender to sendpackets longer thanonce the consent timer expires (30 seconds). An endpoint that is not sending any applicationtrafficdata does not need toobtain consent which can slightly conserve its resources.maintain consent. However, the endpoint needs to ensure its NAT or firewall mappings persist which can be done using keepalive or other techniques (see Section 10 of [RFC5245] and see [RFC6263]). If the endpoint wants to send applicationtraffic,data, it needs to first obtain consent if its consent has expired. 4.2. Immediate Revocation of ConsentThe previous section explained how consent expires due to a timeout.In some cases it is useful to signala connectionthat consent isterminated,terminated rather than relying on a timeout.This is done by immediately revoking consent.Consent for sendingtraffic on the media orapplication datachannelis immediately revoked by receipt of an authenticated message that closes the connection (e.g., a TLS fatal alert) or receipt of a valid and authenticated STUN response with error code Forbidden (403).ThoseNote however that consent revocation messages can be lost on the network, so animplementation wanting to immediately revokeendpoint could resend these messages, or wait for consentneedstoremember those credentials until consent expiry (30 seconds).expire. Receipt of an unauthenticated message that closes a connection (e.g., TCP FIN) does not indicate revocation of consent. Thus, an endpoint receiving an unauthenticated end-of-session message SHOULD continue sending media (over connectionless transport) or attempt to re- establish the connection (over connection-oriented transport) until consent expires or it receives an authenticated message revoking consent. Note that an authenticated SRTCP BYE does not terminate consent; it only indicates the associated SRTP source has quit. 5.Connection Liveness A connection is considered "live" if packets are received from a remote endpoint within an application-dependent period. An application can request a notification when there are no packets received for a certain period (configurable). Similarly, if packets haven't been received within a certain period, an application can request a consent check (heartbeat) be generated. These two time intervals might be controlled by the same configuration item. Sending consent checks (heartbeats) at a high rate could allow a malicious application to generate congestion, so applications MUST NOT be able to send heartbeats at an average rate of more than 1 per second. 6.DiffServ Treatment for ConsentpacketsIt is RECOMMENDED that STUN consent checks use the same Diffserv Codepoint markings as the ICE connectivity checks described insectionSection 7.1.2.4 of [RFC5245] for a given 5-tuple. Note: It is possible that different Diffserv Codepoints are used by different media over the same transport address [I-D.ietf-tsvwg-rtcweb-qos]. Such a case is outside the scope of this document. 6. DTLS applicability The DTLS applicability is identical to what is described in Section 4.2 of [RFC7350]. 7.W3CAPIImplications For the consent freshness and liveness test theRecommendations The W3C specificationshouldMAY provideAPIs as described below: 1. Ability forthebrowserfollowing API tonotify the JavaScript thatprovide feedback and control over consent: 1. Generate an event when consentfreshnesshasfailedexpired for a5-tuple and the browser has stopped transmitting on that 5-tuple. 2. Ability for the JavaScript to start and stop liveness test and set the liveness test interval. 3. Ability for the browser to notify the JavaScriptgiven 5-tuple, meaning thata liveness testtransmission of data hasfailed for aceased. This could indicate what application data is affected, such as mediastream.or data channels. 8. Security Considerations This document describes a security mechanism. The security considerations discussed in [RFC5245] should also be taken into account. SRTP is encrypted and authenticated with symmetric keys; that is, both sender and receiver know the keys. With two party sessions, receipt of an authenticated packet from the single remote party is a strong assurance the packet came from that party. However, when a session involves more than two parties, all of whom know each others keys, any of those parties could have sent (or spoofed) the packet. Such shared key distributions are possible with some MIKEY [RFC3830] modes, Security Descriptions [RFC4568], and EKT [I-D.ietf-avtcore-srtp-ekt]. Thus, in such shared keying distributions, receipt of an authenticated SRTP packet is not sufficient to verify consent. 9. IANA Considerations This document does not require any action from IANA. 10. Acknowledgement Thanks to Eric Rescorla, Harald Alvestrand, Bernard Aboba, Magnus Westerland, Cullen Jennings, Christer Holmberg, Simon Perreault, Paul Kyzivat, Emil Ivov,andJonathanLennoxLennox, Inaki Baz Castillo, Rajmohan Banavi and Christian Groves for their valuable inputs and comments. Thanks to Christer Holmberg for doing a through review. 11. References 11.1. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness Requirements for Security", BCP 106, RFC 4086, June 2005. [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols", RFC 5245, April 2010. [RFC6263] Marjou, X. and A. Sollaud, "Application Mechanism for Keeping Alive the NAT Mappings Associated with RTP / RTP Control Protocol (RTCP) Flows", RFC 6263, June 2011. 11.2. Informative References [I-D.ietf-avtcore-srtp-ekt] Mattsson, J., McGrew,D.D., and D. Wing, "Encrypted Key Transport for Secure RTP",draft-ietf-avtcore-srtp-ekt-02draft-ietf-avtcore-srtp-ekt-03 (work in progress),FebruaryOctober 2014. [I-D.ietf-rtcweb-overview] Alvestrand, H., "Overview: Real Time Protocols for Browser-based Applications",draft-ietf-rtcweb-overview-11draft-ietf-rtcweb-overview-12 (work in progress),AugustOctober 2014. [I-D.ietf-tsvwg-rtcweb-qos] Dhesikan, S., Jennings, C., Druta, D., Jones, P., and J. Polk, "DSCP and other packet markings for RTCWeb QoS", draft-ietf-tsvwg-rtcweb-qos-02 (work in progress), June 2014. [RFC3830] Arkko, J., Carrara, E., Lindholm, F., Naslund, M., and K. Norrman, "MIKEY: Multimedia Internet KEYing", RFC 3830, August 2004. [RFC4568] Andreasen, F., Baugher, M., and D. Wing, "Session Description Protocol (SDP) Security Descriptions for Media Streams", RFC 4568, July 2006. [RFC4953] Touch, J., "Defending TCP Against Spoofing Attacks", RFC 4953, July 2007. [RFC5961] Ramaiah, A., Stewart, R., and M. Dalal, "Improving TCP's Robustness to Blind In-Window Attacks", RFC 5961, August 2010. [RFC6062] Perreault, S. and J. Rosenberg, "Traversal Using Relays around NAT (TURN) Extensions for TCP Allocations", RFC 6062, November 2010. [RFC7350] Petit-Huguenin, M. and G. Salgueiro, "Datagram Transport Layer Security (DTLS) as Transport for Session Traversal Utilities for NAT (STUN)", RFC 7350, August 2014. Authors' Addresses Muthu Arul Mozhi Perumal Ericsson Ferns Icon Doddanekundi, Mahadevapura Bangalore, Karnataka 560037 India Email: muthu.arul@gmail.com Dan Wing Cisco Systems 821 Alder Drive Milpitas, California 95035 USA Email: dwing@cisco.com Ram Mohan Ravindranath Cisco Systems Cessna Business Park Sarjapur-Marathahalli Outer Ring Road Bangalore, Karnataka 560103 India Email: rmohanr@cisco.com Tirumaleswar Reddy Cisco Systems Cessna Business Park, Varthur Hobli Sarjapur Marathalli Outer Ring Road Bangalore, Karnataka 560103 India Email: tireddy@cisco.com Martin Thomson Mozilla Suite 300 650 Castro Street Mountain View, California 94041 US Email: martin.thomson@gmail.com