JEP-0078: Non-SASL Authentication

This JEP documents a protocol for authentication with Jabber servers and services using the 'jabber:iq:auth' namespace.


NOTICE: The protocol defined herein is a Draft Standard of the Jabber Software Foundation. Implementations are encouraged and the protocol is appropriate for deployment in production systems, but some changes to the protocol are possible before it becomes a Final Standard.


JEP Information

Status: Draft
Type: Standards Track
Number: 0078
Version: 1.7
Last Updated: 2004-07-27
JIG: Standards JIG
Approving Body: Jabber Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: iq-auth
Schema: <http://jabber.org/protocol/iq-auth/iq-auth.xsd>

Author Information

Peter Saint-Andre

Email: stpeter@jabber.org
JID: stpeter@jabber.org

Legal Notice

This Jabber Enhancement Proposal is copyright 1999 - 2004 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <http://www.jabber.org/jsf/ipr-policy.php>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <http://www.opencontent.org/openpub/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core and XMPP IM specifications contributed by the Jabber Software Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocols defined in this JEP have been developed outside the Internet Standards Process and are to be understood as extensions to XMPP rather than as an evolution, development, or modification of XMPP itself.

Conformance Terms

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.


Table of Contents

1. Introduction
2. Requirements
3. Use Cases
3.1. User Authenticates with Server
4. Stream Feature
5. Error Handling
6. Security Considerations
7. Expiration Date
8. IANA Considerations
9. Jabber Registrar Considerations
9.1. Protocol Namespaces
9.2. Stream Features
10. XML Schemas
10.1. jabber:iq:auth
10.2. Stream Feature
Notes
Revision History


1. Introduction

The Jabber protocols have long included a method that enables a client to authenticate with a server (component authentication is specified in Jabber Component Protocol [1]). This method makes use of the 'jabber:iq:auth' namespace and has been documented variously in Internet-Drafts and elsewhere. Because the XMPP Internet-Drafts required upgraded authentication methods using SASL, documentation of the 'jabber:iq:auth' namespace for authentication was removed from the XMPP specifications (XMPP Core [2] and XMPP IM [3]). Unfortunately, SASL libraries are not available (and are unlikely to be available soon if ever) for all platforms on which Jabber clients may be written (this is especially true of platforms with small footprints, such as J2ME). While use of old-style authentication is unacceptable for the IETF's XMPP WG, there is value in allowing its use on the Jabber network as a fallback method for authentication between client and server if SASL is not supported by one party.

Note well that this JEP defines a standard component of the Basic IM Protocol Suite [4]. Thus, despite its perceived limitations, the 'jabber:iq:auth' namespace is not informational. If more secure authentication is required or desired, implementations SHOULD use the SASL authentication protocol defined in XMPP Core.

2. Requirements

The 'jabber:iq:auth' namespace must make it possible for a Jabber client to authenticate with a server. In particular, the client must provide a username and appropriate credentials for the specific authentication method used. The methods defined herein are:

  1. plaintext
  2. digest

Note that this JEP does not include the so-called "zero-knowledge" method; this method did not provide stronger security than digest authentication and thus is unnecessary. As noted, those desiring stronger security SHOULD use SASL authentication as defined in XMPP Core.

3. Use Cases

3.1 User Authenticates with Server

In order to determine which fields are required for authentication with a server, a client SHOULD first send an IQ get to the server. A client SHOULD NOT attempt to guess at the required fields, since the nature of the required data is subject to service provisioning.

Example 1. Client Opens Stream to Server

<stream:stream to='shakespeare.lit'
               xmlns='jabber:client'
               xmlns:stream='http://etherx.jabber.org/streams'>
    

Example 2. Server Opens Streams to Client

<stream:stream from='shakespeare.lit'
               xmlns='jabber:client'
               xmlns:stream='http://etherx.jabber.org/streams'
               id='3EE948B0'>
    

Example 3. Client Requests Authentication Fields from Server

<iq type='get' to='shakespeare.lit' id='auth1'>
  <query xmlns='jabber:iq:auth'>
    <username>bill</username>
  </query>
</iq>
    

Example 4. Server Returns Authentication Fields to Client

<iq type='result' id='auth1'>
  <query xmlns='jabber:iq:auth'>
    <username/>
    <password/>
    <digest/>
    <resource/>
  </query>
</iq>
    

If there is no such username, the server SHOULD NOT return an error, but instead SHOULD return the normal authentication fields (this helps to prevent unknown users from discovering which usernames are in use). If the server does not support non-SASL authentication (e.g., because it supports only SASL authentication as defined in XMPP Core, it MUST return a <service-unavailable/> error.

Both the username and the resource are REQUIRED for client authentication using the 'jabber:iq:auth' namespace; if more flexible authentication and resource provisioning are desired, a server SHOULD implement SASL authentication and resource binding as defined in XMPP Core (e.g., to enable the server to provide the resource). The <username/> and <resource/> elements MUST be included in the IQ result returned by the server in response to the initial IQ get, and also MUST be included in the IQ set sent by the client when providing authentication credentials.

The foregoing stanza shows that the server supports both plaintext authentication (via the <password/> element) and digest authentication with SHA1-encrypted passwords (via the <digest/> element).

Therefore, in order to successfully authenticate with the server in this example, a client MUST provide a username, a resource, and one of password or digest.

Example 5. Client Provides Required Information (Plaintext)

<iq type='set' id='auth2'>
  <query xmlns='jabber:iq:auth'>
    <username>bill</username>
    <password>Calli0pe</password>
    <resource>globe</resource>
  </query>
</iq>
    

Plaintext passwords are straightforward (obviously, characters that map to predefined XML entities MUST be escaped according to the rules defined in section 4.6 of the XML specification, and any non-US-ASCII characters MUST be encoded according to the encoding of XML streams as specified in XMPP Core, i.e., UTF-8 as defined in RFC 3269 [5]).

The value of the <digest/> element MUST be computed according to the following algorithm:

  1. Concatenate the Stream ID received from the server with the password. [6]
  2. Hash the concatenated string according to the SHA1 algorithm, i.e., SHA1( concat (sid, password)).
  3. Ensure that the hash output is in hexidecimal format, not binary or base64.
  4. Convert the hash output to all lowercase characters.

Example 6. Client Provides Required Information (Digest)

<iq type='set' id='auth2'>
  <query xmlns='jabber:iq:auth'>
    <username>bill</username>
    <digest>48fc78be9ec8f86d8ce1c39c320c97c21d62334d</digest>
    <resource>globe</resource>
  </query>
</iq>
    

The CDATA shown in the <digest/> element is the output produced as a result of following the algorithm defined above when the stream ID is '3EE948B0' and the password is 'Calli0pe'.

If the credentials provided match those known by the server, the client will be successfully authenticated.

Example 7. Server Informs Client of Successful Authentication

<iq type='result' id='auth2'/>
    

Alternatively, authentication may fail. Possible causes of failure include:

  1. the user provided incorrect credentials
  2. there is a resource conflict (there is already an active session with that resource identifier associated with the same username); note that the RECOMMENDED behavior is for the server to terminate the existing session and create the new one, but that the server MAY provide the opposite behavior if desired, leading to a conflict error for the newly requested login
  3. the user did not provide all of the required information (e.g., did not provide a username or resource)

Although XMPP Core specifies that error stanzas SHOULD include the original XML sent, error stanzas qualified by the 'jabber:iq:auth' namespace SHOULD NOT do so given the sensitive nature of the information being exchanged.

Example 8. Server Informs Client of Failed Authentication (Incorrect Credentials)

<iq type='error' id='auth2'>
  <error code='401' type='auth'>
    <not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    

Example 9. Server Informs Client of Failed Authentication (Resource Conflict)

<iq type='error' id='auth2'>
  <error code='409' type='cancel'>
    <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    

Example 10. Server Informs Client of Failed Authentication (Required Information Not Provided)

<iq type='error' id='auth2'>
  <error code='406' type='modify'>
    <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    

4. Stream Feature

XMPP Core [7] defines methods for advertising feature support during stream negotiation. It may be desirable for a server to advertise support for non-SASL authentication as a stream feature. The namespace for reporting support within <stream:features/> is "http://jabber.org/features/iq-auth". Upon receiving a stream header qualified by the 'jabber:client' namespace, a server that returns stream features MUST also announce support for non-SASL authentication by including the relevant stream feature whenever it also sends SASL authentication features that are safe over TLS or SSL (e.g., SASL PLAIN). Obviously, this does not apply to servers that do not support stream features (e.g., older, non-XMPP servers).

Example 11. Advertising non-SASL authentication as a stream feature

<?xml version='1.0' encoding='utf-8'?>
<stream:stream xmlns:stream='http://etherx.jabber.org/streams/'
    xmlns='jabber:client'
    from='somedomain'
    version='1.0'>
  <stream:features>
    ...
    <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
      <mechanism>DIGEST-MD5</mechanism>
      <mechanism>PLAIN</mechanism>
    </mechanisms>
    <auth xmlns='http://jabber.org/features/iq-auth'/>
    ...
  </stream:features>
  

A server SHOULD NOT advertise non-SASL authentication to another server (i.e., if the initial stream header was qualified by the 'jabber:server' namespace).

5. Error Handling

As defined herein, the 'jabber:iq:auth' namespace supports both the old (HTTP-style) error codes and the extensible error classes and conditions specified in XMPP Core. A compliant server or service implementation MUST support both old-style and new-style error handling. A compliant client implementation SHOULD support both.

6. Security Considerations

Use of the 'jabber:iq:auth' namespace for client-server authentication is not as secure as SASL authentication (defined in XMPP Core). If both client and server implement SASL, they SHOULD use SASL. If a client attempts to authenticate using the 'jabber:iq:auth' namespace after an attempt at SASL authentication fails, the server MUST refuse the 'jabber:iq:auth' attempt by returning a <policy-violation/> stream error to the client.

Client implementations MUST NOT make plaintext the default mechanism, and SHOULD warn the user that the plaintext mechanism is insecure. The plaintext mechanism SHOULD NOT be used unless the underlying stream is encrypted (using SSL or TLS) and the client has verified that the server certificate is signed by a trusted certificate authority. A given domain MAY choose to disable plaintext logins if the stream is not properly encrypted, or disable them entirely. If a client implements the plaintext mechanism and a server allows both the digest mechanism and the plaintext mechanism, an upgrade attack is possible, in which a man-in-the-middle tricks the client into revealing the user's plaintext password.

Authentication using the 'jabber:iq:auth' namespace is known to be less secure than SASL authentication, and this JEP should be fully deprecated as soon as SASL authentication is implemented widely enough.

A server MUST NOT advertise the 'jabber:iq:auth' stream feature unless the server deems it safe to also advertise SASL mechanisms that are safe to use over TLS or SSL (e.g., SASL PLAIN); this helps to prevent a downgrade attack against non-SASL authentication by a man in the middle.

7. Expiration Date

In accordance with Section 8 of Jabber Enhancement Proposals [8], this JEP shall expire six months from the date of its advancement to a status of Final. The Jabber Council shall review this JEP before its expiration date, and at that time shall determine whether to change its status to Deprecated or to extend the expiration date for an additional six months. This process will continue until the JEP is deprecated.

8. IANA Considerations

This JEP requires no interaction with the Internet Assigned Numbers Authority (IANA) [9].

9. Jabber Registrar Considerations

9.1 Protocol Namespaces

The Jabber Registrar [10] includes the 'jabber:iq:auth' namespace in its registry of protocol namespaces.

9.2 Stream Features

The Jabber Registrar includes the 'http://jabber.org/features/iq-auth' namespace in its registry of stream feature namespaces.

10. XML Schemas

10.1 jabber:iq:auth

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='jabber:iq:auth'
    xmlns='jabber:iq:auth'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      JEP-0078: http://www.jabber.org/jeps/jep-0078.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='query'>
    <xs:complexType>
      <xs:sequence minOccurs='0'>
        <xs:element name='username' type='xs:string' minOccurs='0'/>
        <xs:choice>
          <xs:element name='password' type='xs:string' minOccurs='0'/>
          <xs:element name='digest' type='xs:string' minOccurs='0'/>
        </xs:choice>
        <xs:element name='resource' type='xs:string' minOccurs='0'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
    

10.2 Stream Feature

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://jabber.org/features/iq-auth'
    xmlns='http://jabber.org/features/iq-auth'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      JEP-0078: http://www.jabber.org/jeps/jep-0078.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='auth' type='empty'/>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
    


Notes

1. JEP-0114: Jabber Component Protocol <http://www.jabber.org/jeps/jep-0114.html>.

2. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://www.ietf.org/rfc/rfc3920.txt>.

3. RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://www.ietf.org/rfc/rfc3921.txt>.

4. JEP-0073: Basic IM Protocol Suite <http://www.jabber.org/jeps/jep-0073.html>.

5. RFC 3269: UTF-8, a transformation format of ISO 10646 <http://www.ietf.org/rfc/rfc3269.txt>.

6. In Digest authentication, password characters that map to predefined XML entities SHOULD NOT be escaped as they are for plaintext passwords, but non-US-ASCII characters MUST be encoded as UTF-8 since the SHA-1 hashing algorithm operates on byte arrays.

7. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://www.ietf.org/rfc/rfc3920.txt>.

8. JEP-0001: Jabber Enhancement Proposals <http://www.jabber.org/jeps/jep-0001.html>.

9. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

10. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <http://www.jabber.org/registrar/>.


Revision History

Version 1.7 (2004-07-27)

Added reference to character escaping in digest authentication; required inclusion of stream feature when server supports stream features and it is safe to advertise non-SASL authentication. (psa)

Version 1.6 (2004-07-21)

Removed reference to UTF-16, which is disallowed by XMPP Core; removed reference to character escaping in digest authentication pending list discussion. (psa)

Version 1.5 (2004-02-18)

Added optional stream feature. (psa)

Version 1.4 (2004-02-03)

Clarified that username and resource are required for authentication. (psa)

Version 1.3 (2003-11-26)

Added XMPP error handling. (psa)

Version 1.2 (2003-11-06)

Addressed case of attempting jabber:iq:auth after SASL failure. (psa)

Version 1.1 (2003-10-02)

Moved change password use case to JEP-0077. (psa)

Version 1.0 (2003-06-18)

Per a vote of the Jabber Council, advanced status to Draft. (psa)

Version 0.8 (2003-06-18)

Changes to address Council concerns. (psa)

Version 0.7 (2003-06-13)

Added change password use case; added more details to security considerations. (psa)

Version 0.6 (2003-06-12)

Added digest example; clarified escaping requirements; further specified error conditions; added more details to security considerations. (psa)

Version 0.5 (2003-06-06)

Removed XMPP-style error conditions until formats are stable. (psa)

Version 0.4 (2003-05-30)

Removed "enhanced digest" content, added information about expiration date. (psa)

Version 0.3 (2003-05-28)

Added "enhanced digest" method. (psa)

Version 0.2 (2003-05-20)

Slight editorial revisions. (psa)

Version 0.1 (2003-04-10)

Initial version. (psa)


END