RFC 8120
Mutual Authentication Protocol for HTTP
Mutual Authentication Protocol for HTTP โจ
Okay bestie, this is RFC 8120 ๐ง, the Mutual Authentication Protocol for HTTP. Here's the header tea:
- Authors: Y. Oiwa, H. Watanabe, H. Takagi (ITRI, AIST), K. Maeda (Individual Contributor), T. Hayashi (Lepidum), and Y. Ioku (Individual Contributor) ๐ฏโโ๏ธ
- Category: Experimental ๐งช
- ISSN: 2070-1721
- Date: April 2017 ๐
- Obsoletes / Updates: none listed in the header ๐ โโ๏ธ
Abstract
Okay so this doc defines an authentication scheme for HTTP ๐. It's called either the Mutual authentication scheme or the Mutual authentication protocol, and it's giving true mutual authentication between an HTTP client and an HTTP server using password-based auth ๐.
The main glow-up is that unlike Basic and Digest auth, this scheme actually assures the user that the server truly knows the user's encrypted password. The server has to prove it knows the password, not just say it does. Iconic ๐
Status of This Memo
Not an Internet Standards Track spec, babe ๐. It's published for examination, experimental implementation, and evaluation ๐งช.
This document defines an Experimental Protocol for the Internet community ๐. It's a product of the Internet Engineering Task Force (IETF) and represents the consensus of the IETF community ๐ซถ. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG) โ .
Not every IESG-approved doc is a candidate for any level of Internet Standard, so ngl, read Section 2 of RFC 7841 if you want the full deets ๐.
Info about the current status, any errata, and how to give feedback lives at http://www.rfc-editor.org/info/rfc8120 ๐.
Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved ๐.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as in effect on the date of publication. Please review these documents carefully, bestie, because they describe your rights and restrictions with respect to this document ๐.
Code Components extracted from this document must include Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they're provided without warranty as described in the Simplified BSD License โ๏ธ.
Table of Contents ๐ธ
1. Introduction ....................................................3
1.1. Terminology ................................................5
1.2. Document Structure and Related Documents ...................6
2. Protocol Overview ...............................................6
2.1. Messages ...................................................7
2.2. Typical Flows of the Protocol ..............................8
2.3. Alternative Flows .........................................10
3. Message Syntax .................................................12
3.1. Non-ASCII Extended Header Parameters ......................12
3.2. Values ....................................................13
3.2.1. Tokens .............................................13
3.2.2. Strings ............................................14
3.2.3. Numbers ............................................14
4. Messages .......................................................15
4.1. 401-INIT and 401-STALE ....................................16
4.2. req-KEX-C1 ................................................19
4.3. 401-KEX-S1 ................................................19
4.4. req-VFY-C .................................................20
4.5. 200-VFY-S .................................................21
5. Authentication Realms ..........................................21
5.1. Resolving Ambiguities .....................................23
6. Session Management .............................................24
7. Host Validation Methods ........................................26
7.1. Applicability Notes .......................................27
7.2. Notes on "tls-unique" .....................................28
8. Authentication Extensions ......................................28
9. String Preparation .............................................29
10. Decision Procedure for Clients ................................29
10.1. General Principles and Requirements ......................29
10.2. State Machine for the Client (Informative) ...............31
11. Decision Procedure for Servers ................................36
12. Authentication Algorithms .....................................39
12.1. Support Functions and Notations ..........................39
12.2. Default Functions for Algorithms .........................41
13. Application Channel Binding ...................................42
14. Application for Proxy Authentication ..........................42
15. Methods to Extend This Protocol ...............................43
16. IANA Considerations ...........................................44
16.1. Addition to HTTP Authentication Schemes Registry .........44
16.2. Registry for Authentication Algorithms ...................44
16.3. Registry for Validation Methods ..........................45
17. Security Considerations .......................................46
17.1. Security Properties ......................................46
17.2. Secrecy of Credentials ...................................46
17.3. Denial-of-Service Attacks on Servers .....................47
17.3.1. Online Active Password Attacks ....................47
17.4. Communicating the Status of Mutual Authentication
with Users ...............................................48
17.5. Implementation Considerations ............................48
17.6. Usage Considerations .....................................49
18. References ....................................................49
18.1. Normative References .....................................49
18.2. Informative References ...................................51
Authors' Addresses ................................................53
To be continued in part 2 ๐ฆโจ
1. Introduction โจ
Okay bestie, this doc specifies an authentication scheme for HTTP (the Hypertext Transfer Protocol ๐ ). It's called the Mutual authentication scheme or the Mutual authentication protocol ๐. It gives you true mutual authentication between an HTTP client and an HTTP server using just a simple password as the credential ๐. No cap, that's iconic.
Password-stealing attacks are literally one of the most critical threats for Web systems ๐. Plain-text password auth (Basic auth and Web-form-based auth) has been around forever, and when it runs over plain HTTP it's trivially easy for attackers to sniff the password credentials off the wire ๐.
The Digest authentication scheme [RFC7616] uses SHA-256 and SHA-512/256 (formerly SHA-1 and MD5) hash algorithms to hide the raw user password from network sniffers ๐ฆ. But here's the catch: if the pool of possible candidate passwords isn't big enough, newer and more powerful computers can compute hash values for billions of password candidates and compare them with the sniffed values to find the right one. That's an offline password dictionary attack. The search capacity of these computers makes memorable passwords less effective, which threatens hash-based password protections. Ugh, I'm scared ๐ญ.
Transport Layer Security (TLS) [RFC5246] gives strong cryptographic protection against network-based sniffing of passwords and other communication contents ๐. If server operators and client users both use TLS correctly, passwords and other credentials won't be available to outside attackers โจ. BUT there's a pitfall on Web systems. If users get fraudulently routed to a "wrong Website" through social engineering (e.g., phishing) and tricked into authenticating there, the credentials get sent to the attacker's server and trivially leaked ๐ฑ. Phishing has become a serious threat. In current Web deployments, TLS certificates are issued to almost anyone on the Internet (including malicious attackers). Those certificates include several levels of "validation results" (like corporate names) for the issued entities, but "checking" those results is left to Web browser users, so the social engineering risk is still wide open ๐ .
Another way to dodge these threats is to skip password-based auth and use pre-deployed strong secret keys (on the client side or the server side) instead. Several federated authentication frameworks, plus HTTP Origin-Bound Authentication (HOBA) [RFC7486], are proposed and deployed on real Web systems to meet those needs ๐. However, auth based on "human-memorable secrets" (i.e., passwords) is still required in several scenarios, like initialization, key deployment to new clients, or recovering secret accounts with lost cryptographic keys ๐ง.
The Mutual authentication protocol proposed here is a strong cryptographic solution for password authentication ๐. It mainly provides the following two key features:
- No password information at all is exchanged in the communications. When the server and the user fail to authenticate with each other, the protocol won't reveal even the tiniest bit of information about the user's password. That blocks any kind of offline password dictionary attack, even when phishing is going on ๐ฅ.
- To successfully authenticate, the server, as well as client users, must own the valid registered credentials (authentication secret). So a phishing attacker can't trick users into thinking it's an "authentic" server. (It should be pointed out that this is not true for Basic and Digest authentication. For example, servers using Basic authentication can answer "YES" to any clients without actually checking authentication at all ๐.) Client users can ascertain whether the communicating peer is truly "the server" that registered their account beforehand. In other words, it provides "true" mutual authentication between servers and clients โจ.
Given all that, the proposed protocol can serve as a strong alternative to the Basic, Digest, and Web-form-based authentication schemes, and also as a strong companion to the non-password-based authentication frameworks ๐.
The proposed protocol serves in the same way existing Basic or Digest auth does: it meets the requirements for new authentication schemes for HTTP, as described in Section 5.1.2 of [RFC7235]. Also, to communicate authentication results more reliably between the server and the client user, it suggests that Web browsers have some "secure" way of displaying those results. Having that kind of user interface in future browsers greatly reduces the risk of impersonation by social engineering attacks, kinda like the "green padlock" for Extended Validation TLS certificates ๐.
Technically, the authentication scheme proposed here is a general framework for using password-based authenticated key exchange (PAKE) and similar stronger cryptographic primitives with HTTP ๐งช. The two key features above correspond to the nature of PAKE ๐.
1.1. Terminology
The key words "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 [RFC2119].
This document distinguishes the terms "client" and "user" in the following way. A "client" is an entity that understands and implements HTTP and the specified authentication protocol (usually computer software). A "user" is typically a human being who wants to access data resources using a "client" ๐ซถ.
The term "natural numbers" refers to the non-negative integers (including zero) throughout this document ๐ข.
This document treats both the input (domain) and the output (codomain) of hash functions as octet strings. When a natural number output for a hash function is required, it will be written as INT(H(s)) ๐งฎ.
1.2. Document Structure and Related Documents
The entire document is organized as follows ๐บ๏ธ:
- Section 2 presents an overview of the protocol design.
- Sections 3 through 11 define a general framework of the Mutual authentication protocol. This framework is independent of specific cryptographic primitives.
- Section 12 describes properties needed for cryptographic algorithms used with this protocol framework and defines a few functions that will be shared among such cryptographic algorithms.
- Sections 13 through 15 contain general normative and informative information about the protocol.
- Sections 16 and 17 describe IANA considerations and security considerations, respectively.
In addition, we'll refer to the following two companion documents, since they're related to this specification ๐:
- [RFC8121] defines cryptographic primitives that can be used with this protocol framework.
- [RFC8053] defines small but useful extensions to the current HTTP authentication framework so that it can support application-level semantics of existing Web systems.
2. Protocol Overview
The protocol, as a whole, is designed as a natural extension to HTTP [RFC7230] and uses the framework defined in [RFC7235] ๐ฆ. Internally, the server and the client will first perform a cryptographic key exchange, using the secret password as a "tweak" to the exchange. The key exchange only succeeds when the secrets used by both peers are correctly related (i.e., generated from the same password). Then both peers verify the authentication results by confirming the sharing of the exchanged key. This section gives a brief outline of the protocol and the exchanged messages ๐ .
2.1. Messages
The authentication protocol uses six kinds of messages to perform mutual authentication. These messages have specific names within this specification ๐จ.
- Authentication request messages: used by the servers to request that clients start mutual authentication.
401-INITmessage: a general message to start the authentication protocol. It is also used as a message indicating an authentication failure.401-STALEmessage: a message indicating that the client has to start a new key exchange.
- Authenticated key exchange messages: used by both peers to perform authentication and the sharing of a cryptographic secret ๐.
req-KEX-C1message: a message sent from the client.401-KEX-S1message: an intermediate response to areq-KEX-C1message from the server.
- Authentication verification messages: used by both peers to verify the authentication results โ
.
req-VFY-Cmessage: a message used by the client to request that the server authenticate and authorize the client.200-VFY-Smessage: a response used by the server to indicate that client authentication succeeded. It also contains information necessary for the client to check the authenticity of the server ๐.
In addition to the above six kinds of messages, a request or response without any HTTP headers related to this specification will be hereafter called a "normal request" or "normal response", respectively ๐ธ.
2.2. Typical Flows of the Protocol
2.2. Typical Flows of the Protocol ๐ฆ
okay so bestie, let's talk about the usual way a client gets into a resource guarded by the Mutual authentication scheme ๐ โจ it goes like this:
Client Server
| |
| ---- (1) normal request ---------> |
GET / HTTP/1.1 |
| |
| <---------------- (2) 401-INIT --- |
| 401 Unauthorized |
| WWW-Authenticate: Mutual realm="a realm"
| |
[user, | |
pass]-->| |
| ---- (3) req-KEX-C1 -------------> |
GET / HTTP/1.1 |
Authorization: Mutual user="john", |--> [user DB]
kc1="...", ... |<-- [user info]
| |
| <-------------- (4) 401-KEX-S1 --- |
| 401 Unauthorized |
| WWW-Authenticate: Mutual sid=..., ks1="...", ...
| |
[compute] (5) compute session secret [compute]
| |
| |
| ---- (6) req-VFY-C --------------> |
GET / HTTP/1.1 |--> [verify (6)]
Authorization: Mutual sid=..., |<-- OK
vkc="...", ... |
| |
| <--------------- (7) 200-VFY-S --- |
[verify | 200 OK |
(7)]<--| Authentication-Info: Mutual vks="..."
| |
v v
Figure 1: Typical Communication Flow for First Access to Resource
here's the play-by-play ๐
- okay so, as is totally typical for HTTP, the client first just asks for the resource with NO auth attempt (1) ๐ธ if the thing is guarded by Mutual, the server replies saying "hey, you need to authenticate" (401-INIT) (2) ๐
- the client reads that message and waits for the user to type in their username and password ๐ once it has them, it sends a message with the authenticated key exchange (req-KEX-C1) to kick off the auth (3) ๐ง
- when the server gets that req-KEX-C1, it checks the user's auth info in its user database ๐ then it makes a brand new session identifier (sid) to tag the messages that come after it, and replies with its own server-side authenticated key exchange value (401-KEX-S1) (4) ๐
- at this point (5), both peers work out a shared "session secret" using the values from the key exchange messages ๐ฅ the catch? the secrets only match if both the server and the client used credentials made from the same password ๐ซถ this session secret then gets used to authenticate every single request/response pair from here on out ๐
- the client sends a request carrying a client-side authentication verification value (req-VFY-C) (6), calculated from its session secret ๐ the server checks that value against its own copy of the session secret โจ
- if the client's verification value is correct, then the client definitely owns the credential for the expected password, so client auth succeeded ๐ฆ the server replies with a success message (200-VFY-S) (7) ๐ unlike the usual one-way stuff (like HTTP Basic authentication or POP APOP authentication [RFC1939]), this message ALSO carries a server-side authentication verification value ๐ญ
when the client's verification value is wrong (e.g., because the password the user typed was wrong), the server replies with a 401-INIT message instead (the same one used in (2)) ๐
- the client MUST check the server-side authentication verification value in the message (7) FIRST ๐ซถ if it matches the expected value, server auth succeeded ๐ธ
if it's not the expected value, or the message doesn't contain the authentication verification value at all, then mutual auth has broken for some unexpected reason ๐ in that case the client MUST NOT process any body or header values in the HTTP response ๐ (note: this shouldn't happen between a correctly implemented server and client without any active attacks; it could be caused by either a man-in-the-middle attack or incorrect implementation ๐)
2.3. Alternative Flows ๐
okay so the typical flow for a first auth request takes THREE request-response pairs ๐ญ to cut down on overhead, the protocol has a few shortcut flows that need fewer messages โจ
- Case A: if the client knows the resource will probably need auth, the client MAY skip the first unauthenticated request (1) and jump straight to sending a key exchange (req-KEX-C1) ๐ง this drops the round trips by one ๐ฅ
- Case B: if the client and server already shared a session secret tied to a valid sid, the client MAY directly send a req-VFY-C message using that existing sid and session secret ๐ this cuts another round trip ๐
the server MAY have already tossed that session out of its session table ๐ if so, it replies with a 401-STALE message, meaning a new key exchange is needed ๐ in that case the client SHOULD try again and build a req-KEX-C1 message ๐
figure 2 shows those shortcut flows ๐ฆ with the right settings and implementations, most requests to resources are expected to meet both criteria, so only one round trip of request/response is needed ๐
Case A: Omit first request
(2 round trips)
Client Server
| |
| --- req-KEX-C1 ----> |
| |
| <---- 401-KEX-S1 --- |
| |
| ---- req-VFY-C ----> |
| |
| <----- 200-VFY-S --- |
| |
Case B: Reuse session secret (re-authentication)
(B-1) key available (B-2) key expired
(1 round trip) (3 round trips)
Client Server Client Server
| | | |
| ---- req-VFY-C ----> | | --- req-VFY-C -------> |
| | | |
| <----- 200-VFY-S --- | | <------- 401-STALE --- |
| | | |
| --- req-KEX-C1 ------> |
| |
| <------ 401-KEX-S1 --- |
| |
| --- req-VFY-C -------> |
| |
| <------- 200-VFY-S --- |
| |
Figure 2: Several Alternative Protocol Flows
for more details, check out Sections 10 and 11 ๐ซถ
3. Message Syntax ๐
okay so the whole spec uses the extended augmented BNF syntax from [RFC7230] and [RFC5234] ๐ the elements pulled in from [RFC5234], [RFC7230], and [RFC7235] are: DIGIT, ALPHA, SP, auth-scheme, quoted-string, auth-param, header-field, token, challenge, and credentials ๐ฆ
the Mutual auth protocol uses three headers ๐ธ WWW-Authenticate (usually in responses with a 401 status code), Authorization (in requests), and Authentication-Info (in responses other than a 401 status code) ๐ these follow the frameworks from [RFC7235] and [RFC7615] โจ see Section 4 for more on these headers ๐ง
the framework in [RFC7235] defines the syntax for WWW-Authenticate and Authorization as the syntax elements "challenge" and "credentials" ๐ the auth-scheme in those headers MUST be set to "Mutual" when using this protocol ๐ฅ the syntax for "challenge" and "credentials" used with the "Mutual" auth-scheme SHALL be name-value pairs (#auth-param), NOT the "token68" parameter from [RFC7235] ๐
the Authentication-Info header used here SHALL follow the syntax from [RFC7615] ๐
in HTTP, the WWW-Authenticate header can contain two or more challenges ๐ client implementations SHOULD be aware of those cases and be capable of handling them correctly ๐ซถ
3.1. Non-ASCII Extended Header Parameters ๐
all the parameters in those three headers, except the "realm" field, MAY be extended to ISO 10646-1 values using the framework from [RFC5987] ๐ all servers and clients MUST be capable of receiving and sending values encoded per the syntax in [RFC5987] ๐ฅ
if a value to be sent only has ASCII characters, the field MUST be sent using plain syntax as defined in RFC 7235 ๐ฆ the RFC 5987 extended syntax MUST NOT be used in that case ๐
if a value (except for the "realm" header) has one or more non-ASCII characters, the parameter SHOULD be sent using the syntax in Section 3.2 of [RFC5987] as "ext-parameter" โจ such a parameter MUST have a charset value of "UTF-8", and the language value MUST always be omitted (empty value) ๐ง the same parameter MUST NOT be sent more than once, no matter which syntax is used ๐
for example, a parameter "user" with the value "Renee of France" SHOULD be sent as < user="Renee of France" > ๐ if the value is "Ren<e acute>e of France", it SHOULD be sent as < user*=UTF-8''Ren%C3%89e%20of%20France > instead ๐ธ
[RFC7235] requires that the "realm" parameter be in its plain form (not as an extended "realm*" parameter), so the syntax from RFC 5987 MUST NOT be used for this parameter ๐
3.2. Values ๐ฅ
the parameter values in challenges or credentials MUST be parsed in strict conformance with HTTP semantics (especially the unquoting of string parameter values) ๐ซถ in this protocol, those values fall into these value types: tokens (bare-token and extensive-token), string, integer, hex-fixed-number, and base64-fixed-number ๐
for clarity, it is RECOMMENDED that implementations use the canonical representations from the following subsections when sending values โจ however, recipients MUST accept both quoted and unquoted representations interchangeably, as HTTP specifies ๐ ๐ฆ
3.2.1. Tokens โจ
okay so tokens get a stricter look ๐ because this protocol needs to be secure AND extensible at the same time. It defines a tighter sub-syntax for the "token". Extensive-token values SHOULD use the syntax below (after HTTP values are parsed) ๐
bare-token = bare-token-lead-char *bare-token-char
bare-token-lead-char = %x30-39 / %x41-5A / %x61-7A
bare-token-char = %x30-39 / %x41-5A / %x61-7A / "-" / "_"
extension-token = "-" bare-token 1*("." bare-token)
extensive-token = bare-token / extension-token
Figure 3: BNF Syntax for Token Values
Tokens (bare-token and extension-token) are case insensitive ๐ธ Senders SHOULD send them in lowercase, and receivers MUST accept both upper and lower case. The lowercase rule is strict though ๐ญ When tokens are used as (partial) inputs to any hash functions or other mathematical functions, they MUST always be used in lowercase.
Extensive-tokens show up wherever the set of acceptable tokens might include non-standard extensions ๐ฆ Any extension of this protocol MAY use either the bare-tokens IANA allocates (check the procedure in Section 16), or extension-tokens with the format "-<bare-token>.<domain-name>". The <domain-name> has to be a valid (sub)domain name on the Internet that's owned by whoever defines the extension. Main character energy for the domain owner ๐
Bare-tokens and extensive-tokens are also used for parameter names, in the unquoted form. The rules for using an extension-token as a parameter name are the same as the ones in the paragraph above โจ
The canonical format for bare-tokens and extensive-tokens is the unquoted representation ๐
3.2.2. Strings ๐ง
All character strings MUST be encoded to octet strings using UTF-8 encoding [RFC3629] for the Unicode character set [Unicode] ๐ These strings MUST NOT contain any leading Byte Order Marks (BOMs), which are also known as ZERO WIDTH NO-BREAK SPACE, U+FEFF, or EF BB BF. No sneaky invisible characters at the front ๐ It is RECOMMENDED that both peers reject any invalid UTF-8 sequences that might cause decoding ambiguities. For example, that's a sequence containing <"> in the second or a later byte of a UTF-8 encoded character. Bad vibes, rejected ๐
If strings represent a domain name or URI that has non-ASCII characters, the host parts SHOULD be encoded the way the HTTP protocol layer uses them (for example, in a Host: header). Per current standards, the A-label as defined in [RFC5890] is what gets used. Lowercase ASCII characters SHOULD be used ๐
The canonical format for strings is quoted-string, since it can contain equals signs ("="), plus signs ("+"), and slashes ("/") ๐ That's true unless the parameter holding the string value uses extended syntax as defined in [RFC5987]. (Per [RFC5987], an extended parameter will have an unquoted encoded value. Such a plot twist ๐ซถ)
3.2.3. Numbers ๐ข
Here's the syntax the protocol uses for numeric values ๐
integer = "0" / (%x31-39 *DIGIT) ; no leading zeros
hex-fixed-number = 1*(2(DIGIT / %x41-46 / %x61-66))
base64-fixed-number = 1*( ALPHA / DIGIT / "+" / "/" ) 0*2"="
Figure 4: BNF Syntax for Numbers
The integer syntax only allows representations with no leading zeros. Zero stays zero, no extra padding ๐ง
A number written as a hex-fixed-number MUST include an even number of hexadecimal digits, so every value is a whole number of eight-bit chunks ๐ Those values are case insensitive and SHOULD be sent in lowercase โจ When these values come from any cryptographic values, they MUST have their "natural length". If they come from a hash function, their length matches the hash size. If they represent elements of a mathematical set (or group), their length SHALL be the shortest length that can represent all the elements in that set. For example, SHA-256 hash results are represented by 64 digits. Any element in a 2048-bit prime field (modulo a 2048-bit integer) is represented by 512 digits, no matter how many zeros show up in front of it ๐ Session identifiers and other values that weren't generated cryptographically can be any (even) length, as decided by whichever side generates it first. The same length MUST be used in all communications by both peers ๐ซถ
The numbers written as base64-fixed-number SHALL be generated like this ๐ฐ First, the number is converted to a big-endian radix-256 binary representation as an octet string. The length of that representation is decided the same way as in the technique above. Then the string gets base64 encoded (described in Section 4 of [RFC4648]), with no spaces or newlines. Implementations decoding base64-fixed-number SHOULD reject any input with invalid characters, excess or insufficient padding, or non-canonical pad bits. See Sections 3.1 through 3.5 of [RFC4648] for the details ๐
The canonical format for integer and hex-fixed-number is unquoted tokens. The canonical format for base64-fixed-number is quoted-string ๐ธ
4. Messages ๐
In this section we define the six kinds of messages in the authentication protocol, along with the formats and requirements for the headers of each type ๐ฌ
To figure out when each message is supposed to be sent, check Sections 10 and 11 ๐บ๏ธ
Below, the allowable value types for each header parameter are shown in parentheses after the parameter name. The "algorithm-determined" type means the acceptable value is one of the types defined in Section 3, and it's chosen by the value of the "algorithm" parameter ๐ง Parameters marked "mandatory" SHALL be contained in the message. Parameters marked "non-mandatory" MAY either be in the message or left out of it. Each parameter SHALL appear in each header exactly once at most ๐ฅ
All credentials and challenges MAY contain any parameters not explicitly specified in the following sections. Recipients that don't understand those parameters MUST silently ignore them ๐ซง However, all credentials and challenges MUST meet the following criteria:
- For responses, the parameters "reason", any
ks#(where#stands for any decimal integer), andvksare mutually exclusive. Any challenges MUST NOT contain two or more parameters among them. They MUST NOT contain anykc#orvkcparameters ๐ซ - For requests, the parameters
kc#(where#stands for any decimal integer) andvkcare mutually exclusive. Any challenges MUST NOT contain two or more parameters among them. They MUST NOT contain anyks#orvksparameters ๐ซ
Every message defined in this section contains a version field, so future incompatible revisions of the protocol can be detected ๐ฎ Implementations of the protocol described in this specification MUST always send the token 1 to represent the version number. Recipients MUST reject messages that contain any other value for the version, unless another specification defines specific behavior for that version ๐
4.1. 401-INIT and 401-STALE โจ
okay bestie, so every 401-INIT or 401-STALE message SHALL be a valid HTTP 401 (Unauthorized) status message (or some other 4xx status message, if appropriate) with one and only one (hereafter not explicitly noted) WWW-Authenticate header that has a reason parameter in the challenge. The challenge SHALL contain all the "mandatory" parameters below and MAY contain the "non-mandatory" ones ๐
version: (mandatory extensive-token) should be the token"1". ๐algorithm: (mandatory extensive-token) picks the authentication algorithm to use. The value MUST be one of the tokens specified in [RFC8121] or another supplemental specification. ๐งvalidation: (mandatory extensive-token) picks the method of host validation. The value MUST be one of the tokens described in Section 7 or the tokens specified in another supplemental specification. ๐ฆauth-scope: (non-mandatory string) is the authentication scope, meaning the set of hosts where the credentials are valid. It MUST be one of the strings described in Section 5. If the value is omitted, it is assumed to be the "single-server type" domain as described in Section 5. ๐ธrealm: (mandatory string) is the name of the authentication realm inside the authentication scope. As specified in [RFC7235], this value MUST always be sent in the quoted-string form, and an encoding as specified in [RFC5987] MUST NOT be used. ๐
The realm value from the server SHOULD be an ASCII string. Clients MAY treat any non-ASCII value they get in this field as a binary blob, an NFC-normalized UTF-8 string ("NFC" stands for "Normalization Form C"), or an error. ๐
reason: (mandatory extensive-token) SHALL be an extensive-token that describes the possible reason the authentication or authorization failed. Both servers and clients SHALL understand and support these three tokens: โญinitial: Authentication was not attempted because there was noAuthorizationheader in the corresponding request.stale-session: Thesidin the request was either unknown to the server or expired on the server.auth-failed: The authentication attempt failed for some reason, possibly because of a bad credential.
Implementations MAY support the following tokens or any extensive-tokens defined outside this specification. If clients receive any unknown tokens, they SHOULD treat them as if they were "auth-failed" or "initial". ๐
reauth-needed: The server-side application requires a new authentication attempt, no matter what the current status is.invalid-parameters: The server did not attempt authentication because some parameters were not acceptable.internal-error: The server did not attempt authentication because of a problem on the server side.user-unknown: This is a special case ofauth-failedthat suggests the provided username is invalid. Due to security implications, the use of this parameter is NOT RECOMMENDED, except for special-purpose applications where it would make sense to do so. ๐invalid-credential: This is another special case ofauth-failedthat suggests the provided username was valid but authentication still failed. For security reasons, the use of this parameter is NOT RECOMMENDED. ๐authz-failed: Authentication succeeded, but the specific authenticated user is not authorized to access the specified resource. (It might be used along with either a 401 (Unauthorized) or 403 (Forbidden) status code to show that the authentication result is one of the existing reasons for the failed authorization.) ๐
It is RECOMMENDED that the reason for failure be recorded in some type of diagnostic log, shown to the client user immediately, or both. It will be super helpful to figure out later whether the failure was technical or caused by user error. ๐
The algorithm specified in this header will decide the types (among those defined in Section 3) and the values for K_c1, K_s1, VK_c, and VK_s. โจ
Okay so here's the naming bit: any messages with the "reason" parameter value "stale-session" are called "401-STALE" messages from here on, because they have a special meaning in the protocol flow. Messages with any other "reason" parameter are called "401-INIT" messages. ๐ฆ
4.2. req-KEX-C1 ๐
Every req-KEX-C1 message SHALL be a valid HTTP request message that contains an Authorization header with a credential containing a "kc1" parameter. ๐ซถ
The credential SHALL contain the parameters with these names:
version: (mandatory, extensive-token) should be the token"1". ๐algorithm,validation,auth-scope,realm: MUST be the same values as the ones received from the server. ๐ธuser: (mandatory, string) is the UTF-8 encoded name of the user. The string SHOULD be prepared according to the method presented in Section 9. ๐kc1: (mandatory, algorithm-determined) is the client-side key exchange valueK_c1, which is specified by the algorithm in use. ๐ฅ
4.3. 401-KEX-S1 ๐ง
Every 401-KEX-S1 message SHALL be a valid HTTP 401 (Unauthorized) status response message that contains a WWW-Authenticate header with a challenge containing a "ks1" parameter. ๐
The challenge SHALL contain the parameters with these names:
version: (mandatory, extensive-token) should be the token"1". ๐algorithm,validation,auth-scope,realm: MUST be the same values as the ones received from the client. ๐ธsid: (mandatory, hex-fixed-number) MUST be a session identifier, which is a random integer. ThesidSHOULD have uniqueness of at least 80 bits or the square of the maximum estimated transactions concurrently available in the session table, whichever is larger. See Section 6 for more details. ๐ks1: (mandatory, algorithm-determined) is the server-side key exchange valueK_s1, which is specified by the algorithm. ๐ฆnc-max: (mandatory, integer) is the maximum value of nonce numbers that the server accepts. ๐nc-window: (mandatory, integer) is the number of available nonce number slots that the server will accept. It is RECOMMENDED that the value of the"nc-window"parameter be 128 or more. โญtime: (mandatory, integer) is the suggested time (in seconds) that the client can reuse the session represented by thesid. It is RECOMMENDED that the time be set to at least 60 (seconds). However, the server is not required to guarantee that the session represented by thesidwill still be available (e.g., alive, usable) for the time specified in this parameter. โฐpath: (non-mandatory, string) specifies which path in the URI space the same authentication is expected to be applied to. The value is a space-separated list of URIs, in the same format as the one specified in the"domain"parameter [RFC7616] for Digest authentications. All path elements contained in the"path"parameter MUST be inside the specified auth-scope; if they are not, clients SHOULD ignore those elements. For better performance, it is important that clients recognize and use this parameter. ๐
4.4. req-VFY-C ๐
Every req-VFY-C message SHALL be a valid HTTP request message that contains an Authorization header with a credential containing a "vkc" parameter. ๐ซถ
The parameters in the header are as follows:
version: (mandatory, extensive-token) should be the token"1". ๐algorithm,validation,auth-scope,realm: MUST be the same values as the ones received from the server for the session. ๐ธsid: (mandatory, hex-fixed-number) MUST be one of thesidvalues received from the server for the same authentication realm. ๐nc: (mandatory, integer) is a nonce request number that is unique among the requests sharing the samesid. The values of the nonce numbers SHOULD satisfy the properties outlined in Section 6. ๐ขvkc: (mandatory, algorithm-determined) is the client-side authentication verification valueVK_c, which is specified by the algorithm. โ
4.5. 200-VFY-S ๐ฆ
Every 200-VFY-S message SHALL be a valid HTTP message that does not have a 401 (Unauthorized) status code, and it SHALL contain an Authentication-Info header with a "vks" parameter. ๐
The parameters in the header are as follows:
version: (mandatory, extensive-token) should be the token"1". ๐sid: (mandatory, hex-fixed-number) MUST be the value received from the client. ๐vks: (mandatory, algorithm-determined) is the server-side authentication verification valueVK_s, which is specified by the algorithm. ๐ง
The header MUST be sent before the content body, and it MUST NOT be sent in the trailer of a chunked-encoded response. ๐ซ If a "100 (Continue)" [RFC7231] response is sent from the server, the Authentication-Info header SHOULD be included in that response instead of the final response. ๐
5. Authentication Realms ๐
okay so bestie, let's talk realms ๐ธ In this protocol, an authentication realm is a set of resources (URIs) where the same set of usernames and passwords works. If the server asks for auth for a realm the client is already logged into, the client will automatically handle it with the credentials it already has โจ But for different realms, clients MUST NOT automatically reuse usernames and passwords for another realm. Not cute, not allowed ๐
Like Basic and Digest access auth, the Mutual authentication protocol supports multiple, separate protection spaces inside each host ๐ฆ And it's giving flexibility: a single authentication realm can span several hosts within the same Internet domain ๐ง
Each realm is defined and distinguished by a triple of an authentication algorithm, an authentication scope, and a "realm" parameter ๐ Lowkey, it is NOT RECOMMENDED that server operators use the same pair of an authentication scope and a realm with different authentication algorithms ๐
The "realm" parameter is a string as defined in Section 4. The scopes are described in the rest of this section, so keep reading bestie ๐
An authentication scope specifies the range of hosts the realm spans ๐ In this protocol, it MUST be one of the following kinds of strings:
- Single-server type: A string in the format
"<scheme>://<host>"or"<scheme>://<host>:<port>", where<scheme>,<host>, and<port>are the corresponding URI parts of the request URI. If the default port (i.e., 80 for HTTP and 443 for HTTPS) is used for the underlying HTTP communications, the port part MUST be omitted, regardless of whether it was present in the request URI. In all other cases, the port part MUST be present, and it MUST NOT contain leading zeros. Use this format when auth is only valid for a specific protocol (such as HTTPS). This format is equivalent to the ASCII serialization of a Web origin, as presented in Section 6.2 of [RFC6454]. ๐ - Single-host type: The "host" part of the requested URI. This is the default value โจ Realms within this kind of scope will span several protocols (e.g., HTTP and HTTPS) and ports but will not span different hosts. ๐ธ
- Wildcard-domain type: A string in the format
"*.<domain-postfix>", where<domain-postfix>is either the host part of the requested URI or any domain in which the requested host is included (so"*.example.com"is valid for all ofwww.example.com,web.example.com,www.sales.example.com, andexample.com). The domain-postfix sent by the servers MUST be equal to or included in a valid Internet domain assigned to a specific organization. If clients know, via some means such as a blacklist for HTTP cookies [RFC6265], that the specified domain is not assigned to any specific organization (e.g.,"*.com"or"*.jp"), it is RECOMMENDED that clients reject the authentication request. ๐ซ
In the above specifications, every "scheme", "host", and "domain" MUST be in lower case ๐ฅ Any internationalized domain names beyond the ASCII character set SHALL be represented the way they are sent in the underlying HTTP protocol, in lowercase characters. In other words, they SHALL be in the form of LDH ("letters, digits, hyphen") labels as defined in the Internationalized Domain Names for Applications (IDNA) specification [RFC5890]. A "port" MUST be given in shortest unsigned decimal number notation. Not obeying these requirements will cause valid authentication attempts to fail, so please be careful bestie ๐ญ๐
5.1. Resolving Ambiguities ๐
In the above definitions of authentication scopes, several scopes may overlap each other ๐ If a client has already been authenticated to several realms applicable to the same server, the client may have multiple lists of the "path" parameters received with the "401-KEX-S1" message (see Section 4). If these path lists have any overlap, a single URI may belong to multiple possible candidate realms the client can be authenticated to. In such cases, clients face an ambiguous choice about which credentials to send for a new request (see Steps 3 and 4 of the decision procedure presented in Section 10). Messy, but we can handle it ๐
In such cases, a client MAY freely send requests that belong to any of these candidate realms, or it MAY simply send an unauthenticated request and see which realm the server asks for auth on ๐ฆ It is RECOMMENDED that server operators provide properly configured "path" parameters (more precisely, disjoint path sets for each realm) for clients so these ambiguities never happen ๐ง
The following procedure is one possible tactic for resolving ambiguities in such cases:
- If the client has previously sent a request to the same URI and it remembers the authentication realm requested by the 401-INIT message at that time, use that realm. ๐
- In other cases, use one of the authentication realms representing the most-specific authentication scopes. The list of possible domain specifications shown above is given from most specific to least specific. If there are several choices with different wildcard-domain specifications, the one that has the longest domain-postfix has priority over those with shorter domain-postfixes. ๐
- If there are realms with the same authentication scope, there is no defined priority; the client MAY choose any one of the possible choices. ๐
6. Session Management ๐ง
In the Mutual authentication protocol, a session represented by an sid is set up using four messages (first request, 401-INIT, req-KEX-C1, and 401-KEX-S1). After that, a session secret (z) associated with the session is established. Once the session secret is mutually established, the session, along with the secret, can be used for one or more requests for resources protected by the same realm on the same server โจ Note that session management is only an inside detail of the protocol and usually not visible to normal users. If a session expires, the client and server SHOULD automatically re-establish another session without informing the user ๐ซถ
Sessions and session identifiers are local to each server (defined by scheme, host, and port), even if an authentication scope covers multiple servers. Clients MUST establish separate sessions for each port of a host being accessed. Furthermore, sessions and identifiers are also local to each authentication realm, even if they are provided by the same server. The same session identifiers provided either from different servers or for different realms MUST be treated as independent of each other ๐
The server SHOULD accept at least one req-VFY-C request for each session, if the request reaches the server in a time window specified by the "timeout" parameter in the 401-KEX-S1 message and there are no emergent reasons (such as flooding attacks) to forget the session. After that, the server MAY discard any session at any time, and MAY send 401-STALE messages for any further req-VFY-C requests received for that session ๐
The client MAY send two or more requests using a single session specified by the sid. However, for all such requests, each value of the nonce number (in the "nc" parameter) MUST satisfy the following conditions:
- It is a natural number.
- The same nonce number was not sent within the same session.
- It is not larger than the nc-max value that was sent from the server in the session represented by the sid.
- It is larger than (largest-nc - nc-window), where largest-nc is the largest value of nc that was previously sent in the session and nc-window is the value of the "nc-window" parameter that was received from the server for the session.
The last condition lets servers reject any nonce numbers that are "significantly" smaller than the "current" value (defined by the value of nc-window) of the nonce number used in the session involved. In other words, servers MAY treat such nonce numbers as "already received". This restriction lets servers implement duplicate-nonce detection in a constant amount of memory for each session ๐ง โจ
Servers MUST check for duplication of the received nonce numbers. If any duplication is detected, the server MUST discard the session and respond with a 401-STALE message, as outlined in Section 11 ๐ญ The server MAY also reject other invalid nonce numbers (such as those above the nc-max limit) by sending a 401-STALE message ๐ โโ๏ธ
For example, assume that the nc-window value of the current session is 128 and nc-max is 400, and that the client has already used the following nonce numbers: {1-120, 122, 124, 130-238, 255-360, 363-372}. The nonce number that can then be used for the next request is a number from the following set: {245-254, 361, 362, 373-400}. The values {0, 121, 123, 125-129, 239-244} MAY be rejected by the server because they are not above the current "window limit" (244 = 372 - 128) ๐๐
Typically, clients can ensure the above property by using a monotonically increasing integer counter that counts from zero up to the value of nc-max ๐ฆ
The values of the nonce numbers and any nonce-related values MUST always be treated as natural numbers within an infinite range. Implementations that use fixed-width integer representations, fixed-precision floating-point numbers, or similar representations SHOULD NOT reject any larger values that overflow such representative limits, and MUST NOT silently truncate them using any modulus-like rounding operation (e.g., by mod 2^32). Instead, the whole protocol is carefully designed so that recipients MAY replace any such overflowing values (e.g., 2^80) with some reasonably large maximum representative integer (e.g., 2^31 - 1 or others). Main character energy for big numbers ๐๐
7. Host Validation Methods โจ
okay so this section is literally where the protocol makes sure the mutual authentication is bound to the connection it's happening on ๐ like, "relate" or "bind" it to the other authentications already done in the layers underneath, so a man-in-the-middle can't just sneak in and ruin the vibe ๐ โโ๏ธ and it gives us the value vh, which is an input to the auth protocols. the main character here is the validation method, bestie ๐
When HTTPS or another possible secure transport is used, this is basically the idea of "channel binding" from [RFC5929] ๐ Even when it's plain HTTP, there's a somewhat limited version of binding going on, so a malicious server can't pretend to be you to another server by forwarding the credentials it got. not on my watch ๐ค
The valid tokens for the "validation" parameter, and their vh values, are:
host: hostname validation ๐ธ The value vh is the ASCII string in this format: "<scheme>://<host>:<port>", where <scheme>, <host>, and <port> are the URI components for the server-side resource being accessed. The scheme and host are lowercase, and the port is in shortest decimal notation. Even if the request URI has no port part, vh still includes the default port number. ๐
tls-server-end-point: TLS endpoint (certificate) validation ๐ฆ The value vh is the octet string of the hash of the server's public key certificate used in the underlying TLS [RFC5246] connection, processed as specified in Section 4.1 of [RFC5929].
tls-unique: TLS shared-key validation ๐ The value vh is the channel-binding material derived from the Finished messages, as defined in Section 3.1 of [RFC5929]. (Note: see Section 7.2 for some security-related notes on this one, it's important ๐)
If HTTP is used on a non-encrypted channel (TCP and the Stream Control Transmission Protocol (SCTP), for example), the validation type MUST be "host". If HTTP/TLS [RFC2818] (HTTPS) is used with a server certificate, the validation type MUST be "tls-server-end-point". If HTTP/TLS is used with an anonymous Diffie-Hellman key exchange, the validation type MUST be "tls-unique" (see the note below). ๐ซถ
If the validation type "tls-server-end-point" is used, the server certificate provided in the TLS connection MUST be verified, at least to make sure the server actually owns the corresponding private key. (Note: this verification is automatic in some RSA-based key exchanges, but it is NOT automatic in Diffie-Hellman-based key exchanges with separate exchanges for server verification. ๐ญ so don't assume it happened!)
Clients MUST validate this parameter upon receipt of 401-INIT messages. ๐จ
Note: the protocol defines two variants of validation on TLS connections. The "tls-unique" method is technically more secure ๐ฅ However, there are some situations where "tls-server-end-point" is preferable:
- When TLS accelerating proxies are used. In this case, it's hard for the authenticating server to get the TLS key information used between the client and the proxy. This is not the case for client-side "tunneling" proxies using the HTTP CONNECT method.
- When a black-box implementation of the TLS protocol is used on either peer.
7.1. Applicability Notes ๐ง
When the client is a Web browser with any scripting capabilities (support of dynamic contents), the underlying TLS channel used with HTTP/TLS MUST provide server identity verification. This means that (1) anonymous Diffie-Hellman key exchange cipher suites MUST NOT be used and (2) verification of the server certificate provided by the server MUST be performed. This is to prevent loading identity-unauthenticated scripts or dynamic contents that are referenced from the authenticated page. ๐
For other systems, when the underlying TLS channel used with HTTP/TLS does not perform server identity verification, the client SHOULD ensure that all responses are validated using the Mutual authentication protocol, regardless of whether 401-INIT responses exist. ๐
7.2. Notes on "tls-unique" ๐
As described in the interoperability note in Section 3.1 of [RFC5929], the "tls-unique" verification value will be changed by possible TLS renegotiation, which causes an interoperability problem. TLS renegotiations are used in several HTTPS server implementations to enforce some security properties (such as cryptographic strength) for specific responses. ๐คฏ
If an implementation supports the "tls-unique" verification method, the following precautions SHOULD be taken:
- Both peers must be aware that the vh values used for vkc (in req-VFY-C messages) and vks (in 200-VFY-S messages) may be different. These values MUST be retrieved from underlying TLS libraries each time they are used.
- After calculating the values vh and vkc to send a req-VFY-C request, clients SHOULD NOT initiate TLS renegotiation until the end of the corresponding response header is received. An exception is that clients can and SHOULD perform TLS renegotiation as a response to the server's request for TLS renegotiation, before receipt of the beginning of the response header. ๐
Also, implementers MUST take care of session resumption attacks regarding "tls-unique" channel-binding mechanisms and master secrets. As a mitigation, the TLS extension defined in [RFC7627] SHOULD be used when "tls-unique" host verification is to be used. ๐
8. Authentication Extensions ๐
It is RECOMMENDED that interactive clients (e.g., Web browsers) supporting this protocol support non-mandatory authentication and the Authentication-Control header defined in [RFC8053], except for the "auth-style" parameter. This specification also proposes (but does not mandate) that the default "auth-style" be "non-modal". Web applications SHOULD, however, consider the security impacts of the behavior of clients that do not support these headers. ๐
Authentication-initializing messages with the Optional-WWW-Authenticate header are used only where the 401-INIT response is valid. They will not replace other 401-type messages such as 401-STALE and 401-KEX-S1. That is, the "reason" field of such a message MUST be "initial" (or any extensive-tokens NOT defined in Section 4.1). โจ
9. String Preparation ๐ซง
For interoperability reasons, it's important that usernames and passwords used in this protocol are binary-comparable, no matter the user's input method or environment. To make sure of this, the following preparation SHOULD be performed:
- Usernames received from users SHOULD be prepared using the
"UsernameCasePreserved"profile defined in Section 3.3 of [RFC7613]. - Passwords received from users SHOULD be prepared using the
"OpaqueString"profile defined in Section 4.2 of [RFC7613].
In both cases, it's the sender's job to correctly prepare the character strings. If a non-prepared character string is received from the other peer of the communication, the behavior of its recipient is not defined; the recipient MAY either accept or reject such input. ๐คทโโ๏ธ
Server applications SHOULD also prepare usernames and passwords accordingly upon registration of user credentials. ๐ธ
In addition, binary-based "interfaces" of implementations MAY require and assume that the string is already prepared accordingly. When a string is already stored as a binary Unicode string form, implementations MAY omit preparation and Unicode normalization (performing UTF-8 encoding only) before using it. When a string is already stored as an octet blob, implementations MAY send it as is. ๐ฆ
10. Decision Procedure for Clients ๐ง
10.1. General Principles and Requirements ๐ก๏ธ
okay bestie, so the client has to be SUPER careful about which authenticated responses it accepts from the server ๐ The same goes for a "normal response" (aka one that has no mutual-authentication headers) coming back from HTTP servers. ๐
Per typical HTTP auth, one user-level request can turn into two or more HTTP request/response pairs in a row โจ The following normative rules MUST be followed by clients implementing this protocol:
- Any kind of "normal response" MUST only be accepted for the very first request in the sequence. Any "normal response" returned for the second or subsequent requests in the sequence SHALL be considered invalid. ๐ โโ๏ธ
- By the same principle, if any response is related to an authentication realm that is different from that of the client's request (for example, a
401-INITmessage requesting authentication on another realm), it MUST only be accepted for the very first request in the sequence. Such a response returned for a second or subsequent request in the sequence SHALL be considered invalid. ๐ - A
req-KEX-C1message MAY be sent as either an initial request or a response to a401-INITor401-STALEmessage. However, to avoid infinite loops of messages, thereq-KEX-C1message SHOULD NOT be sent more than once in the sequence for a single authentication realm. A401-KEX-S1response MUST be accepted only when the corresponding request isreq-KEX-C1. ๐ - A
req-VFY-Cmessage MAY be sent if there is a valid session secret shared between the client and the server, as established byreq-KEX-C1and401-KEX-S1messages. If any response with a 401 status code is returned for such a message, the corresponding session secret SHOULD be discarded as unusable.
In particular, upon the reception of a 401-STALE response, the client SHOULD try to establish a new session by sending a req-KEX-C1 message, but only once within the request/response sequence. ๐ธ
- A
200-VFY-Smessage MUST be accepted only as a response to areq-VFY-Cmessage and nothing else. TheVK_svalues of such response messages MUST always be checked against the correct value, and if it is incorrect, the whole response SHOULD be considered invalid. ๐
The final status of the client request following the message exchange sequence shall be determined as follows: ๐
AUTH-SUCCEED: A200-VFY-Smessage with the correctVK_svalue was returned in response to thereq-VFY-Crequest in the sequence. ๐AUTH-REQUIRED: Two cases exist:- A
401-INITmessage was returned from the server, and the client does not know how to authenticate to the given authentication realm. - A
401-INITresponse was returned for areq-VFY-C(orreq-KEX-C1) message, which means that the user-supplied authentication credentials were not accepted. ๐
- A
UNAUTHENTICATED: A "normal response" is returned for an initial request of any kind in the sequence. ๐ฅ
Any kind of response (including a "normal response") other than those explicitly allowed in the above rules SHOULD be interpreted as a fatal communication error ๐ In such cases, the clients MUST NOT process any data (the response body and other content-related headers) sent from the server. However, to handle exceptional error cases, clients MAY accept a message without an Authentication-Info header if it has a Server Error (5xx) status code. In such cases, they SHOULD be careful about processing the body of the content (ignoring it is still RECOMMENDED, as it may possibly be forged by intermediate attackers), and the client will then have a status of "UNAUTHENTICATED". ๐ซฃ
If a request is a sub-request for a resource included in another resource (e.g., embedded images, style sheets, frames), clients MAY treat an AUTH-REQUESTED status the same way they would treat an UNAUTHENTICATED status. In other words, the client MAY ignore the server's request to start authentication with new credentials via sub-requests. โจ
10.2. State Machine for the Client (Informative) ๐ฆ
Okay bestie, this part is the state machine, which is basically the whole client flow as a map ๐บ๏ธโจ It's informative, so it's a super helpful picture of the normative rules from above, not new rules. If implementers aren't 100% sure what the security consequences of those rules are, we strongly advise following this decision procedure ๐ Clients SHOULD NOT accept "normal responses" unless the rules explicitly allow it, so don't be that dev ๐ The step labels are just for reference, and the action entries in each step get checked top to bottom. The first clause that matches is the one you follow ๐ซถ
Step 1 (step_new_request): If the client software needs to access a new Web resource, check whether that resource is expected to be inside some authentication realm where the user has already been authenticated via the Mutual authentication scheme. If yes, go to Step 2. Otherwise, go to Step 5. ๐ธ
Step 2: Check whether there is an available sid for the expected authentication realm. If there is one, go to Step 3. Otherwise, go to Step 4. ๐ง
Step 3 (step_send_vfy_1): Send a req-VFY-C request.
- If a 401-INIT message is received with a different authentication realm than expected, go to Step 6.
- If a 401-STALE message is received, go to Step 9.
- If a 401-INIT message is received, go to Step 13.
- If a 200-VFY-S message is received, go to Step 14.
- If a "normal response" is received, go to Step 11.
Step 4 (step_send_kex1_1): Send a req-KEX-C1 request.
- If a 401-INIT message is received with a different authentication realm than expected, go to Step 6.
- If a 401-KEX-S1 message is received, go to Step 10.
- If a 401-INIT message is received with the same authentication realm, go to Step 13 (see Note 1).
- If a "normal response" is received, go to Step 11.
Step 5 (step_send_normal_1): Send a request without any mutual-authentication headers.
- If a 401-INIT message is received, go to Step 6.
- If a "normal response" is received, go to Step 11.
Step 6 (step_rcvd_init): Check whether the user's password for the requested authentication realm is known. If yes, go to Step 7. Otherwise, go to Step 12. ๐
Step 7: Check whether there is an available sid for the expected authentication realm. If there is one, go to Step 8. Otherwise, go to Step 9. ๐
Step 8 (step_send_vfy): Send a req-VFY-C request.
- If a 401-STALE message is received, go to Step 9.
- If a 401-INIT message is received, go to Step 13.
- If a 200-VFY-S message is received, go to Step 14.
Step 9 (step_send_kex1): Send a req-KEX-C1 request.
- If a 401-KEX-S1 message is received, go to Step 10.
- If a 401-INIT message is received, go to Step 13 (see Note 1).
Step 10 (step_rcvd_kex1): Send a req-VFY-C request.
- If a 401-INIT message is received, go to Step 13.
- If a 200-VFY-S message is received, go to Step 14.
Step 11 (step_rcvd_normal): The requested resource is out of the authenticated area, so the client will be in the "UNAUTHENTICATED" status ๐ If the response contains a request for authentication other than Mutual authentication, it MAY be handled normally.
Step 12 (step_rcvd_init_unknown): The requested resource requires Mutual authentication, and the user isn't authenticated yet, so the client will be in the "AUTH-REQUESTED" status. It is RECOMMENDED that the client process the content sent from the server and ask the user for a username and password ๐ Once the user supplies those, go to Step 9.
Step 13 (step_rcvd_init_failed): The authentication failed for some reason, possibly because the password or username is invalid for the authenticated resource ๐ Forget the user-provided credentials for the authentication realm, and go to Step 12.
Step 14 (step_rcvd_vfy): The received message is the 200-VFY-S message, which always contains a "vks" field โจ Check whether the received VK_s value is valid. If it equals the expected value, then the mutual authentication succeeded, and the client will be in the "AUTH-SUCCEED" status ๐
An unexpected value is interpreted as a fatal communication error. ๐ญ
If a user explicitly asks to log out (via the user interface), the client MUST forget the user's password, go to Step 5, and reload the current resource without an authentication header. ๐ช
Note 1: These transitions MAY be accepted by clients, but it is NOT RECOMMENDED that servers initiate them. ๐ โโ๏ธ
Figure 5 shows an informative diagram of the client state. ๐ฆ
=========== -(11)------------
NEW REQUEST ( UNAUTHENTICATED )
=========== -----------------
| ^ normal
v | response
+(1)-------------------+ NO +(5)----------+
| The requested URI |--------------------------->| send normal |
| known to be auth'ed? | | request |
+----------------------+ +-------------+
YES | 401-INIT 401-INIT|
| with a different realm |
| -----------------------------------. |
| / v v
| | -(12)------------ NO +(6)--------+
| | ( AUTH-REQUESTED )<------| user/pass |
| | ----------------- | known? |
| | +-----------+
| | |YES
v | v
+(2)--------+ | +(7)--------+
| session | | | session | NO
NO /| available?| | | available?|\
/ +-----------+ | +-----------+ |
/ |YES | |YES |
| | /| | |
| v / | 401- 401- v |
| +(3)--------+ | INIT --(13)---------- INIT +(8)--------+ |
| | send |--+----->/ AUTH-REQUESTED \<-------| send | |
| /| req-VFY-C | | \forget password / | req-VFY-C | |
\/ +-----------+ / ---------------- /+-----------+ |
/\ \ \/ ^ 401-INIT | |401- |
| ------ \/\ 401-STALE | | | STALE /
| \ /\ -----------------+--------------+---. | /
| | / \ | | | | /
| v / | 401- | 401- | v v v
| +(4)--------+ | KEX-S1 +(10)-------+ KEX-S1 | +(9)--------+
| | send |-|--------->| send |<-------+-| send |
| --| req-KEX-C1| | | req-VFY-C | | | req-KEX-C1|
|/ +-----------+ | +-----------+ | +-----------+
| |200-VFY-S | 200-VFY-S| ^
|normal | |200-VFY-S / |
|response | v / ==================
v \ -(14)--------- / USER/PASS INPUTTED
-(11)------------ ------->( AUTH-SUCCEED )<-- ==================
( UNAUTHENTICATED ) --------------
-----------------
Figure 5: State Diagram for Clients ๐
11. Decision Procedure for Servers ๐
okay so the server side is where the magic happens ๐ every server SHOULD keep a table of session states ๐๏ธ. it doesn't have to stick around forever, so it MAY get wiped on a restart, a reboot, or for other reasons. each entry in that table SHOULD have at least this stuff:
- The session identifier, which is the value of the
sidparameter. - The algorithm used.
- The authentication realm.
- The state of the protocol: one of "key exchanging", "authenticated", "rejected", or "inactive".
- The username received from the client.
- A boolean flag indicating whether or not the session is fake.
- When the state is "key exchanging", the values of K_c1 and S_s1.
- When the state is "authenticated", the following information:
- The value of the session secret (z).
- The largest nc received from the client (largest-nc).
- For each possible nc value between (largest-nc - nc-window + 1) and max_nc, a boolean flag indicating whether or not a request with the corresponding nc has been received.
the table MAY have other info too ๐ธ
now the fun part, how servers respond to requests ๐ฆ servers SHOULD follow this procedure (see Note 1 below about 401-INIT messages with a plus sign โจ):
- When the server receives a "normal request":
- If the requested resource is not protected by the Mutual authentication, send a "normal response".
- If the resource is protected by the Mutual authentication, send a 401-INIT response.
- When the server receives a req-KEX-C1 request:
- If the requested resource is not protected by the Mutual authentication, send a "normal response".
- If the authentication realm specified in the req-KEX-C1 request is not the expected realm, send a 401-INIT response.
- If the server cannot validate the parameter "kc1", send a 401-INIT (+) response.
- If the received username is either invalid, unknown, or unacceptable, create a new session, mark it as a "fake" session, compute a random value as K_s1, and send a fake 401-KEX-S1 response (see Note 2) ๐
- Otherwise, create a new session, compute K_s1, and send a 401-KEX-S1 response. The created session is marked as not fake, and its largest-nc value is initialized to zero.
- The created session is in the "key exchanging" state.
- When the server receives a req-VFY-C request:
- If the requested resource is not protected by the Mutual authentication, send a "normal response".
- If the authentication realm specified in the req-VFY-C request is not the expected realm, send a 401-INIT response.
if none of the above is true, the server looks up the session that matches the received sid and the authentication realm ๐
- If the session corresponding to the received sid could not be found or it is in the "inactive" state, send a 401-STALE response.
- If the session is in the "rejected" state, send either a 401-INIT (+) response or a 401-STALE message.
- If the nc value in the request is larger than the "nc-max" parameter sent from the server or it is not larger than (largest-nc - nc-window) (when in the "authenticated" state), the server MAY (but is not REQUIRED to; see Note 3) send a 401-STALE message. The session is changed to the "inactive" state if the 401-STALE message was sent.
- If the session is in the "authenticated" state and the request has an nc value that was previously received from the client, send a 401-STALE message. The session is changed to the "inactive" state.
- If the session is a "fake" session or the received vkc is incorrect, then send a 401-INIT (+) response. If the session is in the "key exchanging" state, it MUST be changed to the "rejected" state; otherwise, it MAY be either changed to the "rejected" state or kept in the previous state. ๐
- Otherwise, send a 200-VFY-S response. If the session was in the "key exchanging" state, the session SHOULD be changed to the "authenticated" state. The maximum nc and nc flags of the state MUST be updated appropriately. ๐ซถ
at any time the server MAY change any state entries with both the "rejected" and "authenticated" states to the "inactive" state, and MAY throw out any "inactive" states from the table ๐งน entries in the "key exchanging" state SHOULD be kept unless there's an emergency, like a server reboot or the table getting overfull.
Note 1: following the optional authentication spec in [RFC8053] ๐, the 401-INIT messages marked with plus signs cannot be replaced with a successful response with an Optional-WWW-Authenticate header. every other 401-INIT can be a response with an Optional-WWW-Authenticate header.
Note 2: the server SHOULD NOT send a 401-INIT response in this case, because it would leak to the client that the specified username won't be accepted ๐ญ instead, postpone it until the response to the next req-VFY-C request.
Note 3: if the request isn't rejected in this clause, the server will be required, in the next step, to figure out whether the same nc value was previously received from the client. if that's impossible, the server MUST send a 401-STALE response in this step. if the server doesn't remember the whole history of nc values received from the client, the server MUST send a 401-STALE message in this clause.
12. Authentication Algorithms โจ
cryptographic authentication algorithms used with this protocol will be defined separately ๐ each algorithm definition MUST at least provide definitions for these functions:
- The server-side authentication credential J, derived from the client-side authentication credential pi.
- Key exchange values K_c1, K_s1 (exchanged on the wire) and S_c1, S_s1 (kept secret in each peer).
- Shared session secret (z), to be computed by both server and client.
- A hash function H to be used with the protocol, along with its output size hSize.
- The value nIterPi, the number of iterations for the key derivation operation.
specs for crypto algorithms used with this framework MUST say whether they will (1) use the default functions defined below for values pi, VK_c, and VK_s or (2) define their own comparable functions. main character energy ๐
all algorithms used with this protocol SHOULD give secure mutual authentication between clients and servers, and generate a cryptographically strong shared secret value (z) that's just as strong or stronger than the hash function H ๐ช if any passwords (or passphrases or any equivalents, aka weak secrets) are involved, these SHOULD NOT be guessable from any data sent in the protocol, even if an attacker (either an eavesdropper or an active server) knows the possible, thoroughly searchable candidate list of passwords ๐ญ also, it is RECOMMENDED that the function J for deriving the server-side authentication credential J(pi) be one-way, if possible, so pi can't be easily computed from J(pi) ๐
12.1. Support Functions and Notations ๐ง
in this section we define some support functions and notations that several algorithm definitions share ๐
integers in the spec are in decimal, or in hexadecimal when prefixed with "0x".
the function octet(i) makes an octet string holding one single octet with value i. the operator "|", applied to octet strings, means concatenation of the two operands ๐งฉ
the function VI encodes natural numbers into octet strings like this: numbers are big-endian radix-128 strings, where each digit is an octet in the range 0x80-0xff, except for the last digit, which is an octet in the range 0x00-0x7f. the first octet MUST NOT be 0x80. examples:
VI(i) = octet(i) for i < 128, and
VI(i) = octet(0x80 + (i >> 7)) | octet(i & 127) for 128 <= i < 16384.
this encoding is the same as the one used for subcomponents of object identifiers in ASN.1 encoding [ITU.X690.2015], and it's available as a "w" conversion in the "pack" function of several scripting languages ๐
the function VS encodes a variable-length octet string into a uniquely decoded, self-delimited octet string:
VS(s) = VI(length(s)) | s
where length(s) is a number of octets (not characters) in s.
some examples ๐
VI(0) = "\000" (in C string notation)
VI(100) = "d"
VI(10000) = "\316\020"
VI(1000000) = "\275\204@"
VS("") = "\000"
VS("Tea") = "\003Tea"
VS("Caf<e acute>" [in UTF-8]) = "\005Caf\303\251"
VS([10000 "a"s]) = "\316\020aaaaa..." (10002 octets)
(note: unlike the colon-separated format used in the Basic and Digest HTTP authentication schemes, a concatenation of VS-encoded strings is unique no matter which characters are in the strings being encoded ๐)
the function OCTETS turns an integer into the matching radix-256 big-endian octet string with its natural length. see Section 3.2.3 for what "natural length" means ๐
the function INT turns an octet string into a natural number, treating the input string as radix-256 big-endian notation. the identity INT(OCTETS(n)) = n always holds for any natural number n ๐
12.2. Default Functions for Algorithms ๐
the functions in this section are common default functions shared among authentication algorithms ๐ซถ
the client-side password-based (credential) pi used by this authentication is a natural number derived like this:
pi = INT(PBKDF2(HMAC_H, password, VS(algorithm) | VS(auth-scope) |
VS(realm) | VS(username), nIterPi, hSize / 8))
where
- PBKDF2 is the password-based key derivation function defined in [RFC8018],
- HMAC_H is the Hashed Message Authentication Code (HMAC) function, defined in [RFC2104], composed from the hash function H, and
- hSize is the output size of hash H in bits.
the values of algorithm, realm, and auth-scope come from the values in the 401-INIT message. if the password comes from user input, it SHOULD first be prepared using the method in Section 9. then the password SHALL be encoded as a UTF-8 string ๐ค
the values VK_c and VK_s are derived with these equations:
VK_c = INT(H(octet(4) | OCTETS(K_c1) | OCTETS(K_s1) | OCTETS(z) |
VI(nc) | VS(vh)))
VK_s = INT(H(octet(3) | OCTETS(K_c1) | OCTETS(K_s1) | OCTETS(z) |
VI(nc) | VS(vh)))
and that's the wrap for this part, bestie ๐ฆ the server rules and the crypto basics are all set ๐
13. Application Channel Binding โจ
Okay so apps and upper-layer protocols sometimes need to bind themselves to the user who got authenticated at the HTTP layer, and honestly that's so relatable ๐ซถ. They MAY use the following values as a standard shared secret ๐.
These values are parameterized with an optional octet string (t) ๐, which each app or protocol can pick however it likes. If there's no good value to specify, just use an empty string for t ๐ธ.
If your app needs binding to either an authenticated user or a shared-key session (so you know the requesting client is legit), the following value b_1 MAY be used ๐:
b_1 = H(H(octet(6) | OCTETS(K_c1) | OCTETS(K_s1) | OCTETS(z) |
VI(0) | VS(vh)) | VS(t))
If your app needs binding to a specific request (so the payload data is generated for the exact HTTP request), the following value b_2 MAY be used ๐ฆ:
b_2 = H(H(octet(7) | OCTETS(K_c1) | OCTETS(K_s1) | OCTETS(z) |
VI(nc) | VS(vh)) | VS(t))
Note: Channel bindings to lower-layer transports (TCP and TLS) are defined in Section 7 ๐ .
14. Application for Proxy Authentication ๐ง
The scheme we just went through in the previous sections can be applied to proxy authentication too, with some modifications ๐ . When that happens, the following alterations MUST be applied:
- The 407 (Proxy Authentication Required) status code is to be sent and recognized wherever the 401 status code is used, ๐ฆ
- The
Proxy-Authenticateheader is used wherever theWWW-Authenticateheader is used, ๐ - The
Proxy-Authorizationheader is used wherever theAuthorizationheader is used, ๐ - The
Proxy-Authentication-Infoheader is used wherever theAuthentication-Infoheader is used, โจ - The
auth-scopeparameter is fixed to the hostname of the proxy, which means it covers all requests processed by that specific proxy, ๐ - The limitation for the paths contained in the
pathparameter of401-KEX-S1messages is disregarded, ๐ - Omitting the
pathparameter of401-KEX-S1messages means the authentication realm will potentially cover all requests processed by the proxy, ๐ - The scheme, hostname, and port of the proxy are used for host validation tokens, and ๐ฆ
- Authentication extensions defined in [RFC8053] are not applicable. ๐ซ
15. Methods to Extend This Protocol ๐
Okay, if you build a private extension to this protocol, it MUST use the extension-tokens defined in Section 3 so it doesn't clash with this protocol or other extensions ๐ โโ๏ธ. (Standardized extensions, as well as extensions that are still being standardized, MAY use either bare-tokens or extension-tokens ๐.)
Specifications that define authentication algorithms MAY use other representations for the parameters kc1, ks1, vkc, and vks, replace those parameter names, and/or add parameters to the messages containing those parameters in supplemental specifications. Just make sure the syntactic and semantic requirements in Section 3 of this document, [RFC7230], and [RFC7235] are still satisfied โจ. Any parameters starting with "kc", "ks", "vkc", or "vks" and followed by decimal natural numbers (e.g., kc2, ks0, vkc1, vks3) are reserved for this purpose ๐. If those specifications use names other than the ones mentioned above, it is RECOMMENDED that extension-tokens be used to avoid any parameter-name conflicts with future extensions to this protocol ๐ซถ.
Extension-tokens MAY be freely used for any non-standard, private, and/or experimental uses for those parameters, provided that the domain part in the token is used in the manner defined in Section 3 ๐.
16. IANA Considerations ๐
16.1. Addition to HTTP Authentication Schemes Registry
IANA has added the following entry to the "HTTP Authentication Schemes" registry ๐:
- Authentication Scheme Name:
Mutual - Reference: RFC 8120
16.2. Registry for Authentication Algorithms
This document establishes the "HTTP Mutual Authentication Algorithms" registry. The registry manages case-insensitive ASCII strings, and the strings MUST follow the extensive-token syntax defined in Section 3 ๐ง.
When bare-tokens are used for the authentication-algorithm parameter, they MUST be allocated by IANA. To acquire registered tokens, the usage of such tokens MUST be reviewed by a Designated Expert, as outlined in [RFC5226] ๐ฉโ๐ผ.
Registrations for an authentication algorithm are required to include descriptions of the authentication algorithms. Reviewers assigned by the IESG are advised to examine minimum security requirements and consistency of the key exchange algorithm descriptions ๐.
It is advised that new registrations provide the following information:
- Token: A token used in HTTP headers for identifying the algorithm.
- Description: A brief description of the algorithm.
- Specification: A reference for a specification defining the algorithm.
[RFC8121] defines the initial contents of this registry ๐ธ.
16.3. Registry for Validation Methods
This document establishes the "HTTP Mutual Authentication Host Validation Methods" registry. It manages case-insensitive ASCII strings, and the strings MUST follow the extensive-token syntax defined in Section 3 ๐.
When bare-tokens are used for the validation parameter, they MUST be allocated by IANA. To acquire registered tokens, the usage of such tokens MUST be reviewed by a Designated Expert, as outlined in [RFC5226] ๐ .
Registrations for a validation method are required to include a description of the validation method. Reviewers assigned by the IESG are advised to examine its use-case requirements and any security consequences related to its introduction ๐.
It is advised that new registrations provide the following information:
- Token: A token used in HTTP headers for identifying the method.
- Description: A brief description of the method.
- Specification: A reference for a specification defining the method.
The initial contents of this registry are as follows ๐:
+----------------------+------------------------+----------------+
| Token | Description | Reference |
+----------------------+------------------------+----------------+
| host | Hostname verification | RFC 8120, |
| | only | Section 7 |
| | | |
| tls-server-end-point | TLS certificate-based | RFC 8120, |
| | | Section 7 |
| | | |
| tls-unique | TLS unique key-based | RFC 8120, |
| | | Section 7 |
+----------------------+------------------------+----------------+
17. Security Considerations ๐ฅ
Okay, this section is super important ๐ญ, so read it slowly bestie.
17.1. Security Properties
- The protocol is secure against passive eavesdropping and replay attacks. However, the protocol relies on transport security (including DNS integrity) for data secrecy and integrity. HTTP/TLS SHOULD be used where transport security is not assured and/or data confidentiality is important ๐.
- When used with HTTP/TLS, if TLS server certificates are reliably verified, the protocol provides true protection against active man-in-the-middle attacks ๐ก๏ธ.
- Even if the server certificate is not used or is unreliable, the protocol provides protection against active man-in-the-middle attacks for each HTTP request/response pair. However, in such cases, JavaScript or similar scripts that are not authenticated by this authentication mechanism can affect mutually authenticated contents to circumvent the protection. This is why this protocol stipulates that valid TLS server certificates MUST be shown from the server to the client (Section 7) ๐จ.
17.2. Secrecy of Credentials
The client-side password credential MUST always be kept secret and SHOULD NOT be used for any other (possibly insecure) authentication purposes. Loss of control of the credential will directly affect the control of the corresponding server-side account ๐ โโ๏ธ.
The use of a client-side credential with THIS authentication scheme is always safe, even if the connected server peer is not trustworthy (e.g., a phishing scenario). However, if it is used with other authentication schemes (such as Web forms) and the recipient is rogue, the result will be obvious ๐.
It is also important that the server-side password credential (J) be kept secret. If it is stolen and the client's choice of password is not strong, anyone who is aware of the server-side password credential can employ an offline dictionary attack to search for the client's password. However, if the client has chosen a strong password so that an attacker cannot guess the client's password from dictionary candidates, the client is still well protected from any attacks ๐ช.
The shared session secret (z) MUST be kept secret inside the server/client software. If it is lost and the session is still active, session hijacking will result. After the session expires, the key is of no value to attackers ๐๏ธ.
17.3. Denial-of-Service Attacks on Servers
The protocol requires a server-side table of active sessions, which may become a critical point for server resource consumption. For proper operation, the protocol requires that at least one key verification request be processed for each session identifier. After that, servers MAY discard sessions internally at any time without causing any operational problems for clients. Clients will then silently re-establish a new session ๐.
However, if a malicious client sends too many requests for key exchanges (req-KEX-C1 messages) only, resource starvation might occur. In such critical situations, servers MAY discard any kind of existing sessions, regardless of their statuses. One way to mitigate such attacks is that servers MAY set number and time limits for unverified, pending key exchange requests (in the "key exchanging" state) ๐ง.
This is a common weakness of authentication protocols with almost any kind of negotiations or states, including the Digest authentication scheme and most cookie-based authentication implementations. However, regarding resource consumption, the situation for the Mutual authentication scheme is slightly better than that for Digest, because HTTP requests without any kind of authentication requests will not generate any kind of sessions. Session identifiers are only generated after a client starts a key negotiation, so simple clients such as Web crawlers will not accidentally consume server-side resources for session management ๐ท๏ธโจ.
17.3.1. Online Active Password Attacks
Although the protocol provides very strong protection against offline dictionary attacks from eavesdropped traffic, the protocol, by its nature, cannot prevent active password attacks in which an attacker sends so many authentication trial requests for every possible password ๐ค.
Possible countermeasures for preventing such attacks may be the rate-limiting of password authentication trials, statistics-based intrusion-detection measures, or similar protection schemes. If the server operators assume that the passwords of users are not strong enough, it may be desirable to introduce such ad hoc countermeasures ๐.
17.4. Communicating the Status of Mutual Authentication with Users ๐ซถ
okay bestie, this protocol has two goals ๐. Goal one is to be a secure alternative to the old Basic and Digest auth schemes ๐ . Goal two is to help users spot forged rogue servers ๐ that copy their registered account on a server, like in a phishing attack ๐ญ.
For this to actually work as a countermeasure, it is very important that end users of clients get notified of the result of mutual authentication, especially the three states AUTH-SUCCEED, AUTH-REQUIRED, and UNAUTHENTICATED from Section 10 ๐ฅ. Designing secure user interfaces for HTTP interactive clients is out of scope for this document ๐. Still, if possible, a UI indicator for those three states is super desirable for user security โจ.
Also, the password prompts for this auth shall be protected against imitation, for example by other insecure password input fields like forms ๐ง. If attackers already know the passwords outside of the protocol, the protocol can't be an effective security measure ๐.
17.5. Implementation Considerations ๐
- To implement the protocol securely, the Authentication-Info headers in the 200-VFY-S messages MUST always be validated by the client ๐. If validation fails, the client MUST NOT process any content sent with the message, including other headers and the body part ๐ซ. Skipping this would let phishing attacks through, so don't be that person ๐ญ.
- For HTTP/TLS communications, when a Web form is submitted from mutually authenticated pages via the
tls-server-end-pointvalidation method to a URI protected by the same realm (indicated by thepathparameter), and the server certificate has changed since the pages were received, it is RECOMMENDED that the peer be revalidated using a req-KEX-C1 message with anExpect: 100-continueheader ๐. The same goes when the page is received via thetls-uniquevalidation method, and when the TLS session has expired โญ. - For better protection against possible password database stealing ๐ต๏ธโโ๏ธ, server-side storage of user passwords should contain values encrypted by the one-way function
J(pi), instead of the real passwords or those hashed by pi ๐. - If TLS 1.2 [RFC5246] is used for the underlying HTTP/TLS communications, follow the best practices in [RFC7525] ๐.
17.6. Usage Considerations ๐ฆ
- Usernames a user inputs may be sent automatically to any servers sharing the same auth-scope ๐. So when a host-type auth-scope is used for authentication on an HTTPS site, and an HTTP server on the same host requests the Mutual authentication scheme within the same realm, the client will send the username in clear text ๐ฑ. If usernames have to stay secret from eavesdroppers, the server must use the full-scheme-type "auth-scope" parameter and HTTPS ๐. Passwords, on the other hand, are not exposed to eavesdroppers, even in HTTP requests ๐.
- If the server offers several ways to store server-side password secrets in the password database, it is desirable, for better security, to store values encrypted by using the one-way function
J(pi), instead of the real passwords or those hashed by pi ๐ธ.
18. References โจ
18.1. Normative References ๐
[RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC:
Keyed-Hashing for Message Authentication", RFC 2104,
DOI 10.17487/RFC2104, February 1997,
<http://www.rfc-editor.org/info/rfc2104>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>.
[RFC3629] Yergeau, F., "UTF-8, a transformation format of
ISO 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629,
November 2003, <http://www.rfc-editor.org/info/rfc3629>.
[RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006,
<http://www.rfc-editor.org/info/rfc4648>.
[RFC5234] Crocker, D., Ed., and P. Overell, "Augmented BNF for
Syntax Specifications: ABNF", STD 68, RFC 5234,
DOI 10.17487/RFC5234, January 2008,
<http://www.rfc-editor.org/info/rfc5234>.
[RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security
(TLS) Protocol Version 1.2", RFC 5246,
DOI 10.17487/RFC5246, August 2008,
<http://www.rfc-editor.org/info/rfc5246>.
[RFC5987] Reschke, J., "Character Set and Language Encoding for
Hypertext Transfer Protocol (HTTP) Header Field
Parameters", RFC 5987, DOI 10.17487/RFC5987, August 2010,
<http://www.rfc-editor.org/info/rfc5987>.
[RFC7230] Fielding, R., Ed., and J. Reschke, Ed., "Hypertext
Transfer Protocol (HTTP/1.1): Message Syntax and Routing",
RFC 7230, DOI 10.17487/RFC7230, June 2014,
<http://www.rfc-editor.org/info/rfc7230>.
[RFC7235] Fielding, R., Ed., and J. Reschke, Ed., "Hypertext
Transfer Protocol (HTTP/1.1): Authentication", RFC 7235,
DOI 10.17487/RFC7235, June 2014,
<http://www.rfc-editor.org/info/rfc7235>.
[RFC7613] Saint-Andre, P. and A. Melnikov, "Preparation,
Enforcement, and Comparison of Internationalized Strings
Representing Usernames and Passwords", RFC 7613,
DOI 10.17487/RFC7613, August 2015,
<http://www.rfc-editor.org/info/rfc7613>.
[RFC7615] Reschke, J., "HTTP Authentication-Info and
Proxy-Authentication-Info Response Header Fields",
RFC 7615, DOI 10.17487/RFC7615, September 2015,
<http://www.rfc-editor.org/info/rfc7615>.
[RFC8018] Moriarty, K., Ed., Kaliski, B., and A. Rusch, "PKCS #5:
Password-Based Cryptography Specification Version 2.1",
RFC 8018, DOI 10.17487/RFC8018, January 2017,
<http://www.rfc-editor.org/info/rfc8018>.
[RFC8053] Oiwa, Y., Watanabe, H., Takagi, H., Maeda, K., Hayashi,
T., and Y. Ioku, "HTTP Authentication Extensions for
Interactive Clients", RFC 8053, DOI 10.17487/RFC8053,
January 2017, <http://www.rfc-editor.org/info/rfc8053>.
[Unicode] The Unicode Consortium, "The Unicode Standard",
<http://www.unicode.org/versions/latest/>.
18.2. Informative References ๐ท
[ITU.X690.2015]
International Telecommunication Union, "Information
Technology - ASN.1 encoding rules: Specification of Basic
Encoding Rules (BER), Canonical Encoding Rules (CER) and
Distinguished Encoding Rules (DER)", ITU-T Recommendation
X.690, ISO/IEC 8825-1, August 2015,
<https://www.itu.int/rec/T-REC-X.690/>.
[RFC1939] Myers, J. and M. Rose, "Post Office Protocol - Version 3",
STD 53, RFC 1939, DOI 10.17487/RFC1939, May 1996,
<http://www.rfc-editor.org/info/rfc1939>.
[RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818,
DOI 10.17487/RFC2818, May 2000,
<http://www.rfc-editor.org/info/rfc2818>.
[RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an
IANA Considerations Section in RFCs", BCP 26, RFC 5226,
DOI 10.17487/RFC5226, May 2008,
<http://www.rfc-editor.org/info/rfc5226>.
[RFC5890] Klensin, J., "Internationalized Domain Names for
Applications (IDNA): Definitions and Document Framework",
RFC 5890, DOI 10.17487/RFC5890, August 2010,
<http://www.rfc-editor.org/info/rfc5890>.
[RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings
for TLS", RFC 5929, DOI 10.17487/RFC5929, July 2010,
<http://www.rfc-editor.org/info/rfc5929>.
[RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265,
DOI 10.17487/RFC6265, April 2011,
<http://www.rfc-editor.org/info/rfc6265>.
[RFC6454] Barth, A., "The Web Origin Concept", RFC 6454,
DOI 10.17487/RFC6454, December 2011,
<http://www.rfc-editor.org/info/rfc6454>.
[RFC7231] Fielding, R., Ed., and J. Reschke, Ed., "Hypertext
Transfer Protocol (HTTP/1.1): Semantics and Content",
RFC 7231, DOI 10.17487/RFC7231, June 2014,
<http://www.rfc-editor.org/info/rfc7231>.
[RFC7486] Farrell, S., Hoffman, P., and M. Thomas, "HTTP
Origin-Bound Authentication (HOBA)", RFC 7486,
DOI 10.17487/RFC7486, March 2015,
<http://www.rfc-editor.org/info/rfc7486>.
[RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre,
"Recommendations for Secure Use of Transport Layer
Security (TLS) and Datagram Transport Layer Security
(DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525,
May 2015, <http://www.rfc-editor.org/info/rfc7525>.
[RFC7616] Shekh-Yusef, R., Ed., Ahrens, D., and S. Bremer, "HTTP
Digest Access Authentication", RFC 7616,
DOI 10.17487/RFC7616, September 2015,
<http://www.rfc-editor.org/info/rfc7616>.
[RFC7627] Bhargavan, K., Ed., Delignat-Lavaud, A., Pironti, A.,
Langley, A., and M. Ray, "Transport Layer Security (TLS)
Session Hash and Extended Master Secret Extension",
RFC 7627, DOI 10.17487/RFC7627, September 2015,
<http://www.rfc-editor.org/info/rfc7627>.
[RFC8121] Oiwa, Y., Watanabe, H., Takagi, H., Maeda, K., Hayashi,
T., and Y. Ioku, "Mutual Authentication Protocol for HTTP:
Cryptographic Algorithms Based on the Key Agreement
Mechanism 3 (KAM3)", RFC 8121, DOI 10.17487/RFC8121,
April 2017, <http://www.rfc-editor.org/info/rfc8121>.
Authors' Addresses ๐
Yutaka Oiwa
National Institute of Advanced Industrial Science and Technology
Information Technology Research Institute
Tsukuba Central 1
1-1-1 Umezono
Tsukuba-shi, Ibaraki
Japan
Email: y.oiwa@aist.go.jp
Hajime Watanabe
National Institute of Advanced Industrial Science and Technology
Information Technology Research Institute
Tsukuba Central 1
1-1-1 Umezono
Tsukuba-shi, Ibaraki
Japan
Email: h-watanabe@aist.go.jp
Hiromitsu Takagi
National Institute of Advanced Industrial Science and Technology
Information Technology Research Institute
Tsukuba Central 1
1-1-1 Umezono
Tsukuba-shi, Ibaraki
Japan
Email: takagi.hiromitsu@aist.go.jp
Kaoru Maeda
Individual Contributor
Email: kaorumaeda.ml@gmail.com
Tatsuya Hayashi
Lepidum Co. Ltd.
Village Sasazuka 3, Suite #602
1-30-3 Sasazuka
Shibuya-ku, Tokyo
Japan
Email: hayashi@lepidum.co.jp
Yuichi Ioku
Individual Contributor
Email: mutual-work@ioku.org
๐ฆ where this page comes from
- ietf: rfc8120 2017-04
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms