<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc rfcedstyle="yes"?>

<rfc category="info" number="7376" submissionType="IETF" consensus="yes"
     ipr="trust200902">

  <front>
    <title abbrev="STUN Authentication for TURN: Problems">Problems with
    Session Traversal Utilities for NAT (STUN)
    Long&nbhy;Term&nbsp;Authentication for Traversal Using Relays
    around NAT (TURN)</title>

    <author fullname="Tirumaleswar Reddy" initials="T." surname="Reddy">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>Cessna Business Park, Varthur Hobli</street>

          <street>Sarjapur Marathalli Outer Ring Road</street>

          <city>Bangalore</city>

          <region>Karnataka</region>

          <code>560103</code>

          <country>India</country>
        </postal>

        <email>tireddy@cisco.com</email>
      </address>
    </author>

    <author fullname="Ram Mohan Ravindranath" initials="R."
            surname="Ravindranath">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>Cessna Business Park, Varthur Hobli</street>

          <street>Sarjapur Marathalli Outer Ring Road</street>

          <city>Bangalore</city>

          <region>Karnataka</region>

          <code>560103</code>

          <country>India</country>
        </postal>

        <email>rmohanr@cisco.com</email>
      </address>
    </author>

    <author fullname="Muthu Arul Mozhi Perumal" initials="M."
            surname="Perumal">
      <organization>Ericsson</organization>

      <address>
        <postal>
          <street>Ferns Icon</street>

          <street>Doddanekundi, Mahadevapura</street>

          <city>Bangalore</city>

          <region>Karnataka</region>

          <code>560037</code>

          <country>India</country>
        </postal>

        <email>muthu.arul@gmail.com</email>
      </address>
    </author>

    <author fullname="Alper Yegin" initials="A." surname="Yegin">
      <organization>Samsung</organization>

      <address>
        <postal>
          <street></street>

          <city>Istanbul</city>

          <region></region>

          <code></code>

          <country>Turkey</country>
        </postal>

        <email>alper.yegin@yegin.org</email>
      </address>
    </author>

    <date />

    <workgroup>TRAM</workgroup>

    <abstract>
      <t>This document discusses some of the security problems and
      practical problems with the current Session Traversal Utilities
      for NAT (STUN) authentication for Traversal Using Relays around NAT
      (TURN) messages.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction" title="Introduction">
      <t>Traversal Using Relays around NAT (TURN) <xref
      target="RFC5766"></xref> is a protocol that is often used to improve the
      connectivity of Peer-to-Peer (P2P) applications (as defined in
      Section 2.7 of <xref target="RFC5128"></xref>). TURN allows a connection
      to be established when one or both sides are incapable of a direct P2P
      connection. The TURN server is also a building block to support
      interactive, real-time communication using audio, video, collaboration,
      games, etc., between two peer web browsers using the Web Real-Time
      Communication (WebRTC) <xref target="WebRTC-Overview"> </xref>
      framework.</t>

      <t>A TURN server is also used in the following scenarios:</t>

      <t><list style="symbols">
          <t>For privacy, users of WebRTC-based web applications may use a
          TURN server to hide host candidate addresses from the remote
          peer.</t>

          <t>Enterprise networks deploy firewalls that typically block UDP
          traffic. When SIP user agents or WebRTC endpoints are deployed
          behind such firewalls, media cannot be sent over UDP across the
          firewall but must instead be sent using TCP (which causes a
          different user experience). In such cases, a TURN server deployed
          in the DeMilitarized Zone (DMZ) might be used to traverse
          firewalls.</t>

          <t>The use case explained in Section 3.3.5 of <xref
          target="WebRTC-Use-Cases"></xref> ("Simple Video Communication 
          Service, enterprise aspects") refers to deploying a TURN server
          in the DMZ to audit all media sessions from inside an
          Enterprise premises to any external peer.</t>

          <t>A TURN server could also be deployed for RTP Mobility <xref
          target="TURN-Mobility"></xref>, etc.</t>

          <t>A TURN server may be used for IPv4-to-IPv6, IPv6-to-IPv6,
          and IPv6-to-IPv4 relaying <xref target="RFC6156"></xref>.</t>

          <t>Interactive Connectivity Establishment (ICE) <xref
          target="RFC5245"></xref> connectivity checks using server reflexive
          candidates could fail when the endpoint is behind a NAT <xref
          target="RFC3235"></xref> that performs address-dependent mapping as
          described in Section 4.1 of <xref target="RFC4787"></xref>. In such
          cases, a relayed candidate allocated from the TURN server is used
          for media.</t>
        </list></t>

      <t><xref target="RFC5389">Session Traversal Utilities for NAT (STUN)
      </xref> specifies an authentication mechanism called the long-term
      credential mechanism. Section 4 of <xref target="RFC5766">TURN </xref>
      specifies that TURN servers and clients must implement this mechanism;
      Section 4 of <xref target="RFC5766">TURN</xref> also specifies that
      the TURN server must demand that all requests from the client be
      authenticated using this mechanism or that an equally strong or
      stronger mechanism for client authentication be used.</t>

      <t>In the above scenarios, applications would use the ICE protocol for
      gathering candidates. An ICE agent can use TURN to learn server reflexive
      and relayed candidates. If the TURN server requires that the TURN
      request be authenticated, then the ICE agent will use the long-term
      credential mechanism explained in Section 10
      of <xref target="RFC5389"></xref> for authentication and message
      integrity. Section 10 of the TURN specification <xref
      target="RFC5766"></xref> explains the importance of the
      long-term credential mechanism to mitigate various attacks. Client
      authentication is essential to prevent unauthorized users from
      accessing the TURN server, and misuse of credentials could impose
      significant cost on the victim TURN server.</t>

      <t>This document focuses on listing security problems and practical
      problems with current STUN authentication for TURN so that it can
      serve as the basis for stronger authentication mechanisms.
      </t>

      <t>An Allocate request is more likely than a Binding request to be
      identified by a server administrator as needing client authentication
      and integrity protection of messages exchanged. Hence, the issues
      discussed here regarding STUN authentication are applicable mainly in
      the context of TURN messages.</t>
    </section>

    <section anchor="notation" title="Notational Conventions">
      <t>This document uses terminology defined in <xref
      target="RFC5389"></xref> and <xref target="RFC5766"></xref>.</t>
    </section>

    <section title="Scope">
      <t>This document can be used as input for designing solution(s) to
      address problems with the current STUN authentication for TURN
      messages.</t>
    </section>

    <section anchor="TURN_Auth"
             title="Problems with STUN Long-Term Authentication for TURN">

      <t><list style="numbers">
          <t>As described in <xref target="RFC5389"></xref>,
          the long-term credential mechanism could provide to users a
          long-term credential in the form of a traditional "log-in"
          username and password; this credential would not change for
          extended periods of time. The key derived from the user
          credentials would be used to provide message integrity for every
          TURN request/response. However, an attacker that is
          capable of eavesdropping on a message exchange between a client
          and server can determine the password by trying a number of
          candidate passwords and checking to see if one of them is correct by
          calculating the message integrity using these candidate passwords
          and comparing them with the message integrity value in the
          MESSAGE-INTEGRITY attribute.</t>

          <t>When a TURN server is deployed in the DMZ and requires that
          requests be authenticated using the long-term credential mechanism
          as described in <xref target="RFC5389"></xref>, the TURN server
          needs to be aware of the username and password
          to validate the message integrity of the requests and
          to provide message integrity for responses. This
          results in management overhead on the TURN server. Long-term
          credentials (username, realm, and password) need to be stored on the
          server side, using an MD5 hash over the credentials, which is not
          considered best current practice. <xref target="RFC6151"></xref>
          discusses security vulnerabilities of MD5 and encourages
          implementers not to use it. It is not possible to use STUN
          long-term credentials in implementations that are compliant
          with US FIPS 140-2 <xref target="FIPS-140-2"></xref>, since
          MD5 isn't an approved algorithm.</t>

          <t>The long-term credential mechanism discussed in <xref
          target="RFC5389"></xref> specifies that the TURN client must include
          a username value in the USERNAME STUN attribute. An adversary
          snooping the TURN messages between the TURN client and
          server can identify
          the users involved in the call, resulting in privacy leakage. If TURN
          usernames are linked to real usernames, then privacy leakage will
          result, but in certain scenarios TURN usernames need not be
          linked to any real usernames given to users, as the usernames are
          just provisioned on a per-company basis.</t>

          <t>STUN authentication relies on HMAC-SHA1 <xref
          target="RFC2104"></xref>. There is no mechanism for hash agility in
          the protocol itself, although Section 16.3 of <xref
          target="RFC5389"></xref> does discuss a plan for migrating to a more
          secure algorithm in case HMAC-SHA1 is found to be compromised.</t>

          <t>A man-in-the middle attacker posing as a TURN server challenges
          the client to authenticate, learns the USERNAME of the client, and
          later snoops the traffic from the client, thereby identifying
          user activity; this results in privacy leakage.</t>

          <t>Hosting multiple realms on a single IP address is challenging
          with TURN. When a TURN server needs to send the REALM attribute in
          response to an unauthenticated request, it has no useful information
          for determining which realm it should send in the response, except
          the source transport address of the TURN request. Note that this is a
          problem with multi-tenant scenarios only; this may not be a problem
          when the TURN server is located in enterprise premises.</t>

          <t>In WebRTC, the JavaScript code needs to know the username and
          password to use in the W3C RTCPeerConnection API to access the TURN
          server. This exposes user credentials to the JavaScript code,
          which could be malicious; the malicious JavaScript code could then
          misuse or leak the credentials. If the credentials happen to be
          used for accessing services other than TURN, then the security
          implications are much larger.</t>
        </list></t>
    </section>

    <section anchor="security" title="Security Considerations">
      <t>This document lists problems with current STUN authentication
      for TURN so that it can serve as the basis for stronger authentication
      mechanisms.</t>
    </section>

  </middle>

  <back>
    <references title="Normative References">
<reference anchor='RFC5766' target='http://www.rfc-editor.org/info/rfc5766'>
<front>
<title>Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)</title>
<author initials='R.' surname='Mahy' fullname='R. Mahy'>
<organization /></author>
<author initials='P.' surname='Matthews' fullname='P. Matthews'>
<organization /></author>
<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
<organization /></author>
<date year='2010' month='April' />
</front>
<seriesInfo name='RFC' value='5766' />
</reference>

<reference anchor='RFC5389' target='http://www.rfc-editor.org/info/rfc5389'>
<front>
<title>Session Traversal Utilities for NAT (STUN)</title>
<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
<organization /></author>
<author initials='R.' surname='Mahy' fullname='R. Mahy'>
<organization /></author>
<author initials='P.' surname='Matthews' fullname='P. Matthews'>
<organization /></author>
<author initials='D.' surname='Wing' fullname='D. Wing'>
<organization /></author>
<date year='2008' month='October' />
</front>
<seriesInfo name='RFC' value='5389' />
</reference>

<reference anchor='RFC6156' target='http://www.rfc-editor.org/info/rfc6156'>
<front>
<title>Traversal Using Relays around NAT (TURN) Extension for IPv6</title>
<author initials='G.' surname='Camarillo' fullname='G. Camarillo'>
<organization /></author>
<author initials='O.' surname='Novo' fullname='O. Novo'>
<organization /></author>
<author initials='S.' surname='Perreault' fullname='S. Perreault'>
<organization /></author>
<date year='2011' month='April' />
</front>
<seriesInfo name='RFC' value='6156' />
</reference>

    </references>

    <references title="Informative References">

<reference anchor='RFC5245' target='http://www.rfc-editor.org/info/rfc5245'>
<front>
<title>Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols</title>
<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
<organization /></author>
<date year='2010' month='April' />
</front>
<seriesInfo name='RFC' value='5245' />
</reference>

<reference anchor='RFC5128' target='http://www.rfc-editor.org/info/rfc5128'>
<front>
<title>State of Peer-to-Peer (P2P) Communication across Network Address Translators (NATs)</title>
<author initials='P.' surname='Srisuresh' fullname='P. Srisuresh'>
<organization /></author>
<author initials='B.' surname='Ford' fullname='B. Ford'>
<organization /></author>
<author initials='D.' surname='Kegel' fullname='D. Kegel'>
<organization /></author>
<date year='2008' month='March' />
</front>
<seriesInfo name='RFC' value='5128' />
</reference>

<reference anchor='RFC2104' target='http://www.rfc-editor.org/info/rfc2104'>
<front>
<title abbrev='HMAC'>HMAC: Keyed-Hashing for Message Authentication</title>
<author initials='H.' surname='Krawczyk' fullname='Hugo Krawczyk'>
<organization>IBM, T.J. Watson Research Center</organization>
</author>
<author initials='M.' surname='Bellare' fullname='Mihir Bellare'>
<organization>University of California at San Diego, Dept of Computer Science
and Engineering</organization>
</author>
<author initials='R.' surname='Canetti' fullname='Ran Canetti'>
<organization>IBM T.J. Watson Research Center</organization>
</author>
<date year='1997' month='February' />
</front>
<seriesInfo name='RFC' value='2104' />
</reference>

<!-- draft-ietf-rtcweb-use-cases-and-requirements (Revised I-D Needed) -->
<reference anchor='WebRTC-Use-Cases'>
<front>
<title>Web Real-Time Communication Use-cases and Requirements</title>
<author initials='C' surname='Holmberg' fullname='Christer Holmberg'>
    <organization />
</author>
<author initials='S' surname='Hakansson' fullname='Stefan Hakansson'>
    <organization />
</author>
<author initials='G' surname='Eriksson' fullname='Goran Eriksson'>
    <organization />
</author>
<date month='February' year='2014' />
</front>
<seriesInfo name='Work in Progress,' value='draft-ietf-rtcweb-use-cases-and-requirements-14' />
</reference>

<!-- draft-ietf-rtcweb-overview (I-D Exists) -->
<reference anchor='WebRTC-Overview'>
<front>
<title>Overview: Real Time Protocols for Browser-based Applications</title>
<author initials='H' surname='Alvestrand' fullname='Harald Alvestrand'>
    <organization />
</author>
<date month='August' year='2014' />
</front>
<seriesInfo name='Work in Progress,' value='draft-ietf-rtcweb-overview-11' />
</reference>

<!-- draft-wing-tram-turn-mobility (I-D Exists) -->
<reference anchor='TURN-Mobility'>
<front>
<title>Mobility with TURN</title>
<author initials='D' surname='Wing' fullname='Dan Wing'>
    <organization />
</author>
<author initials='P' surname='Patil' fullname='Prashanth Patil'>
    <organization />
</author>
<author initials='T' surname='Reddy' fullname='Tirumaleswar Reddy'>
    <organization />
</author>
<author initials='P' surname='Martinsen' fullname='Paal-Erik Martinsen'>
    <organization />
</author>
<date month='September' year='2014' />
</front>
<seriesInfo name='Work in Progress,' value='draft-wing-tram-turn-mobility-02' />
</reference>

<reference anchor='RFC3235' target='http://www.rfc-editor.org/info/rfc3235'>
<front>
<title>Network Address Translator (NAT)-Friendly Application Design Guidelines</title>
<author initials='D.' surname='Senie' fullname='D. Senie'>
<organization /></author>
<date year='2002' month='January' />
</front>
<seriesInfo name='RFC' value='3235' />
</reference>

<reference anchor='RFC4787' target='http://www.rfc-editor.org/info/rfc4787'>
<front>
<title>Network Address Translation (NAT) Behavioral Requirements for Unicast UDP</title>
<author initials='F.' surname='Audet' fullname='F. Audet'>
<organization /></author>
<author initials='C.' surname='Jennings' fullname='C. Jennings'>
<organization /></author>
<date year='2007' month='January' />
</front>
<seriesInfo name='BCP' value='127' />
<seriesInfo name='RFC' value='4787' />
</reference>

<reference anchor='RFC6151' target='http://www.rfc-editor.org/info/rfc6151'>
<front>
<title>Updated Security Considerations for the MD5 Message-Digest and the HMAC-MD5 Algorithms</title>
<author initials='S.' surname='Turner' fullname='S. Turner'>
<organization /></author>
<author initials='L.' surname='Chen' fullname='L. Chen'>
<organization /></author>
<date year='2011' month='March' />
</front>
<seriesInfo name='RFC' value='6151' />
</reference>

      <reference anchor="FIPS-140-2"
       target="http://csrc.nist.gov/publications/fips/fips140-2/fips1402.pdf">
        <front>
          <title>Security Requirements for Cryptographic Modules</title>
          <author fullname="NIST">
            <organization>NIST</organization>
          </author>
          <date month="May" year="2001" />
        </front>
       <seriesInfo name='FIPS' value='PUB 140-2' />
      </reference>

    </references>

    <section title="Acknowledgments">
      <t>The authors would like to thank Dan Wing, Harald Alvestrand,
      Sandeep Rao, Prashanth Patil, Pal Martinsen, Marc Petit-Huguenin,
      Gonzalo Camarillo, Brian E. Carpenter, Spencer Dawkins, Adrian Farrel,
      and Simon Perreault for their comments and reviews.</t>
    </section>
  </back>
</rfc>
