home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / e / id-sa-03.txt < prev    next >
Text File  |  2020-01-01  |  16KB  |  365 lines

  1.  
  2.  
  3.  
  4. Internet Draft                                                     T. Wu
  5. draft-ietf-wu-srp-auth-03.txt                        Stanford University
  6. Expires January 2000                                           July 1999
  7.  
  8.  
  9.             The SRP Authentication and Key Exchange System
  10.  
  11. Status of this Memo
  12.  
  13.      This document is an Internet-Draft and is in full conformance
  14.      with all provisions of Section 10 of RFC2026.  Internet-Drafts
  15.      are working documents of the Internet Engineering Task Force
  16.      (IETF), its areas, and its working groups.  Note that other
  17.      groups may also distribute working documents as Internet-Drafts.
  18.  
  19.      Internet-Drafts are draft documents valid for a maximum of six
  20.      months and may be updated, replaced, or obsoleted by other
  21.      documents at any time.  It is inappropriate to use Internet-
  22.      Drafts as reference material or to cite them other than as
  23.      "work in progress."
  24.  
  25.      To view the entire list of current Internet-Drafts, please check
  26.      the "1id-abstracts.txt" listing contained in the Internet-Drafts
  27.      Shadow Directories on ftp.is.co.za (Africa), ftp.nordu.net
  28.      (Europe), munnari.oz.au (Pacific Rim), ds.internic.net (US East
  29.      Coast), or ftp.isi.edu (US West Coast).
  30.  
  31. Abstract
  32.  
  33.    This document describes a cryptographically strong network
  34.    authentication mechanism known as the Secure Remote Password (SRP)
  35.    protocol.  This mechanism is suitable for negotiating secure
  36.    connections using a user-supplied password, while eliminating the
  37.    security problems traditionally associated with reusable passwords.
  38.    This system also performs a secure key exchange in the process of
  39.    authentication, allowing security layers (privacy and/or integrity
  40.    protection) to be enabled during the session.  Trusted key servers
  41.    and certificate infrastructures are not required, and clients are
  42.    not required to store or manage any long-term keys.  SRP offers
  43.    both security and deployment advantages over existing challenge-
  44.    response techniques, making it an ideal drop-in replacement where
  45.    secure password authentication is needed.
  46.  
  47. 1. Introduction
  48.  
  49.    The lack of a secure authentication mechanism that is also easy
  50.    to use has been a long-standing problem with the vast majority of
  51.    Internet protocols currently in use.  The problem is two-fold:
  52.    Users like to use passwords that they can remember, but most
  53.    password-based authentication systems offer little protection
  54.    against even passive attackers, especially if weak and easily-
  55.    guessed passwords are used.
  56.  
  57.  
  58. draft-ietf-wu-srp-auth-03.txt                                   [Page 2]
  59.  
  60.    Eavesdropping on a TCP/IP network can be carried out very easily
  61.    and very effectively against protocols that transmit passwords in
  62.    the clear.  Even so-called "challenge-response" techniques like
  63.    the one described in [RFC 2095] and [RFC 1760], which are designed
  64.    to defeat simple sniffing attacks, can be compromised by what is
  65.    known as a "dictionary attack".  This occurs when an attacker
  66.    captures the messages exchanged during a legitimate run of the
  67.    protocol and uses that information to verify a series of guessed
  68.    passwords taken from a precompiled "dictionary" of common passwords.
  69.    This works because users often choose simple, easy-to-remember
  70.    passwords, which invariably are also easy to guess.
  71.  
  72.    Many existing mechanisms also require the password database on the
  73.    host to be kept secret because the password P or some private hash
  74.    h(P) is stored there and would compromise security if revealed.
  75.    That approach often degenerates into "security through obscurity"
  76.    and goes against the UNIX convention of keeping a "public" password
  77.    file whose contents can be revealed without destroying system security.
  78.  
  79.    SRP meets the strictest requirements laid down in [RFC 1704] for a
  80.    non-disclosing authentication protocol.  It offers complete protection
  81.    against both passive and active attacks, and accomplishes this
  82.    efficiently using a single Diffie-Hellman-style round of computation,
  83.    making it feasible to use in both interactive and non-interactive
  84.    authentication for a wide range of Internet protocols.  Since it
  85.    retains its security when used with low-entropy passwords, it can
  86.    be seamlessly integrated into existing user applications.
  87.  
  88. 2. Conventions and Terminology
  89.  
  90.    The protocol described by this document is sometimes referred to
  91.    as "SRP-3" for historical purposes.  This particular protocol is
  92.    described in [SRP] and is believed to have very good logical
  93.    and cryptographic resistance to both eavesdropping and active
  94.    attacks.
  95.  
  96.    This document does not attempt to describe SRP in the context
  97.    of any particular Internet protocol; instead it describes an
  98.    abstract protocol that can be easily fitted to a particular
  99.    application.  For example, the specific format of messages
  100.    (including padding) is not specified.  Those issues have been
  101.    left to the protocol implementor to decide.
  102.  
  103.    The one implementation issue worth specifying here is the
  104.    mapping between strings and integers.  Internet protocols are
  105.    byte-oriented, while SRP performs algebraic operations on its
  106.    messages, so it is logical to define at least one method
  107.    by which integers can be converted into a string of bytes and
  108.    vice versa.
  109.  
  110.  
  111. draft-ietf-wu-srp-auth-03.txt                                   [Page 3]
  112.  
  113.    An n-byte string S can be converted to an integer as follows:
  114.  
  115.    i = S[n-1] + 256 * S[n-2] + 256^2 * S[n-3] + ... + 256^(n-1) * S[0]
  116.  
  117.    where i is the integer and S[x] is the value of the x'th byte
  118.    of S.  In human terms, the string of bytes is the integer
  119.    expressed in base 256, with the most significant digit first.
  120.    When converting back to a string, S[0] must be non-zero (padding
  121.    is considered to be a separate, independent process).  This
  122.    conversion method is suitable for file storage, in-memory
  123.    representation, and network transmission of large integer
  124.    values.  Unless otherwise specified, this mapping will be
  125.    assumed.
  126.  
  127.    If implementations require padding a string that represents an
  128.    integer value, it is recommended that they use zero bytes and
  129.    add them to the beginning of the string.  The conversion back to
  130.    integer automatically discards leading zero bytes, making this
  131.    padding scheme less prone to error.
  132.  
  133.    The SHA hash function, when used in this document, refers to the
  134.    SHA-1 message digest algorithm described in [SHA1].
  135.  
  136. 3. The SRP-SHA1 mechanism
  137.  
  138.    This section describes an implementation of the SRP authentication
  139.    and key-exchange protocol that employs the SHA hash function to
  140.    generate session keys and authentication proofs.
  141.  
  142.    The host stores user passwords as triplets of the form
  143.  
  144.      { <username>, <password verifier>, <salt> }
  145.  
  146.    Password entries are generated as follows:
  147.  
  148.      <salt> = random()
  149.      x = SHA(<salt> | SHA(<username> | ":" | <raw password>))
  150.      <password verifier> = v = g^x % N
  151.  
  152.    The | symbol indicates string concatenation, the ^ operator is the
  153.    exponentiation operation, and the % operator is the integer remainder
  154.    operation.  Most implementations perform the exponentiation and
  155.    remainder in a single stage to avoid generating unwieldy intermediate
  156.    results.  Note that the 160-bit output of SHA is implicitly converted
  157.    to an integer before it is operated upon.
  158.  
  159.  
  160. draft-ietf-wu-srp-auth-03.txt                                   [Page 4]
  161.  
  162.    Authentication is generally initiated by the client.
  163.  
  164.         Client                             Host
  165.        --------                           ------
  166.         U = <username>              -->
  167.                                     <--    s = <salt from passwd file>
  168.  
  169.    Upon identifying himself to the host, the client will receive
  170.    the salt stored on the host under his username.
  171.  
  172.         a = random()
  173.         A = g^a % N                 -->
  174.                                            v = <stored password verifier>
  175.                                            b = random()
  176.                                     <--    B = (v + g^b) % N
  177.  
  178.         p = <raw password>
  179.         x = SHA(s | SHA(U | ":" | p))
  180.  
  181.         S = (B - g^x) ^ (a + u * x) % N    S = (A * v^u) ^ b % N
  182.     K = SHA_Interleave(S)              K = SHA_Interleave(S)
  183.         (this function is described
  184.          in the next section)
  185.  
  186.    The client generates a random number, raises g to that power modulo
  187.    the field prime, and sends the result to the host.  The host
  188.    does the same thing and also adds the public verifier before
  189.    sending it to the client.  Both sides then construct the shared
  190.    session key based on the respective formulae.
  191.  
  192.    The parameter u is a 32-bit unsigned integer which takes its
  193.    value from the first 32 bits of the SHA1 hash of B, MSB first.
  194.  
  195.    The client MUST abort authentication if B % N is zero.
  196.  
  197.    The host MUST abort the authentication attempt if A % N is
  198.    zero.  The host MUST send B after receiving A from the client,
  199.    never before.
  200.  
  201.    At this point, the client and server should have a common
  202.    session key that is secure (i.e. not known to an outside party).
  203.    To finish authentication, they must prove to each other that
  204.    their keys are identical.
  205.  
  206.         M = H(H(N) XOR H(g) | H(U) | s | A | B | K)
  207.                                     -->
  208.                                     <--    H(A | M | K)
  209.  
  210.    The server will calculate M using its own K and compare
  211.    it against the client's response.  If they do not match, the
  212.    server MUST abort and signal an error before it attempts to
  213.    answer the client's challenge.  Not doing so could compromise the
  214.    security of the user's password.
  215.  
  216.  
  217. draft-ietf-wu-srp-auth-03.txt                                   [Page 5]
  218.  
  219.    If the server receives a correct response, it issues its own proof
  220.    to the client.  The client will compute the expected response using
  221.    its own K to verify the authenticity of the server.  If the client
  222.    responded correctly, the server MUST respond with its hash value.
  223.  
  224.    The transactions in this protocol description do not necessarily
  225.    have a one-to-one correspondence with actual protocol messages.
  226.    This description is only intended to illustrate the relationships
  227.    between the different parameters and how they are computed.
  228.    It is possible, for example, for an implementation of the SRP-SHA1
  229.    mechanism to consolidate some of the flows as follows:
  230.  
  231.         Client                             Host
  232.        --------                           ------
  233.         U, A                        -->
  234.                                     <--    s, B
  235.         H(H(N) XOR H(g) | H(U) | s | A | B | K)
  236.                                     -->
  237.                                     <--    H(A | M | K)
  238.  
  239.    The values of N and g used in this protocol must be agreed upon
  240.    by the two parties in question.  They can be set in advance, or
  241.    the host can supply them to the client.  In the latter case, the
  242.    host should send the parameters in the first message along with
  243.    the salt.  For maximum security, N should be a safe prime
  244.    (i.e. a number of the form N = 2q + 1, where q is also prime).
  245.    Also, g should be a generator modulo N (see [SRP] for details),
  246.    which means that for any X where 0 < X < N, there exists a value
  247.    x for which g^x % N == X.
  248.  
  249. 3.1.  Interleaved SHA
  250.  
  251.    The SHA_Interleave function used in SRP-SHA1 is used to generate
  252.    a session key that is twice as long as the 160-bit output of SHA1.
  253.    To compute this function, remove all leading zero bytes from the
  254.    input.  If the length of the resulting string is odd, also remove
  255.    the first byte.  Call the resulting string T.  Extract the
  256.    even-numbered bytes into a string E and the odd-numbered bytes
  257.    into a string F, i.e.
  258.  
  259.      E = T[0] | T[2] | T[4] | ...
  260.      F = T[1] | T[3] | T[5] | ...
  261.  
  262.    Both E and F should be exactly half the length of T.  Hash each
  263.    one with regular SHA1, i.e.
  264.  
  265.      G = SHA(E)
  266.      H = SHA(F)
  267.  
  268.    Interleave the two hashes back together to form the output, i.e.
  269.  
  270.      result = G[0] | H[0] | G[1] | H[1] | ... | G[19] | H[19]
  271.  
  272.    The result will be 40 bytes (320 bits) long.
  273.  
  274.  
  275. draft-ietf-wu-srp-auth-03.txt                                   [Page 6]
  276.  
  277. 3.2.  Other Hash Algorithms
  278.  
  279.    SRP can be used with hash functions other than SHA.
  280.    If the hash function produces an output of a different length
  281.    than SHA (20 bytes), it may change the length of some of the
  282.    messages in the protocol, but the fundamental operation will
  283.    be unaffected.
  284.  
  285.    Earlier versions of the SRP mechanism used the MD5 hash function,
  286.    described in [RFC 1321].  Keyed hash transforms are also
  287.    recommended for use with SRP; one possible construction
  288.    uses HMAC [RFC 2104], using K to key the hash in each
  289.    direction instead of concatenating it with the other parameters.
  290.  
  291.    Any hash function used with SRP should produce an output of at
  292.    least 16 bytes and have the property that small changes in the
  293.    input cause significant nonlinear changes in the output.  [SRP]
  294.    covers these issues in more depth.
  295.  
  296. 4. Security Considerations
  297.  
  298.    This entire draft discusses an authentication and key-exchange
  299.    system that protects passwords and exchanges keys across an
  300.    untrusted network.  This system improves security by eliminating
  301.    the need to send cleartext passwords over the network and by
  302.    enabling encryption through its secure key-exchange mechanism.
  303.  
  304.    The private values for a and b correspond roughly to the private
  305.    values in a Diffie-Hellman exchange and have similar constraints
  306.    of length and entropy.  Implementations may choose to increase the
  307.    length of the parameter u, as long as both client and server agree,
  308.    but it is not recommended that it be shorter than 32 bits.
  309.  
  310.    SRP has been designed not only to counter the threat of casual
  311.    password-sniffing, but also to prevent a determined attacker
  312.    equipped with a dictionary of passwords from guessing at
  313.    passwords using captured network traffic.  The SRP protocol
  314.    itself also resists active network attacks, and implementations
  315.    can use the securely exchanged keys to protect the session against
  316.    hijacking and provide confidentiality.
  317.  
  318.    SRP also has the added advantage of permitting the host to store
  319.    passwords in a form that is not directly useful to an attacker.
  320.    Even if the host's password database were publicly revealed,
  321.    the attacker would still need an expensive dictionary search to
  322.    obtain any passwords.  The exponential computation required to
  323.    validate a guess in this case is much more time-consuming than
  324.    the hash currently used by most UNIX systems.  Hosts are still
  325.    advised, though, to try their best to keep their password files
  326.    secure.
  327.  
  328.  
  329. draft-ietf-wu-srp-auth-03.txt                                   [Page 7]
  330.  
  331. 5. References
  332.  
  333.    [RFC 1321]  R. L. Rivest, The MD5 Message-Digest Algorithm, "Request
  334.                For Comments (RFC) 1321", MIT and RSA Data Security, Inc.,
  335.                April 1992
  336.  
  337.    [RFC 1704]  N. Haller and R. Atkinson, On Internet Authentication,
  338.                "Request for Comments (RFC) 1704", NRL, October 1994
  339.  
  340.    [RFC 1760]  N. Haller, The S/Key One-Time Password System, "Request
  341.                For Comments (RFC) 1760", Bellcore, Feburary 1995
  342.  
  343.    [RFC 2095]  J. Klensin, R. Catoe, P. Krumviede, IMAP/POP AUTHorize
  344.                Extension for Simple Challenge/Response, "Request For
  345.                Comments (RFC) 2095", MCI, January 1997
  346.  
  347.    [RFC 2104]  H. Krawczyk, M. Bellare, R. Canetti, HMAC: Keyed-Hashing
  348.                for Message Authentication, "Request for Comments (RFC)
  349.                2104", IBM, February 1997
  350.  
  351.    [SHA1]  National Institute of Standards and Technology (NIST),
  352.            "Announcing the Secure Hash Standard", FIPS 180-1, U.S.
  353.            Department of Commerce, April 1995.
  354.  
  355.    [SRP]  T. Wu, "The Secure Remote Password Protocol", In Proceedings
  356.           of the 1998 Internet Society Symposium on Network and
  357.           Distributed Systems Security, San Diego, CA, pp. 97-111.
  358.  
  359. 6. Author's Address
  360.  
  361.    Thomas Wu
  362.    Stanford University
  363.    Stanford, CA 94305
  364.    Email: tjw@cs.Stanford.EDU
  365.