Telnet SRP: Telnet Authentication: SRP
How Telnet uses the Secure Remote Password protocol so a user can log in without sending a password.
Wu, T., "Telnet Authentication: SRP", RFC 2944, DOI 10.17487/RFC2944, September 2000, <https://www.rfc-editor.org/info/rfc2944>.
@misc{rfc2944,
series = {Request for Comments},
number = 2944,
howpublished = {RFC 2944},
publisher = {RFC Editor},
doi = {10.17487/RFC2944},
url = {https://www.rfc-editor.org/info/rfc2944},
author = {T. Wu},
title = {{Telnet Authentication: SRP}},
pagetotal = 7,
year = 2000,
month = sep,
} RFC text
Contents
Network Working Group T. Wu
Request for Comments: 2944 Standford University
Category: Standards Track September 2000
Telnet Authentication: SRP
Status of this Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2000). All Rights Reserved.
Abstract
This document specifies an authentication scheme for the Telnet
protocol under the framework described in [RFC2941], using the Secure
Remote Password Protocol (SRP) authentication mechanism. The
specific mechanism, SRP-SHA1, is described in [RFC2945].
1. Command Names and Codes
Authentication Types
SRP 5
Suboption Commands
AUTH 0
REJECT 1
ACCEPT 2
CHALLENGE 3
RESPONSE 4
EXP 8
PARAMS 9
2. Command Meanings
IAC SB AUTHENTICATION IS <authentication-type-pair> AUTH IAC SE
This command indicates that the client has supplied the
username and is ready to receive that user's field parameters.
There is no authentication information to be sent to the remote
side of the connection yet. This should only be sent after the
IAC SB AUTHENTICATION NAME command has been issued. If the
modifier byte (second byte of the authentication-type-pair)
has any bits other than AUTH_WHO_MASK or AUTH_HOW_MASK set,
both bytes are included in the session key hash described later.
This ensures that the authentication type pair was correctly
negotiated, while maintaining backward-compatibility with existing
software.
IAC SB AUTHENTICATION REPLY <authentication-type-pair> PARAMS <values
of modulus, generator, and salt> IAC SE
This command is used to pass the three parameter values used
in the exponentiation to the client. These values are often
called n, g, and s.
IAC SB AUTHENTICATION IS <authentication-type-pair> EXP <client's
exponential residue> IAC SE
This command is used to pass the client's exponential residue,
otherwise known as A, computed against the parameters exchanged
earlier.
IAC SB AUTHENTICATION REPLY <authentication-type-pair> CHALLENGE
<server's exponential residue> IAC SE
This command is used to pass the server's exponential residue,
computed against the same parameters. This quantity is actually
the sum of two residues, i.e. g^x + g^b. For details see [SRP]
and [RFC2945].
IAC SB AUTHENTICATION IS <authentication-type-pair> RESPONSE
<response from client> IAC SE
This command gives the server proof of the client's authenticity
with a 160-bit (20 byte) response.
IAC SB AUTHENTICATION REPLY <authentication-type-pair> ACCEPT
<server's response> IAC SE
This command indicates that the authentication was successful.
The server will construct its own proof of authenticity and
include it as sub-option data.
IAC SB AUTHENTICATION REPLY <authentication-type-pair> REJECT
<optional reason for rejection> IAC SE
This command indicates that the authentication was not successful,
and if there is any more data in the sub-option, it is an ASCII
text message of the reason for the rejection.
For the PARAMS command, since three pieces of data are being
transmitted, each parameter is preceded by a 16-bit (two byte) length
specifier in network byte order. The EXP commands do not have a
count in front of the data because there is only one piece of data in
that suboption. The CHALLENGE, RESPONSE, and ACCEPT data also do not
have a count because they are all fixed in size.
3. Implementation Rules
Currently, only AUTH_CLIENT_TO_SERVER mode is supported. Although
the SRP protocol effectively performs implicit mutual authentication
as a result of the two-way proofs, only the AUTH_HOW_ONE_WAY
authentication mode is currently defined. The AUTH_HOW_MUTUAL
setting is being reserved for an explicit mutual-authentication
variant of the SRP protocol to be defined in future specifications.
All large number data sent in the arguments of the PARAMS and EXP
commands must be in network byte order, i.e. most significant byte
first. No padding is used.
The SRP-SHA1 mechanism, as described in [RFC2945] generates a 40-byte
session key, which allows implementations to use different keys for
incoming and outgoing traffic, increasing the security of the
encrypted session. It is recommended that the Telnet ENCRYPT method,
if it is used, be able to take advantage of the longer session keys.
4. Examples
User "tjw" may wish to log in on machine "foo". The client would
send IAC SB AUTHENTICATION NAME "tjw" IAC SE IAC SB AUTHENTICATION IS
SRP AUTH IAC SE. The server would look up the field and salt
parameters for "tjw" from its password file and send them back to the
client. Client and server would then exchange exponential residues
and calculate their session keys (after the client prompted "tjw" for
his password). Then, the client would send the server its proof that
it knows the session key. The server would either send back an
ACCEPT or a REJECT. If the server accepts authentication, it also
sends its own proof that it knows the session key to the client.
Client Server
IAC DO AUTHENTICATION
IAC WILL AUTHENTICATION
[ The server is now free to request authentication information.
]
IAC SB AUTHENTICATION SEND
SRP CLIENT|ONE_WAY|
ENCRYPT_USING_TELOPT
SRP CLIENT|ONE_WAY
IAC SE
[ The server has requested SRP authentication. It has indicated
a preference for ENCRYPT_USING_TELOPT, which requires the
Telnet ENCRYPT option to be negotiated once authentication
succeeds. If the client does not support this, the server
is willing to fall back to an encryption-optional mode.
The client will now respond with the name of the
user that it wants to log in as. ]
IAC SB AUTHENTICATION NAME
"tjw" IAC SE
IAC SB AUTHENTICATION IS
SRP CLIENT|ONE_WAY|ENCRYPT_USING_TELOPT AUTH
IAC SE
[ The server looks up the appropriate information for "tjw" and
sends back the parameters in a PARAMS command. The parameters
consist of the values N, g, and s, each preceded with a two-
byte size parameter. ]
IAC SB AUTHENTICATION REPLY
SRP CLIENT|ONE_WAY|
ENCRYPT_USING_TELOPT PARAMS
ss ss nn nn nn nn ...
ss ss gg gg gg gg ...
ss ss tt tt tt tt ...
IAC SE
[ Both sides send their exponential residues. The client
sends its value A and the server sends its value B. In SRP,
the CHALLENGE message may be computed but not sent before
the EXP command. ]
IAC SB AUTHENTICATION IS
SRP CLIENT|ONE_WAY|ENCRYPT_USING_TELOPT EXP
aa aa aa aa aa aa aa aa ...
IAC SE
IAC SB AUTHENTICATION REPLY
SRP CLIENT|ONE_WAY|
ENCRYPT_USING_TELOPT CHALLENGE
bb bb bb bb bb bb bb bb ...
IAC SE
[ The client sends its response to the server. This is the
message M in the SRP protocol, which proves possession of
the session key by the client.
Since ENCRYPT_USING_TELOPT is specified, the two octets
of the authentication-type-pair are appended to the
session key K before the hash for M is computed. If
the client and server had agreed upon a mode without
the encryption flag set, nothing would be appended to K.
Both this message and the server's response are as long as
the output of the hash; the length is 20 bytes for SHA-1. ]
IAC SB AUTHENTICATION IS
SRP CLIENT|ONE_WAY|ENCRYPT_USING_TELOPT RESPONSE
xx xx xx xx xx xx xx xx ...
IAC SE
[ The server accepts the response and sends its own proof. ]
IAC SB AUTHENTICATION REPLY
SRP CLIENT|ONE_WAY|
ENCRYPT_USING_TELOPT ACCEPT
yy yy yy yy yy yy yy yy ...
IAC SE
5. Security Considerations
The ability to negotiate a common authentication mechanism between
client and server is a feature of the authentication option that
should be used with caution. When the negotiation is performed, no
authentication has yet occurred. Therefore, each system has no way
of knowing whether or not it is talking to the system it intends. An
intruder could attempt to negotiate the use of an authentication
system which is either weak, or already compromised by the intruder.
Since SRP relies on the security of the underlying public-key
cryptosystem, the modulus "n" should be large enough to resist
brute-force attack. A length of at least 1024 bits is recommended,
and implementations should reject attempts to use moduli that are
shorter than 512 bits, or attempts to use invalid moduli and
generator parameters (non-safe-prime "n" or non-primitive "g").
6. IANA Considerations
The authentication type SRP and its associated suboption values are
registered with IANA. Any suboption values used to extend the
protocol as described in this document must be registered with IANA
before use. IANA is instructed not to issue new suboption values
without submission of documentation of their use.
7. References
[RFC2941] Ts'o, T. and J. Altman, "Telnet Authentication Option",
RFC 2941, September 2000.
[SRP] T. Wu, "The Secure Remote Password Protocol", In
Proceedings of the 1998 ISOC Network and Distributed
System Security Symposium, San Diego, CA, pp. 97-111.
[RFC2945] Wu, T., "The SRP Authentication and Key Exchange System",
RFC 2945, September 2000.
8. Author's Address
Thomas Wu
Stanford University
Stanford, CA 94305
EMail: tjw@cs.Stanford.EDU
9. Full Copyright Statement
Copyright (C) The Internet Society (2000). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
AI ELI5
On this page
§1SRP Inside the Authentication Option
RFC 2944 plugs the Secure Remote Password (SRP) mechanism into the Telnet Authentication Option from RFC 2941. The specific mechanism is SRP-SHA1, which is described in RFC 2945. This memo only defines how its messages are carried in Telnet sub-options.
The authentication type is SRP, code 5. The sub-option commands are AUTH (0), REJECT (1), ACCEPT (2), CHALLENGE (3), RESPONSE (4), EXP (8) and PARAMS (9).
SRP is a way to prove you know a password without telling it. This RFC just says which Telnet messages carry the steps.
§2The SRP Sub-option Commands
Each command follows the pattern IAC SB AUTHENTICATION IS|REPLY <authentication-type-pair> <command> ... IAC SE.
- AUTH (client): the client has supplied the user name and is ready to receive that user's field parameters. It carries no authentication data and should only be sent after the
NAMEcommand. - PARAMS (server): the three values n (modulus), g (generator) and s (salt).
- EXP (client): the client's exponential residue, called A.
- CHALLENGE (server): the server's exponential residue. The RFC describes it as the sum of two residues, g^x + g^b.
- RESPONSE (client): a 160-bit (20 byte) proof of the client's authenticity.
- ACCEPT (server): authentication succeeded, with the server's own proof as data.
- REJECT (server): authentication failed, with an optional ASCII reason.
In PARAMS, each of the three values is preceded by a 16-bit length in network byte order. EXP has no count because it holds one value. CHALLENGE, RESPONSE and ACCEPT have no count because they are fixed in size.
There are a few kinds of message: hello with my name, here are the numbers to use, here is my answer, here is yours, and finally yes or no.
- 0AUTH — Client has sent the user name and wants the parameters.
- 1REJECT — Authentication failed; optional ASCII reason.
- 2ACCEPT — Authentication succeeded; carries the server's proof.
- 3CHALLENGE — The server's exponential residue.
- 4RESPONSE — The client's 20-byte proof.
- 8EXP — The client's exponential residue, A.
- 9PARAMS — The values n, g and s.
§3Implementation Rules
Only AUTH_CLIENT_TO_SERVER mode is supported, and only the AUTH_HOW_ONE_WAY mode is defined. SRP's two-way proofs already give implicit mutual authentication. AUTH_HOW_MUTUAL is reserved for an explicit mutual variant to be defined in a future specification.
Large numbers in PARAMS and EXP go in network byte order, most significant byte first, with no padding.
SRP-SHA1 produces a 40-byte session key. Implementations can use different keys for incoming and outgoing traffic, which makes the encrypted session more secure. The RFC recommends that the Telnet ENCRYPT method, if used, be able to take advantage of the longer keys.
If the modifier byte, the second byte of the type pair, has any bits other than AUTH_WHO_MASK or AUTH_HOW_MASK set, both bytes are included in the session key hash. This confirms the type pair was negotiated correctly while staying compatible with existing software.
The rules say how to write big numbers down, which direction the checking goes, and how to make the secret key long enough to be strong.
§4A Login Walk-through
User tjw wants to log in on machine foo. The server offers SRP CLIENT|ONE_WAY|ENCRYPT_USING_TELOPT and falls back to SRP CLIENT|ONE_WAY if the client cannot do encryption. The client sends NAME and then AUTH. The server looks up the field and salt for the user in its password file and sends PARAMS.
The client prompts the user for the password. The two sides swap exponential residues with EXP and CHALLENGE and compute their session keys. The client then sends RESPONSE, the message M that proves it holds the session key. If ENCRYPT_USING_TELOPT was agreed, the two octets of the type pair are appended to the session key K before the hash for M is computed. Otherwise nothing is appended.
The response and the server's proof are as long as the hash output, which is 20 bytes for SHA-1. The server answers with ACCEPT and its own proof, or with REJECT.
You tell the computer your name, it sends some numbers, you type your password into your own computer only, and you each send a proof you did the math right.
- NAME "tjw"
- IS SRP ... AUTHReady to receive the field parameters.
- REPLY PARAMS (n, g, s)Each value has a 2-byte length in front.
- IS EXP (A)
- REPLY CHALLENGE (B)
- IS RESPONSEProof that the client knows the session key.
- REPLY ACCEPTCarries the server's own proof.
§5Negotiation Risks and Modulus Size
Negotiating a mechanism should be used with caution. During negotiation, no authentication has happened yet, so neither side knows whether it is talking to the system it intends. An intruder could try to push the use of an authentication system that is weak or already compromised.
SRP relies on the security of the underlying public-key cryptosystem, so the modulus n should be large enough to resist brute-force attack. The RFC recommends at least 1024 bits. Implementations should reject moduli shorter than 512 bits and invalid moduli or generators, meaning a non-safe-prime n or a non-primitive g.
Before you agree on a lock, a bad guy could try to talk you into a flimsy one. And the secret numbers must be big enough that nobody can guess them.