No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0400.xml 9.6KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY namespace "urn:xmpp:mfa:0">
  4. <!ENTITY draft "draft-cridland-kitten-clientkey-00.txt">
  5. <!ENTITY rfc6238 "<span class='ref'><link url=''>RFC 6238</link></span> <note>RFC 6238: TOTP: Time-Based One-Time Password Algorithm &lt;<link url=''></link>&gt;.</note>" >
  6. <!ENTITY % ents SYSTEM 'xep.ent'>
  7. %ents;
  8. ]>
  9. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  10. <xep>
  11. <header>
  12. <title>Multi-Factor Authentication with TOTP</title>
  13. <abstract>This specification defines support for multi-factor authentication in terms of SASL2 Tasks based around the Time-based One Time Password mechanism.</abstract>
  15. <number>0400</number>
  16. <status>Experimental</status>
  17. <type>Standards Track</type>
  18. <sig>Standards</sig>
  19. <approver>Council</approver>
  20. <dependencies/>
  21. <supersedes/>
  22. <supersededby/>
  23. <shortname>mfa</shortname>
  24. <registry/>
  25. <discuss>standards</discuss>
  26. <author>
  27. <firstname>Dave</firstname>
  28. <surname>Cridland</surname>
  29. <email></email>
  30. <jid></jid>
  31. </author>
  32. <revision>
  33. <version>0.1.0</version>
  34. <date>2018-01-25</date>
  35. <initials>XEP Editor (jwi)</initials>
  36. <remark>Accepted by vote of Council on 2018-01-10.</remark>
  37. </revision>
  38. <revision>
  39. <version>0.0.2</version>
  40. <date>2018-01-08</date>
  41. <initials>dwd</initials>
  42. <remark><p>So ABNF isn't well-formed XML, of course...</p></remark>
  43. </revision>
  44. <revision>
  45. <version>0.0.1</version>
  46. <date>2018-01-08</date>
  47. <initials>dwd</initials>
  48. <remark><p>First draft</p></remark>
  49. </revision>
  50. </header>
  51. <section1 topic='Introduction' anchor='intro'>
  52. <p>It is generally agreed that the security of passwords can be improved
  53. when combining with another factor, such as possession of a hardware token
  54. or control of another account, etc. This specification provides a suite of SASL2
  55. tasks (see &xep0388;) and supporting protocol to allow users or administrators
  56. to perform such secondary authentication.</p>
  57. <p>This specification currently only discusses use of TOTP with SASL2; it should
  58. be noted that if client support is needed, it is far superior
  59. to simply support SASL2.</p>
  60. <p>Therefore this specification takes the view that support for entry of TOTP
  61. codes where the client has no support should be of an ad-hoc nature, or
  62. potentially unsupported by the server.</p>
  63. </section1>
  64. <section1 topic="Outline of use">
  65. <p>We start by describing the user's device capable of generating TOTP Codes
  66. as the TOTP Device. In order to support TOTP, both the TOTP Device and the
  67. server are required to have a shared TOTP Secret which can be used to generate
  68. the codes according to &rfc6238;. The process by which a TOTP Secret is generated
  69. by the server and passed to the TOTP Device is known as enrollment.</p>
  70. <p>In XMPP, enrollment can be initiated either by the server (due to an
  71. administrative fiat that the account requires TOTP) or by the user. If it is
  72. initiated by the user, the flow is a simple &IQ; based protocol; on the other
  73. hand enforced enrollment by the server is performed as a SASL2 Task.</p>
  74. <p>Once enrolled, codes are sent by the client during a second SASL2 Task.
  75. Servers might offer this as the only Multifactor option, or as one of many.</p>
  76. <p>Typically, servers supporting MFA also support CLIENT-KEY and/or
  77. CLIENT-KEY-PLUS, and will suppress MFA when these are used. This vastly
  78. improves user experience for many cases.</p>
  79. </section1>
  80. <section1 topic="Interoperability Notes">
  81. <section2 topic="Use with naïve clients">
  82. <p>Clients which do not have support for TOTP will no longer work on accounts
  83. which have been enrolled. This is problematic, and a number of options have
  84. been considered, such as sending a plain &lt;message/> stanza during client
  85. connection.</p>
  86. <p>However, use of plain messages from the server has been known to train
  87. users into bad behaviour and is easily spoofable. Therefore this specification leaves
  88. how to support legacy clients open, and proposes that users do not enroll TOTP
  89. until all their clients support it.</p>
  90. </section2>
  91. <section2 topic="TOTP Parameters">
  92. <p>Although TOTP is hash-agile and supports a range of parameters, in
  93. practise deployment has been geared heavily toward a single implementation,
  94. and therefore practical constraints on the algorithm defined in &rfc6238; are
  95. significant.
  96. </p>
  97. <p>In particular, the hash algorithm MUST be SHA-1, and the period MUST be 30
  98. seconds. 6 SHALL be the number of digits, and the number of digits SHALL be 6.</p>
  99. <p>A single implementation restricting the use of modern hash algorithms is,
  100. of course, bad, but lack of interoperability would be similarly bad.</p>
  101. </section2>
  102. </section1>
  103. <section1 topic="TOTP URIs">
  104. <p>A commonly implemented technique for passing TOTP Secrets is to encode them as a URI within which the various parameters, including the TOTP secret, are specified. Unfortunately this URI scheme appears to only be specified on a Wiki page.</p>
  105. <p>However, this URI scheme is so widely supported that interoperability demands that it is used, so this document therefore specifies a cut-down variant of the URI which is to be used within XMPP. Treatment of this URI as anything but an especially formatted string is not within the scope of this document.</p>
  106. <p>A TOTP URI is specified with the following ABNF:</p>
  107. <code><![CDATA[
  108. totp-uri = "otpauth://totp/" label "?secret=" secret "&issuer=" issuer
  109. label = issuer (":" / "%3A") jid
  110. jid = 1*CHAR ; URI-encoded jid
  111. secret = 40 * HEXCHAR ; Base32 (hex) encoded secret with no padding.
  112. issuer = 1*CHAR ; Issuer name.
  113. ]]></code>
  114. <p>Yes, issuer is in there twice. No, I don't either.</p>
  115. <p>TOTP URIs are normally presented to the user as a QR Code</p>
  116. </section1>
  117. <section1 topic="TOTP Support Operations">
  118. <section2 topic="Voluntary Account Enrollment">
  119. <p>In order to voluntarily enroll, a client sends an &IQ; of type set containing an empty element &lt;setup/>, qualified by the namespace &namespace;.</p>
  120. <example><![CDATA[
  121. <iq type='set' id='123456'>
  122. <setup xmlns=']]>&namespace;<![CDATA['/>
  123. </iq>
  124. ]]></example>
  125. <p>The server then generates a suitable TOTP secret and returns it as a URI, transmitted as the child of the &lt;setup/> element. Note that TOTP MUST NOT be enabled at this point, since it has yet to be tested.</p>
  126. <example><![CDATA[
  127. <iq type='result' id='123456'>
  128. <setup xmlns=']]>&namespace;<![CDATA['>otpauth://totp/XMPP:portia@venice.shakespeare.example?secret=58d888c08aa561f370e38cee976121532a883d71&issuer=XMPP</setup>
  129. </iq>
  130. ]]></example>
  131. <p>Next, the user configures the TOTP Device and generates a code. On the same session, it then completes setup by passing a code:</p>
  132. <example><![CDATA[
  133. <iq type='set' id='654321'>
  134. <setup xmlns=']]>&namespace;<![CDATA['>123456</setup>
  135. </iq>
  136. ]]></example>
  137. <p>If the code matches, the server responds with success and TOTP is mandatory for the account from this point.</p>
  138. <example><![CDATA[
  139. <iq type='result' id='654321'/>
  140. ]]></example>
  141. </section2>
  142. </section1>
  143. <section1 topic="TOTP SASL2 Tasks">
  144. <section2 topic="TOTP-INIT">
  145. <p>This task is used to provide (or, more typically, enforce) TOTP enrollment.</p>
  146. <p>This is typically done on first authentication.</p>
  147. <p>There is no initial-response for this task; the server speaks first.</p>
  148. <p>The server sends a challenge containing a TOTP URI. The user should configure their TOTP Device, generate a code, and the client then sends this code to the server as an ASCII string.</p>
  149. <p>If this matches, the Task succeeds, and TOTP is mandatory for the account from this point onward; servers SHOULD NOT require a TOTP task for this SASL2 process however.</p>
  150. <p>There is no additional-data on success or continue with this task.</p>
  151. </section2>
  152. <section2 topic="TOTP">
  153. <p>This task is used to require a TOTP code from the user. In general, this
  154. can be one of a group of MFA tasks available to the user, depending on which
  155. the user has enrolled for. It MUST NOT be offered to accounts which have not
  156. enrolled.</p>
  157. <p>The Task SHOULD NOT be requested if the client has authenticated using
  158. CLIENT-KEY, however security concerns might suggest that a Client Key which
  159. has not been used for a lengthy period might benefit from a TOTP challenge.</p>
  160. <p>The client MAY send first using an initial-response.</p>
  161. <p>The server will otherwise send an empty challenge.</p>
  162. <p>The response (or initial-reponse) SHALL be a TOTP code.</p>
  163. <p>If this matches, the Task succeeds.</p>
  164. <p>There is no additional-data on success or continue with this task.</p>
  165. </section2>
  166. </section1>
  167. <section1 topic='Determining Support' anchor='support'>
  168. <p>Support for the voluntary enrollment protocol by servers is advertised as the Disco feature '&namespace;'.</p>
  169. <p>Support for TOTP itself in client can be determined similarly.</p>
  170. </section1>
  171. <section1 topic='Security Considerations' anchor='security'>
  172. <p>The TOTP secret is a plaintext equivalent shared secret. Both clients and servers MUST protect this. It is RECOMMENDED that it be stored encrypted, with the encryption key held in a distinct location to the per-user TOTP secret. TOTP secrets MUST be hard for an attacker to guess - see &rfc6238; for more detail.</p>
  173. </section1>
  174. </xep>