1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
HTTP Working Group J. Franks, Northwestern University |
8 |
INTERNET DRAFT P. Hallam-Baker, M.I.T. |
9 |
<draft-ietf-http-authentication-00> J. Hostetler, Spyglass, Inc. |
10 |
P. Leach, Microsoft Corporation |
11 |
A. Luotonen, Netscape Communications Corporation |
12 |
E. Sink, Spyglass, Inc. |
13 |
L. Stewart, Open Market, Inc. |
14 |
Expires: May 21, 1998 November 21, 1997 |
15 |
|
16 |
|
17 |
|
18 |
|
19 |
HTTP Authentication: Basic and Digest Access Authentication |
20 |
|
21 |
|
22 |
|
23 |
Status of this Memo |
24 |
|
25 |
This document is an Internet-Draft. Internet-Drafts are working |
26 |
documents of the Internet Engineering Task Force (IETF), its areas, and |
27 |
its working groups. Note that other groups may also distribute working |
28 |
documents as Internet-Drafts. |
29 |
|
30 |
Internet-Drafts are draft documents valid for a maximum of six months |
31 |
and may be updated, replaced, or made obsolete by other documents at any |
32 |
time. It is inappropriate to use Internet-Drafts as reference material |
33 |
or to cite them other than as "work in progress". |
34 |
|
35 |
To learn the current status of any Internet-Draft, please check the |
36 |
"1id-abstracts.txt" listing contained in the Internet-Drafts Shadow |
37 |
Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe), |
38 |
munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or |
39 |
ftp.isi.edu (US West Coast). |
40 |
|
41 |
Distribution of this document is unlimited. Please send comments to the |
42 |
HTTP working group at <http-wg@cuckoo.hpl.hp.com>. Discussions of the |
43 |
working group are archived at |
44 |
<URL:http://www.ics.uci.edu/pub/ietf/http/>. General discussions about |
45 |
HTTP and the applications which use HTTP should take place on the <www- |
46 |
talk@w3.org> mailing list. |
47 |
|
48 |
Abstract |
49 |
|
50 |
"HTTP/1.0" includes the specification for a Basic Access Authentication |
51 |
scheme. This scheme is not considered to be a secure method of user |
52 |
authentication (unless used in conjunction with some external secure |
53 |
system such as SSL [5]), as the user name and password are passed over |
54 |
the network as clear text. |
55 |
|
56 |
This document also provides the specification for HTTP's authentication |
57 |
framework, the original Basic authentication scheme and a scheme based |
58 |
|
59 |
|
60 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
61 |
|
62 |
|
63 |
on cryptographic hashes, referred to as "Digest Access Authentication". |
64 |
It is therefore intended to also serve as a replacement for RFC 2069.[6] |
65 |
|
66 |
Like Basic, Digest access authentication verifies that both parties to a |
67 |
communication know a shared secret (a password); unlike Basic, this |
68 |
verification can be done without sending the password in the clear, |
69 |
which is Basic's biggest weakness. As with most other authentication |
70 |
protocols, the greatest sources of risks are usually found not in the |
71 |
core protocol itself but in policies and procedures surrounding its use. |
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
Franks, et al. [Page 2] |
116 |
|
117 |
|
118 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
119 |
|
120 |
|
121 |
Table of Contents |
122 |
|
123 |
|
124 |
|
125 |
HTTP AUTHENTICATION: BASIC AND DIGEST ACCESS AUTHENTICATION1 |
126 |
|
127 |
Status of this Memo........................................1 |
128 |
|
129 |
Abstract...................................................1 |
130 |
|
131 |
Table of Contents..........................................3 |
132 |
|
133 |
1 Access Authentication .................................5 |
134 |
1.1 Reliance on the HTTP/1.1 Specification ............5 |
135 |
1.2 Access Authentication Framework ...................5 |
136 |
|
137 |
2 Basic Authentication Scheme ...........................6 |
138 |
|
139 |
3 Digest Access Authentication Scheme ...................7 |
140 |
3.1 Introduction ......................................7 |
141 |
3.1.1 Purpose .........................................7 |
142 |
3.1.2 Overall Operation ...............................8 |
143 |
3.1.3 Representation of digest values .................8 |
144 |
3.1.4 Limitations .....................................8 |
145 |
3.2 Specification of Digest Headers ...................9 |
146 |
3.2.1 The WWW-Authenticate Response Header ............9 |
147 |
3.2.2 The Authorization Request Header ...............11 |
148 |
3.2.3 The Authentication-Info Header .................14 |
149 |
3.3 Digest Operation .................................15 |
150 |
3.4 Security Protocol Negotiation ....................16 |
151 |
3.5 Example ..........................................16 |
152 |
3.6 Proxy-Authentication and Proxy-Authorization .....17 |
153 |
|
154 |
4 Security Considerations ..............................18 |
155 |
4.1 Authentication of Clients using Basic Authentication 18 |
156 |
4.2 Authentication of Clients using Digest Authentication 19 |
157 |
4.3 Offering a Choice of Authentication Schemes ......19 |
158 |
4.4 Comparison of Digest with Basic Authentication ...20 |
159 |
4.5 Replay Attacks ...................................20 |
160 |
4.6 Man in the Middle ................................21 |
161 |
4.7 Spoofing by Counterfeit Servers ..................22 |
162 |
4.8 Storing passwords ................................22 |
163 |
4.9 Summary ..........................................23 |
164 |
|
165 |
5 Acknowledgments ......................................23 |
166 |
|
167 |
6 References ...........................................23 |
168 |
|
169 |
7 Authors' Addresses ...................................24 |
170 |
|
171 |
Index.....................................................26 |
172 |
|
173 |
Franks, et al. [Page 3] |
174 |
|
175 |
|
176 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
Franks, et al. [Page 4] |
232 |
|
233 |
|
234 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
235 |
|
236 |
|
237 |
|
238 |
1 Access Authentication |
239 |
|
240 |
|
241 |
1.1 Reliance on the HTTP/1.1 Specification |
242 |
|
243 |
This specification is a companion two the HTTP/1.1 specification [2]. It |
244 |
uses using the extended BNF section 2.1 of that document, and relies on |
245 |
both the BNF defined in that document, and other aspects of the HTTP/1.1 |
246 |
specification. |
247 |
|
248 |
|
249 |
1.2 Access Authentication Framework |
250 |
|
251 |
HTTP provides a simple challenge-response authentication mechanism |
252 |
which MAY be used by a server to challenge a client request and by a |
253 |
client to provide authentication information. It uses an extensible, |
254 |
case-insensitive token to identify the authentication scheme, followed |
255 |
by a comma-separated list of attribute-value pairs which carry the |
256 |
parameters necessary for achieving authentication via that scheme. |
257 |
|
258 |
auth-scheme = token |
259 |
auth-param = token "=" ( token | quoted-string ) |
260 |
The 401 (Unauthorized) response message is used by an origin server to |
261 |
challenge the authorization of a user agent. This response MUST include |
262 |
a WWW-Authenticate header field containing at least one challenge |
263 |
applicable to the requested resource. The 407 (Proxy Authentication |
264 |
Required) response message is used by a proxy to challenge the |
265 |
authorization of a client and MUST include a Proxy-Authenticate header |
266 |
field containing a challenge applicable to the proxy for the requested |
267 |
resource. |
268 |
|
269 |
challenge = auth-scheme 1*SP 1#auth-param |
270 |
The authentication parameter realm is defined for all authentication |
271 |
schemes: |
272 |
|
273 |
realm = "realm" "=" realm-value |
274 |
realm-value = quoted-string |
275 |
The realm attribute (case-insensitive) is required for all |
276 |
authentication schemes which issue a challenge. The realm value (case- |
277 |
sensitive), in combination with the canonical root URL (see section |
278 |
5.1.2 of [2]) of the server being accessed, defines the protection |
279 |
space. These realms allow the protected resources on a server to be |
280 |
partitioned into a set of protection spaces, each with its own |
281 |
authentication scheme and/or authorization database. The realm value is |
282 |
a string, generally assigned by the origin server, which may have |
283 |
additional semantics specific to the authentication scheme. |
284 |
|
285 |
A user agent that wishes to authenticate itself with an origin server-- |
286 |
usually, but not necessarily, after receiving a 401 (Unauthorized)--MAY |
287 |
do so by including an Authorization header field with the request. A |
288 |
|
289 |
Franks, et al. [Page 5] |
290 |
|
291 |
|
292 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
293 |
|
294 |
|
295 |
client that wishes to authenticate itself with a proxy--usually, but not |
296 |
necessarily, after receiving a 407 (Proxy Authentication Required)--MAY |
297 |
do so by including a Proxy-Authorization header field with the request. |
298 |
Both the Authorization field value and the Proxy-Authorization field |
299 |
value consists of credentials containing the authentication information |
300 |
of the client for the realm of the resource being requested. |
301 |
|
302 |
credentials = basic-credentials | auth-scheme #auth-param |
303 |
The protection space determines the domain over which credentials can be |
304 |
automatically applied. If a prior request has been authorized, the same |
305 |
credentials MAY be reused for all other requests within that protection |
306 |
space for a period of time determined by the authentication scheme, |
307 |
parameters, and/or user preference. Unless otherwise defined by the |
308 |
authentication scheme, a single protection space cannot extend outside |
309 |
the scope of its server. |
310 |
|
311 |
If the origin server does not wish to accept the credentials sent with a |
312 |
request, it SHOULD return a 401 (Unauthorized) response. The response |
313 |
MUST include a WWW-Authenticate header field containing at least one |
314 |
(possibly new) challenge applicable to the requested resource. If a |
315 |
proxy does not accept the credentials sent with a request, it SHOULD |
316 |
return a 407 (Proxy Authentication Required). The response MUST include |
317 |
a Proxy-Authenticate header field containing a (possibly new) challenge |
318 |
applicable to the proxy for the requested resource. |
319 |
|
320 |
The HTTP protocol does not restrict applications to this simple |
321 |
challenge-response mechanism for access authentication. Additional |
322 |
mechanisms MAY be used, such as encryption at the transport level or via |
323 |
message encapsulation, and with additional header fields specifying |
324 |
authentication information. However, these additional mechanisms are not |
325 |
defined by this specification. |
326 |
|
327 |
Proxies MUST be completely transparent regarding user agent |
328 |
authentication by origin servers. That is, they MUST forward the WWW- |
329 |
Authenticate and Authorization headers untouched, and follow the rules |
330 |
found in section 14.8 of [2]. Both the Proxy-Authenticate and the Proxy- |
331 |
Authorization header fields are hop-by-hop headers (see section 13.5.1 |
332 |
of [2]). |
333 |
|
334 |
|
335 |
2 Basic Authentication Scheme |
336 |
|
337 |
The "basic" authentication scheme is based on the model that the client |
338 |
must authenticate itself with a user-ID and a password for each realm. |
339 |
The realm value should be considered an opaque string which can only be |
340 |
compared for equality with other realms on that server. The server will |
341 |
service the request only if it can validate the user-ID and password for |
342 |
the protection space of the Request-URI. There are no optional |
343 |
authentication parameters. |
344 |
|
345 |
|
346 |
|
347 |
Franks, et al. [Page 6] |
348 |
|
349 |
|
350 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
351 |
|
352 |
|
353 |
Upon receipt of an unauthorized request for a URI within the protection |
354 |
space, the origin server MAY respond with a challenge like the |
355 |
following: |
356 |
|
357 |
WWW-Authenticate: Basic realm="WallyWorld" |
358 |
where "WallyWorld" is the string assigned by the server to identify the |
359 |
protection space of the Request-URI. A proxy may respond with the same |
360 |
challenge using the Proxy-Authenticate header field. |
361 |
|
362 |
To receive authorization, the client sends the userid and password, |
363 |
separated by a single colon (":") character, within a base64 [7] encoded |
364 |
string in the credentials. |
365 |
|
366 |
basic-credentials = "Basic" SP base64-user-pass |
367 |
base64-user-pass = <base64 [4] encoding of user-pass, |
368 |
except not limited to 76 char/line> |
369 |
user-pass = userid ":" password |
370 |
userid = *<TEXT excluding ":"> |
371 |
password = *TEXT |
372 |
Userids might be case sensitive. |
373 |
|
374 |
If the user agent wishes to send the userid "Aladdin" and password "open |
375 |
sesame", it would use the following header field: |
376 |
|
377 |
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== |
378 |
|
379 |
|
380 |
A client SHOULD assume that all paths at or deeper than the depth of the |
381 |
last symbolic element in the path field of the Request-URI also are |
382 |
within the protection space specified by the Basic realm value of the |
383 |
current challenge. A client MAY send the corresponding Authorization |
384 |
header with requests for resources in that space without receipt of |
385 |
another challenge from the server. |
386 |
|
387 |
If a client wishes to send the same userid and password to a proxy, it |
388 |
would use the Proxy-Authorization header field. See section 4 for |
389 |
security considerations associated with Basic authentication. |
390 |
|
391 |
|
392 |
3 Digest Access Authentication Scheme |
393 |
|
394 |
|
395 |
3.1 Introduction |
396 |
|
397 |
|
398 |
3.1.1 Purpose |
399 |
|
400 |
The protocol referred to as "HTTP/1.0" includes specification for a |
401 |
Basic Access Authentication scheme[1]. This scheme is not considered to |
402 |
be a secure method of user authentication, as the user name and password |
403 |
are passed over the network in an unencrypted form. This document |
404 |
|
405 |
Franks, et al. [Page 7] |
406 |
|
407 |
|
408 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
409 |
|
410 |
|
411 |
provides specification for such a scheme, referred to as "Digest Access |
412 |
Authentication". |
413 |
|
414 |
The Digest Access Authentication scheme is not intended to be a complete |
415 |
answer to the need for security in the World Wide Web. This scheme |
416 |
provides no encryption of object content. The intent is simply to create |
417 |
a weak access authentication method, which avoids the most serious flaws |
418 |
of Basic authentication. |
419 |
|
420 |
|
421 |
3.1.2 Overall Operation |
422 |
|
423 |
Like Basic Access Authentication, the Digest scheme is based on a simple |
424 |
challenge-response paradigm. The Digest scheme challenges using a nonce |
425 |
value. A valid response contains a checksum (by default the MD5 |
426 |
checksum) of the username, the password, the given nonce value, the HTTP |
427 |
method, and the requested URI. In this way, the password is never sent |
428 |
in the clear. Just as with the Basic scheme, the username and password |
429 |
must be prearranged in some fashion which is not addressed by this |
430 |
document. |
431 |
|
432 |
|
433 |
3.1.3 Representation of digest values |
434 |
|
435 |
An optional header allows the server to specify the algorithm used to |
436 |
create the checksum or digest. By default the MD5 algorithm is used and |
437 |
that is the only algorithm described in this document. |
438 |
|
439 |
For the purposes of this document, an MD5 digest of 128 bits is |
440 |
represented as 32 ASCII printable characters. The bits in the 128 bit |
441 |
digest are converted from most significant to least significant bit, |
442 |
four bits at a time to their ASCII presentation as follows. Each four |
443 |
bits is represented by its familiar hexadecimal notation from the |
444 |
characters 0123456789abcdef. That is, binary 0000 gets represented by |
445 |
the character '0', 0001, by '1', and so on up to the representation of |
446 |
1111 as 'f'. |
447 |
|
448 |
|
449 |
3.1.4 Limitations |
450 |
|
451 |
The digest authentication scheme described in this document suffers from |
452 |
many known limitations. It is intended as a replacement for basic |
453 |
authentication and nothing more. It is a password-based system and (on |
454 |
the server side) suffers from all the same problems of any password |
455 |
system. In particular, no provision is made in this protocol for the |
456 |
initial secure arrangement between user and server to establish the |
457 |
user's password. |
458 |
|
459 |
Users and implementors should be aware that this protocol is not as |
460 |
secure as kerberos, and not as secure as any client-side private-key |
461 |
|
462 |
|
463 |
Franks, et al. [Page 8] |
464 |
|
465 |
|
466 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
467 |
|
468 |
|
469 |
scheme. Nevertheless it is better than nothing, better than what is |
470 |
commonly used with telnet and ftp, and better than Basic authentication. |
471 |
|
472 |
|
473 |
3.2 Specification of Digest Headers |
474 |
|
475 |
The Digest Access Authentication scheme is conceptually similar to the |
476 |
Basic scheme. The formats of the modified WWW-Authenticate header line |
477 |
and the Authorization header line are specified below. In addition, a |
478 |
new header, Authentication-Info, is specified. |
479 |
|
480 |
|
481 |
3.2.1 The WWW-Authenticate Response Header |
482 |
|
483 |
If a server receives a request for an access-protected object, and an |
484 |
acceptable Authorization header is not sent, the server responds with a |
485 |
"401 Unauthorized" status code, and a WWW-Authenticate header, which is |
486 |
defined as follows: |
487 |
|
488 |
WWW-Authenticate = "WWW-Authenticate" ":" "Digest" |
489 |
digest-challenge |
490 |
|
491 |
digest-challenge = 1#( realm | [ domain ] | nonce | |
492 |
[ opaque ] |[ stale ] | [ algorithm ] | |
493 |
[ digest-required ]) |
494 |
|
495 |
|
496 |
domain = "domain" "=" <"> URI ( 1*SP URI ) <"> |
497 |
nonce = "nonce" "=" nonce-value |
498 |
nonce-value = quoted-string |
499 |
opaque = "opaque" "=" quoted-string |
500 |
stale = "stale" "=" ( "true" | "false" ) |
501 |
algorithm = "algorithm" "=" ( "MD5" | token ) |
502 |
digest-required = "digest-required" "=" ( "true" | "false" ) |
503 |
|
504 |
|
505 |
The meanings of the values of the parameters used above are as follows: |
506 |
|
507 |
realm |
508 |
A string to be displayed to users so they know which username and |
509 |
password to use. This string should contain at least the name of the |
510 |
host performing the authentication and might additionally indicate |
511 |
the collection of users who might have access. An example might be |
512 |
"registered_users@gotham.news.com". |
513 |
|
514 |
domain |
515 |
A space-separated list of URIs, as specified in RFC XURI [7]. The |
516 |
intent is that the client could use this information to know the set |
517 |
of URIs for which the same authentication information should be sent. |
518 |
The URIs in this list may exist on different servers. If this keyword |
519 |
|
520 |
|
521 |
Franks, et al. [Page 9] |
522 |
|
523 |
|
524 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
525 |
|
526 |
|
527 |
is omitted or empty, the client should assume that the domain |
528 |
consists of all URIs on the responding server. |
529 |
|
530 |
nonce |
531 |
A server-specified data string which may be uniquely generated each |
532 |
time a 401 response is made. It is recommended that this string be |
533 |
base64 or hexadecimal data. Specifically, since the string is passed |
534 |
in the header lines as a quoted string, the double-quote character is |
535 |
not allowed. |
536 |
|
537 |
The contents of the nonce are implementation dependent. The quality |
538 |
of the implementation depends on a good choice. A recommended nonce |
539 |
would include |
540 |
|
541 |
H(client-IP ":" time-stamp ":" private-key) |
542 |
Where client-IP is the dotted quad IP address of the client making |
543 |
the request, time-stamp is a server-generated time value, private-key |
544 |
is data known only to the server. With a nonce of this form a server |
545 |
would normally recalculate the nonce after receiving the client |
546 |
authentication header and reject the request if it did not match the |
547 |
nonce from that header. In this way the server can limit the reuse of |
548 |
a nonce to the IP address to which it was issued and limit the time |
549 |
of the nonce's validity. Further discussion of the rationale for |
550 |
nonce construction is in section 4.5 below. |
551 |
|
552 |
An implementation might choose not to accept a previously used nonce |
553 |
or a previously used digest to protect against a replay attack. Or, |
554 |
an implementation might choose to use one-time nonces or digests for |
555 |
POST or PUT requests and a time-stamp for GET requests. For more |
556 |
details on the issues involved see section 4 of this document. |
557 |
|
558 |
The nonce is opaque to the client. |
559 |
|
560 |
opaque |
561 |
A string of data, specified by the server, which should be returned |
562 |
by the client unchanged. It is recommended that this string be base64 |
563 |
or hexadecimal data. |
564 |
|
565 |
stale |
566 |
A flag, indicating that the previous request from the client was |
567 |
rejected because the nonce value was stale. If stale is TRUE (in |
568 |
upper or lower case), the client may wish to simply retry the request |
569 |
with a new encrypted response, without reprompting the user for a new |
570 |
username and password. The server should only set stale to true if it |
571 |
receives a request for which the nonce is invalid but with a valid |
572 |
digest for that nonce (indicating that the client knows the correct |
573 |
username/password). |
574 |
|
575 |
algorithm |
576 |
A string indicating a pair of algorithms used to produce the digest |
577 |
and a checksum. If this not present it is assumed to be "MD5". In |
578 |
|
579 |
Franks, et al. [Page 10] |
580 |
|
581 |
|
582 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
583 |
|
584 |
|
585 |
this document the string obtained by applying the digest algorithm to |
586 |
the data "data" with secret "secret" will be denoted by KD(secret, |
587 |
data), and the string obtained by applying the checksum algorithm to |
588 |
the data "data" will be denoted H(data). |
589 |
For the "MD5" algorithm |
590 |
|
591 |
H(data) = MD5(data) |
592 |
and |
593 |
|
594 |
KD(secret, data) = H(concat(secret, ":", data)) |
595 |
i.e., the digest is the MD5 of the secret concatenated with a |
596 |
colon concatenated with the data. |
597 |
|
598 |
digest-required |
599 |
If the value of the digest-required parameter is "true", then |
600 |
any request with an entity-body (such as a PUT or a POST) for |
601 |
the resource(s) to which this response applies MUST include |
602 |
the "digest" attribute in its Authorization header. If the |
603 |
request has no entity-body (such as a GET) then the digest- |
604 |
required value can be ignored. If the digest-required |
605 |
parameter is not specified, then its value is "false". If the |
606 |
value of the digest-required parameter is "false", then the |
607 |
"digest" attribute is OPTIONAL on requests for the resource(s) |
608 |
to which the response applies. |
609 |
|
610 |
|
611 |
3.2.2 The Authorization Request Header |
612 |
|
613 |
The client is expected to retry the request, passing an |
614 |
Authorization header line, which is defined as follows. |
615 |
|
616 |
Authorization = "Authorization" ":" "Digest" |
617 |
digest-response |
618 |
|
619 |
Digest-response = 1#( username | realm | nonce | digest-uri | |
620 |
response | [ digest ] | [ algorithm ] | |
621 |
opaque ) |
622 |
|
623 |
username = "username" "=" username-value |
624 |
username-value = quoted-string |
625 |
digest-uri = "uri" "=" digest-uri-value |
626 |
digest-uri-value = request-uri ; As specified by HTTP/1.1 |
627 |
response = "response" "=" response-digest |
628 |
digest = "digest" "=" entity-digest |
629 |
|
630 |
response-digest = <"> *LHEX <"> |
631 |
entity-digest = <"> *LHEX <"> |
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
Franks, et al. [Page 11] |
638 |
|
639 |
|
640 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
641 |
|
642 |
|
643 |
LHEX = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
644 |
|"8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" |
645 |
|
646 |
|
647 |
The values of the opaque and algorithm fields must be those |
648 |
supplied in the WWW-Authenticate response header for the entity |
649 |
being requested. |
650 |
|
651 |
If the value of the digest-required parameter is "true", the |
652 |
response to this request MUST either include the "digest" field |
653 |
in its Authentication-Info header or the response should be an |
654 |
error message indicating the server is unable or unwilling to |
655 |
supply this field. In the latter case the requested entity MUST |
656 |
not be returned as part of the response. If the digest-required |
657 |
parameter is not specified in the request, then its value is |
658 |
"false". If the value of the digest-required parameter is |
659 |
"false", then the "digest" attribute is OPTIONAL for the response |
660 |
to this request. |
661 |
|
662 |
The definitions of response-digest and entity-digest above |
663 |
indicate the encoding for their values. The following definitions |
664 |
show how the value is computed: |
665 |
|
666 |
response-digest = |
667 |
<"> < KD ( H(A1), unquoted nonce-value ":" H(A2) ) > <"> |
668 |
|
669 |
A1 = unquoted username-value ":" unquoted realm-value |
670 |
":" password |
671 |
password = < user's password > |
672 |
A2 = Method ":" digest-uri-value |
673 |
|
674 |
|
675 |
The "username-value" field is a "quoted-string". However, the |
676 |
surrounding quotation marks are removed in forming the string A1. |
677 |
Thus if the Authorization header includes the fields |
678 |
|
679 |
username="Mufasa", realm="myhost@testrealm.com" |
680 |
and the user Mufasa has password "CircleOfLife" then H(A1) would |
681 |
be H(Mufasa:myhost@testrealm.com:CircleOfLife) with no quotation |
682 |
marks in the digested string. |
683 |
|
684 |
No white space is allowed in any of the strings to which the |
685 |
digest function H() is applied unless that white space exists in |
686 |
the quoted strings or entity body whose contents make up the |
687 |
string to be digested. For example, the string A1 illustrated |
688 |
above must be Mufasa:myhost@testrealm.com:CircleOfLife with no |
689 |
white space on either side of the colons. Likewise, the other |
690 |
strings digested by H() must not have white space on either side |
691 |
|
692 |
|
693 |
Franks, et al. [Page 12] |
694 |
|
695 |
|
696 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
697 |
|
698 |
|
699 |
of the colons which delimit their fields unless that white space |
700 |
was in the quoted strings or entity body being digested. |
701 |
|
702 |
"Method" is the HTTP request method as specified in section 5.1 |
703 |
of [2]. The "request-uri" value is the Request-URI from the |
704 |
request line as specified in section 5.1 of [2]. This may be "*", |
705 |
an "absoluteURL" or an "abs_path" as specified in section 5.1.2 |
706 |
of [2], but it MUST agree with the Request-URI. In particular, it |
707 |
MUST be an "absoluteURL" if the Request-URI is an "absoluteURL". |
708 |
|
709 |
The authenticating server must assure that the document |
710 |
designated by the "uri" parameter is the same as the document |
711 |
served. The purpose of duplicating information from the request |
712 |
URL in this field is to deal with the possibility that an |
713 |
intermediate proxy may alter the client's request. This altered |
714 |
(but presumably semantically equivalent) request would not result |
715 |
in the same digest as that calculated by the client. |
716 |
|
717 |
The optional "digest" field contains a digest of the entity body |
718 |
and some of the associated entity headers. This digest can be |
719 |
useful in both request and response transactions. In a request it |
720 |
can insure the integrity of POST data or data being PUT to the |
721 |
server. In a response it insures the integrity of the served |
722 |
document. The value of the "digest" field is an <entity-digest>, |
723 |
which is defined as follows. |
724 |
|
725 |
entity-digest<"> KD (H(A1), unquoted nonce-value ":" Method ":" |
726 |
date ":" entity-info ":" H(entity-body)) <"> |
727 |
; format is <"> *LHEX <"> |
728 |
|
729 |
date = rfc1123-date ; see section 3.3.1 of[2] |
730 |
entity-info = |
731 |
H( |
732 |
digest-uri-value ":" |
733 |
media-type ":" ; Content-Type, see section 3.7 of [2] |
734 |
*DIGIT ":" ; Content-Length, see 10.12 of [2] |
735 |
content-coding ":" ; Content-Encoding, see 3.5 of [2] |
736 |
last-modified ":" ; last modified date, see 10.25 of [2] |
737 |
expires ; expiration date; see 10.19 of [2] |
738 |
) |
739 |
|
740 |
last-modified = rfc1123-date ; see section 3.3.1 of [2] |
741 |
expires = rfc1123-date |
742 |
|
743 |
|
744 |
The entity-info elements incorporate the values of the URI used |
745 |
to request the entity as well as the associated entity headers |
746 |
Content-Type, Content-Length, Content-Encoding, Last-Modified, |
747 |
and Expires. These headers are all end-to-end headers (see |
748 |
section 13.5.1 of [2]) which must not be modified by proxy |
749 |
|
750 |
|
751 |
Franks, et al. [Page 13] |
752 |
|
753 |
|
754 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
755 |
|
756 |
|
757 |
caches. The "entity-body" is as specified by section 10.13 of [2] |
758 |
or RFC 1864. The content length MUST always be included. The |
759 |
HTTP/1.1 spec requires that content length is well defined in all |
760 |
messages, whether or not there is a Content-Length header. |
761 |
|
762 |
Note that not all entities will have an associated URI or all of |
763 |
these headers. For example, an entity which is the data of a POST |
764 |
request will typically not have a digest-uri-value or Last- |
765 |
modified or Expires headers. If an entity does not have a digest- |
766 |
uri-value or a header corresponding to one of the entity-info |
767 |
fields, then that field is left empty in the computation of |
768 |
entity-info. All the colons specified above are present, however. |
769 |
For example the value of the entity-info associated with POST |
770 |
data which has content-type "text/plain", no content-encoding and |
771 |
a length of 255 bytes would be H(:text/plain:255:::). Similarly a |
772 |
request may not have a "Date" header. In this case the date field |
773 |
of the entity-digest should be empty. |
774 |
|
775 |
In the entity-info and entity-digest computations, except for the |
776 |
blank after the comma in "rfc1123-date", there must be no white |
777 |
space between "words" and "separators", and exactly one blank |
778 |
between "words" (see section 2.2 of [2]). |
779 |
|
780 |
Implementers should be aware of how authenticated transactions |
781 |
interact with proxy caches. The HTTP/1.1 protocol specifies that |
782 |
when a shared cache (see section 13.10 of [2]) has received a |
783 |
request containing an Authorization header and a response from |
784 |
relaying that request, it MUST NOT return that response as a |
785 |
reply to any other request, unless one of two Cache-Control (see |
786 |
section 14.9 of [2]) directives was present in the response. If |
787 |
the original response included the "must-revalidate" Cache- |
788 |
Control directive, the cache MAY use the entity of that response |
789 |
in replying to a subsequent request, but MUST first revalidate it |
790 |
with the origin server, using the request headers from the new |
791 |
request to allow the origin server to authenticate the new |
792 |
request. Alternatively, if the original response included the |
793 |
"public" Cache-Control directive, the response entity MAY be |
794 |
returned in reply to any subsequent request. |
795 |
|
796 |
|
797 |
3.2.3 The Authentication-Info Header |
798 |
|
799 |
When authentication succeeds, the server may optionally provide a |
800 |
Authentication-Info header indicating that the server wants to |
801 |
communicate some information regarding the successful |
802 |
authentication (such as an entity digest or a new nonce to be |
803 |
used for the next transaction). It has two fields, digest and |
804 |
nextnonce. Both are optional. |
805 |
|
806 |
AuthenticationInfo = "Authentication-Info" ":" |
807 |
1#( digest | nextnonce ) |
808 |
|
809 |
Franks, et al. [Page 14] |
810 |
|
811 |
|
812 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
813 |
|
814 |
|
815 |
nextnonce = "nextnonce" "=" nonce-value |
816 |
digest = "digest" "=" entity-digest |
817 |
|
818 |
|
819 |
The optional digest allows the client to verify that the body of |
820 |
the response has not been changed en-route. The server would |
821 |
probably only send this when it has the document and can compute |
822 |
it. The server would probably not bother generating this header |
823 |
for CGI output. The value of the "digest" is an <entity-digest> |
824 |
which is computed as described above. |
825 |
|
826 |
The value of the nextnonce parameter is the nonce the server |
827 |
wishes the client to use for the next authentication response. |
828 |
Note that either field is optional. In particular the server may |
829 |
send the Authentication-Info header with only the nextnonce field |
830 |
as a means of implementing one-time nonces. If the nextnonce |
831 |
field is present the client is strongly encouraged to use it for |
832 |
the next WWW- Authenticate header. Failure of the client to do so |
833 |
may result in a request to re-authenticate from the server with |
834 |
the "stale=TRUE ". |
835 |
|
836 |
The Authentication-Info header is allowed in the trailer of an |
837 |
HTTP message transferred via chunked transfer-coding. |
838 |
|
839 |
|
840 |
3.3 Digest Operation |
841 |
|
842 |
Upon receiving the Authorization header, the server may check its |
843 |
validity by looking up its known password which corresponds to |
844 |
the submitted username. Then, the server must perform the same |
845 |
MD5 operation performed by the client, and compare the result to |
846 |
the given response-digest. |
847 |
|
848 |
Note that the HTTP server does not actually need to know the |
849 |
user's clear text password. As long as H(A1) is available to the |
850 |
server, the validity of an Authorization header may be verified. |
851 |
|
852 |
A client may remember the username, password and nonce values, so |
853 |
that future requests within the specified <domain> may include |
854 |
the Authorization header preemptively. The server may choose to |
855 |
accept the old Authorization header information, even though the |
856 |
nonce value included might not be fresh. Alternatively, the |
857 |
server could return a 401 response with a new nonce value, |
858 |
causing the client to retry the request. By specifying stale=TRUE |
859 |
with this response, the server hints to the client that the |
860 |
request should be retried with the new nonce, without reprompting |
861 |
the user for a new username and password. |
862 |
|
863 |
The opaque data is useful for transporting state information |
864 |
around. For example, a server could be responsible for |
865 |
authenticating content which actually sits on another server. The |
866 |
|
867 |
Franks, et al. [Page 15] |
868 |
|
869 |
|
870 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
871 |
|
872 |
|
873 |
first 401 response would include a domain field which includes |
874 |
the URI on the second server, and the opaque field for specifying |
875 |
state information. The client will retry the request, at which |
876 |
time the server may respond with a 301/302 redirection, pointing |
877 |
to the URI on the second server. The client will follow the |
878 |
redirection, and pass the same Authorization header, including |
879 |
the <opaque> data which the second server may require. |
880 |
|
881 |
As with the basic scheme, proxies must be completely transparent |
882 |
in the Digest access authentication scheme. That is, they must |
883 |
forward the WWW-Authenticate, Authentication-Info and |
884 |
Authorization headers untouched. If a proxy wants to authenticate |
885 |
a client before a request is forwarded to the server, it can be |
886 |
done using the Proxy-Authenticate and Proxy-Authorization headers |
887 |
described in section 3.6 below. |
888 |
|
889 |
|
890 |
3.4 Security Protocol Negotiation |
891 |
|
892 |
It is useful for a server to be able to know which security |
893 |
schemes a client is capable of handling. |
894 |
|
895 |
It is possible that a server may want to require Digest as its |
896 |
authentication method, even if the server does not know that the |
897 |
client supports it. A client is encouraged to fail gracefully if |
898 |
the server specifies any authentication scheme it cannot handle. |
899 |
|
900 |
|
901 |
3.5 Example |
902 |
|
903 |
The following example assumes that an access-protected document |
904 |
is being requested from the server. The URI of the document is |
905 |
"http://www.nowhere.org/dir/index.html". Both client and server |
906 |
know that the username for this document is "Mufasa", and the |
907 |
password is "CircleOfLife". |
908 |
|
909 |
The first time the client requests the document, no Authorization |
910 |
header is sent, so the server responds with: |
911 |
|
912 |
HTTP/1.1 401 Unauthorized |
913 |
WWW-Authenticate: Digest |
914 |
realm="testrealm@host.com", |
915 |
nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", |
916 |
opaque="5ccc069c403ebaf9f0171e9517f40e41" |
917 |
|
918 |
|
919 |
The client may prompt the user for the username and password, |
920 |
after which it will respond with a new request, including the |
921 |
following Authorization header: |
922 |
|
923 |
Authorization: Digest username="Mufasa", |
924 |
|
925 |
Franks, et al. [Page 16] |
926 |
|
927 |
|
928 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
929 |
|
930 |
|
931 |
realm="testrealm@host.com", |
932 |
nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", |
933 |
uri="/dir/index.html", |
934 |
response="1949323746fe6a43ef61f9606e7febea", |
935 |
opaque="5ccc069c403ebaf9f0171e9517f40e41" |
936 |
|
937 |
3.6 Proxy-Authentication and Proxy-Authorization |
938 |
|
939 |
The digest authentication scheme may also be used for |
940 |
authenticating users to proxies, proxies to proxies, or proxies |
941 |
to end servers by use of the Proxy-Authenticate and Proxy- |
942 |
Authorization headers. These headers are instances of the general |
943 |
Proxy-Authenticate and Proxy-Authorization headers specified in |
944 |
sections 10.30 and 10.31 of the HTTP/1.1 specification [2] and |
945 |
their behavior is subject to restrictions described there. The |
946 |
transactions for proxy authentication are very similar to those |
947 |
already described. Upon receiving a request which requires |
948 |
authentication, the proxy/server must issue the "HTTP/1.1 401 |
949 |
Unauthorized" header followed by a "Proxy-Authenticate" header of |
950 |
the form |
951 |
|
952 |
Proxy-Authentication = "Proxy-Authentication" ":" |
953 |
"Digest" |
954 |
digest-challenge |
955 |
|
956 |
|
957 |
where digest-challenge is as defined above in section 2.1. The |
958 |
client/proxy must then re-issue the request with a Proxy- |
959 |
Authenticate header of the form |
960 |
|
961 |
Proxy-Authorization = "Proxy-Authorization" ":" |
962 |
digest-response |
963 |
|
964 |
|
965 |
where digest-response is as defined above in section 2.1. When |
966 |
authentication succeeds, the server may optionally provide a |
967 |
Proxy-Authentication-info header of the form |
968 |
|
969 |
Proxy-Authentication-Info = "Proxy-Authentication-Info" ":" |
970 |
nextnonce |
971 |
|
972 |
|
973 |
where nextnonce has the same semantics as the nextnonce field in |
974 |
the Authentication-Info header described above in section 3.2.3. |
975 |
|
976 |
Note that in principle a client could be asked to authenticate |
977 |
itself to both a proxy and an end-server. It might receive an |
978 |
"HTTP/1.1 401 Unauthorized" header followed by both a WWW- |
979 |
Authenticate and a Proxy-Authenticate header. However, it can |
980 |
never receive more than one Proxy-Authenticate header since such |
981 |
headers are only for immediate connections and must not be passed |
982 |
|
983 |
Franks, et al. [Page 17] |
984 |
|
985 |
|
986 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
987 |
|
988 |
|
989 |
on by proxies. If the client receives both headers, it must |
990 |
respond with both the Authorization and Proxy-Authorization |
991 |
headers as described above, which will likely involve different |
992 |
combinations of username, password, nonce, etc. |
993 |
|
994 |
|
995 |
4 Security Considerations |
996 |
|
997 |
|
998 |
4.1 Authentication of Clients using Basic Authentication |
999 |
|
1000 |
The Basic authentication scheme is not a secure method of user |
1001 |
authentication, nor does it in any way protect the entity, which is |
1002 |
transmitted in clear text across the physical network used as the |
1003 |
carrier. HTTP does not prevent additional authentication schemes and |
1004 |
encryption mechanisms from being employed to increase security or the |
1005 |
addition of enhancements (such as schemes to use one-time passwords) to |
1006 |
Basic authentication. |
1007 |
|
1008 |
The most serious flaw in Basic authentication is that it results in the |
1009 |
essentially clear text transmission of the user's password over the |
1010 |
physical network. It is this problem which Digest Authentication |
1011 |
attempts to address. |
1012 |
|
1013 |
Because Basic authentication involves the clear text transmission of |
1014 |
passwords it SHOULD never be used (without enhancements) to protect |
1015 |
sensitive or valuable information. |
1016 |
|
1017 |
A common use of Basic authentication is for identification purposes -- |
1018 |
requiring the user to provide a user name and password as a means of |
1019 |
identification, for example, for purposes of gathering accurate usage |
1020 |
statistics on a server. When used in this way it is tempting to think |
1021 |
that there is no danger in its use if illicit access to the protected |
1022 |
documents is not a major concern. This is only correct if the server |
1023 |
issues both user name and password to the users and in particular does |
1024 |
not allow the user to choose his or her own password. The danger arises |
1025 |
because naive users frequently reuse a single password to avoid the task |
1026 |
of maintaining multiple passwords. |
1027 |
|
1028 |
If a server permits users to select their own passwords, then the threat |
1029 |
is not only illicit access to documents on the server but also illicit |
1030 |
access to the accounts of all users who have chosen to use their account |
1031 |
password. If users are allowed to choose their own password that also |
1032 |
means the server must maintain files containing the (presumably |
1033 |
encrypted) passwords. Many of these may be the account passwords of |
1034 |
users perhaps at distant sites. The owner or administrator of such a |
1035 |
system could conceivably incur liability if this information is not |
1036 |
maintained in a secure fashion. |
1037 |
|
1038 |
Basic Authentication is also vulnerable to spoofing by counterfeit |
1039 |
servers. If a user can be led to believe that he is connecting to a host |
1040 |
|
1041 |
Franks, et al. [Page 18] |
1042 |
|
1043 |
|
1044 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1045 |
|
1046 |
|
1047 |
containing information protected by basic authentication when in fact he |
1048 |
is connecting to a hostile server or gateway then the attacker can |
1049 |
request a password, store it for later use, and feign an error. This |
1050 |
type of attack is not possible with Digest Authentication. Server |
1051 |
implementers SHOULD guard against the possibility of this sort of |
1052 |
counterfeiting by gateways or CGI scripts. In particular it is very |
1053 |
dangerous for a server to simply turn over a connection to a gateway. |
1054 |
That gateway can then use the persistent connection mechanism to engage |
1055 |
in multiple transactions with the client while impersonating the |
1056 |
original server in a way that is not detectable by the client. |
1057 |
|
1058 |
|
1059 |
4.2 Authentication of Clients using Digest Authentication |
1060 |
|
1061 |
Digest Authentication does not provide a strong authentication |
1062 |
mechanism. That is not its intent. It is intended solely to |
1063 |
replace a much weaker and even more dangerous authentication |
1064 |
mechanism: Basic Authentication. An important design constraint |
1065 |
is that the new authentication scheme be free of patent and |
1066 |
export restrictions. |
1067 |
|
1068 |
Most needs for secure HTTP transactions cannot be met by Digest |
1069 |
Authentication. For those needs SSL or SHTTP are more appropriate |
1070 |
protocols. In particular digest authentication cannot be used for |
1071 |
any transaction requiring encrypted content. Nevertheless many |
1072 |
functions remain for which digest authentication is both useful |
1073 |
and appropriate. |
1074 |
|
1075 |
|
1076 |
4.3 Offering a Choice of Authentication Schemes |
1077 |
|
1078 |
An HTTP/1.1 server may return multiple challenges with a 401 |
1079 |
(Authenticate) response, and each challenge may use a different scheme. |
1080 |
The order of the challenges returned to the user agent is in the order |
1081 |
that the server would prefer they be chosen. The server should order its |
1082 |
challenges with the "most secure" authentication scheme first. A user |
1083 |
agent should choose as the challenge to be made to the user the first |
1084 |
one that the user agent understands. |
1085 |
|
1086 |
When the server offers choices of authentication schemes using the WWW- |
1087 |
Authenticate header, the "security" of the authentication is only as |
1088 |
good as the security of the weakest of the authentication schemes. A |
1089 |
malicious user could capture the set of challenges and try to |
1090 |
authenticate him/herself using the weakest of the authentication |
1091 |
schemes. Thus, the ordering serves more to protect the user's |
1092 |
credentials than the server's information. |
1093 |
|
1094 |
A possible man-in-the-middle (MITM) attack would be to add a weak |
1095 |
authentication scheme to the set of choices, hoping that the client will |
1096 |
use one that exposes the user's credentials (e.g. password). For this |
1097 |
|
1098 |
|
1099 |
Franks, et al. [Page 19] |
1100 |
|
1101 |
|
1102 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1103 |
|
1104 |
|
1105 |
reason, the client should always use the strongest scheme that it |
1106 |
understands from the choices accepted. |
1107 |
|
1108 |
An even better MITM attack would be to remove all offered choices, and |
1109 |
to insert a challenge that requests Basic authentication. For this |
1110 |
reason, user agents that are concerned about this kind of attack could |
1111 |
remember the strongest authentication scheme ever requested by a server |
1112 |
and produce a warning message that requires user confirmation before |
1113 |
using a weaker one. A particularly insidious way to mount such a MITM |
1114 |
attack would be to offer a "free" proxy caching service to gullible |
1115 |
users. |
1116 |
|
1117 |
|
1118 |
4.4 Comparison of Digest with Basic Authentication |
1119 |
|
1120 |
Both Digest and Basic Authentication are very much on the weak |
1121 |
end of the security strength spectrum. But a comparison between |
1122 |
the two points out the utility, even necessity, of replacing |
1123 |
Basic by Digest. |
1124 |
|
1125 |
The greatest threat to the type of transactions for which these |
1126 |
protocols are used is network snooping. This kind of transaction |
1127 |
might involve, for example, online access to a database whose use |
1128 |
is restricted to paying subscribers. With Basic authentication an |
1129 |
eavesdropper can obtain the password of the user. This not only |
1130 |
permits him to access anything in the database, but, often worse, |
1131 |
will permit access to anything else the user protects with the |
1132 |
same password. |
1133 |
|
1134 |
By contrast, with Digest Authentication the eavesdropper only |
1135 |
gets access to the transaction in question and not to the user's |
1136 |
password. The information gained by the eavesdropper would permit |
1137 |
a replay attack, but only with a request for the same document, |
1138 |
and even that might be difficult. |
1139 |
|
1140 |
|
1141 |
4.5 Replay Attacks |
1142 |
|
1143 |
A replay attack against digest authentication would usually be |
1144 |
pointless for a simple GET request since an eavesdropper would |
1145 |
already have seen the only document he could obtain with a |
1146 |
replay. This is because the URI of the requested document is |
1147 |
digested in the client response and the server will only deliver |
1148 |
that document. By contrast under Basic Authentication once the |
1149 |
eavesdropper has the user's password, any document protected by |
1150 |
that password is open to him. A GET request containing form data |
1151 |
could only be "replayed" with the identical data. However, this |
1152 |
could be problematic if it caused a CGI script to take some |
1153 |
action on the server. |
1154 |
|
1155 |
|
1156 |
|
1157 |
Franks, et al. [Page 20] |
1158 |
|
1159 |
|
1160 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1161 |
|
1162 |
|
1163 |
Thus, for some purposes, it is necessary to protect against |
1164 |
replay attacks. A good digest implementation can do this in |
1165 |
various ways. The server created "nonce" value is implementation |
1166 |
dependent, but if it contains a digest of the client IP, a time- |
1167 |
stamp, and a private server key (as recommended above) then a |
1168 |
replay attack is not simple. An attacker must convince the server |
1169 |
that the request is coming from a false IP address and must cause |
1170 |
the server to deliver the document to an IP address different |
1171 |
from the address to which it believes it is sending the document. |
1172 |
An attack can only succeed in the period before the time-stamp |
1173 |
expires. Digesting the client IP and time-stamp in the nonce |
1174 |
permits an implementation which does not maintain state between |
1175 |
transactions. |
1176 |
|
1177 |
For applications where no possibility of replay attack can be |
1178 |
tolerated the server can use one-time response digests which will |
1179 |
not be honored for a second use. This requires the overhead of |
1180 |
the server remembering which digests have been used until the |
1181 |
nonce time-stamp (and hence the digest built with it) has |
1182 |
expired, but it effectively protects against replay attacks. |
1183 |
Instead of maintaining a list of the values of used digests, a |
1184 |
server would hash these values and require re-authentication |
1185 |
whenever a hash collision occurs. |
1186 |
|
1187 |
An implementation must give special attention to the possibility |
1188 |
of replay attacks with POST and PUT requests. A successful replay |
1189 |
attack could result in counterfeit form data or a counterfeit |
1190 |
version of a PUT file. The use of one-time digests or one-time |
1191 |
nonces is recommended. It is also recommended that the optional |
1192 |
<digest> be implemented for use with POST or PUT requests to |
1193 |
assure the integrity of the posted data. Alternatively, a server |
1194 |
may choose to allow digest authentication only with GET requests. |
1195 |
Responsible server implementors will document the risks described |
1196 |
here as they pertain to a given implementation. |
1197 |
|
1198 |
|
1199 |
4.6 Man in the Middle |
1200 |
|
1201 |
Both Basic and Digest authentication are vulnerable to "man in the |
1202 |
middle" attacks, for example, from a hostile or compromised proxy. |
1203 |
Clearly, this would present all the problems of eavesdropping. But it |
1204 |
could also offer some additional threats. |
1205 |
|
1206 |
A simple but effective attack would be to replace the Digest challenge |
1207 |
with a Basic challenge, to spoof the client into revealing their |
1208 |
password. To protect against this attack, clients should remember if a |
1209 |
site has used Digest authentication in the past, and warn the user if |
1210 |
the site stops using it. It might also be a good idea for the browser to |
1211 |
be configured to demand Digest authentication in general, or from |
1212 |
specific sites. |
1213 |
|
1214 |
|
1215 |
Franks, et al. [Page 21] |
1216 |
|
1217 |
|
1218 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1219 |
|
1220 |
|
1221 |
Or, a hostile proxy might spoof the client into making a request the |
1222 |
attacker wanted rather than one the client wanted. Of course, this is |
1223 |
still much harder than a comparable attack against Basic Authentication. |
1224 |
|
1225 |
There are several attacks on the "digest" field in the Authentication- |
1226 |
Info header. A simple but effective attack is just to remove the field, |
1227 |
so that the client will not be able to use it to detect modifications to |
1228 |
the response entity. Sensitive applications may wish to allow |
1229 |
configuration to require that the digest field be present when |
1230 |
appropriate. More subtly, the attacker can alter any of the entity- |
1231 |
headers not incorporated in the computation of the digest. The attacker |
1232 |
can alter most of the request headers in the client's request, and can |
1233 |
alter any response header in the origin-server's reply, except those |
1234 |
headers whose values are incorporated into the "digest" field. |
1235 |
|
1236 |
Alteration of Accept* or User-Agent request headers can only result in a |
1237 |
denial of service attack that returns content in an unacceptable media |
1238 |
type or language. Alteration of cache control headers also can only |
1239 |
result in denial of service. Alteration of Host will be detected, if the |
1240 |
full URL is in the response-digest. Alteration of Referer or From is not |
1241 |
important, as these are only hints. |
1242 |
|
1243 |
|
1244 |
4.7 Spoofing by Counterfeit Servers |
1245 |
|
1246 |
Basic Authentication is vulnerable to spoofing by counterfeit servers. |
1247 |
If a user can be led to believe that she is connecting to a host |
1248 |
containing information protected by a password she knows, when in fact |
1249 |
she is connecting to a hostile server, then the hostile server can |
1250 |
request a password, store it away for later use, and feign an error. |
1251 |
This type of attack is more difficult with Digest Authentication -- but |
1252 |
the client must know to demand that Digest authentication be used, |
1253 |
perhaps using some of the techniques described above to counter "man-in- |
1254 |
the-middle" attacks. |
1255 |
|
1256 |
|
1257 |
4.8 Storing passwords |
1258 |
|
1259 |
Digest authentication requires that the authenticating agent (usually |
1260 |
the server) store some data derived from the user's name and password in |
1261 |
a "password file" associated with a given realm. Normally this might |
1262 |
contain pairs consisting of username and H(A1), where H(A1) is the |
1263 |
digested value of the username, realm, and password as described above. |
1264 |
|
1265 |
The security implications of this are that if this password file is |
1266 |
compromised, then an attacker gains immediate access to documents on the |
1267 |
server using this realm. Unlike, say a standard UNIX password file, this |
1268 |
information need not be decrypted in order to access documents in the |
1269 |
server realm associated with this file. On the other hand, decryption, |
1270 |
or more likely a brute force attack, would be necessary to obtain the |
1271 |
user's password. This is the reason that the realm is part of the |
1272 |
|
1273 |
Franks, et al. [Page 22] |
1274 |
|
1275 |
|
1276 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1277 |
|
1278 |
|
1279 |
digested data stored in the password file. It means that if one digest |
1280 |
authentication password file is compromised, it does not automatically |
1281 |
compromise others with the same username and password (though it does |
1282 |
expose them to brute force attack). |
1283 |
|
1284 |
There are two important security consequences of this. First the |
1285 |
password file must be protected as if it contained unencrypted |
1286 |
passwords, because for the purpose of accessing documents in its realm, |
1287 |
it effectively does. |
1288 |
|
1289 |
A second consequence of this is that the realm string should be unique |
1290 |
among all realms which any single user is likely to use. In particular a |
1291 |
realm string should include the name of the host doing the |
1292 |
authentication. The inability of the client to authenticate the server |
1293 |
is a weakness of Digest Authentication. |
1294 |
|
1295 |
|
1296 |
4.9 Summary |
1297 |
|
1298 |
By modern cryptographic standards Digest Authentication is weak. But for |
1299 |
a large range of purposes it is valuable as a replacement for Basic |
1300 |
Authentication. It remedies many, but not all, weaknesses of Basic |
1301 |
Authentication. Its strength may vary depending on the implementation. |
1302 |
In particular the structure of the nonce (which is dependent on the |
1303 |
server implementation) may affect the ease of mounting a replay attack. |
1304 |
A range of server options is appropriate since, for example, some |
1305 |
implementations may be willing to accept the server overhead of one-time |
1306 |
nonces or digests to eliminate the possibility of replay. Others may |
1307 |
satisfied with a nonce like the one recommended above restricted to a |
1308 |
single IP address and with a limited lifetime. |
1309 |
|
1310 |
The bottom line is that *any* compliant implementation will be |
1311 |
relatively weak by cryptographic standards, but *any* compliant |
1312 |
implementation will be far superior to Basic Authentication. |
1313 |
|
1314 |
|
1315 |
5 Acknowledgments |
1316 |
|
1317 |
In addition to the authors, valuable discussion instrumental in creating |
1318 |
this document has come from Peter J. Churchyard, Ned Freed, and David M. |
1319 |
Kristol. |
1320 |
|
1321 |
Jim Gettys edited this document for its update. |
1322 |
|
1323 |
|
1324 |
6 References |
1325 |
|
1326 |
[1] Berners-Lee, T., Fielding, R., and H. Frystyk, "Hypertext |
1327 |
Transfer Protocol -- HTTP/1.0", RFC 1945, May 1996. |
1328 |
|
1329 |
|
1330 |
|
1331 |
Franks, et al. [Page 23] |
1332 |
|
1333 |
|
1334 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1335 |
|
1336 |
|
1337 |
[2] Fielding, R., Gettys, J., Mogul, J. C., Frysyk, H, Berners-Lee, |
1338 |
T., " Hypertext Transfer Protocol -- HTTP/1.1", Work In Progress of |
1339 |
the HTTP working group, November 1997. |
1340 |
|
1341 |
[3] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, April |
1342 |
1992. |
1343 |
|
1344 |
|
1345 |
[4] Freed, N., and N. Borenstein. "Multipurpose Internet Mail |
1346 |
Extensions (MIME) Part One: Format of Internet Message Bodies." RFC |
1347 |
2045, Innosoft, First Virtual, November 1996. |
1348 |
|
1349 |
|
1350 |
[5] Dierks, T. and C. Allen "The TLS Protocol, Version 1.0," Work In |
1351 |
Progress of the TLS working group, November, 1997. |
1352 |
|
1353 |
|
1354 |
[6] Franks, J., Hallam-Baker, P., Hostetler, J., Leach, P., |
1355 |
Luotonen, A., Sink, E., Stewart, L.," An Extension to HTTP : Digest |
1356 |
Access Authentication." RFC 2069, January, 1997. |
1357 |
|
1358 |
[7] Berners Lee, T, Fielding, R., Masinter, L., "Uniform Resource |
1359 |
Identifiers (URI): Generic Syntax and Semantics ," Work in Progress, |
1360 |
November, 1997. |
1361 |
|
1362 |
|
1363 |
7 Authors' Addresses |
1364 |
|
1365 |
John Franks |
1366 |
Professor of Mathematics |
1367 |
Department of Mathematics |
1368 |
Northwestern University |
1369 |
Evanston, IL 60208-2730, USA |
1370 |
|
1371 |
EMail: john@math.nwu.edu |
1372 |
|
1373 |
Phillip M. Hallam-Baker |
1374 |
Principal Consultant |
1375 |
Verisign Inc. |
1376 |
One Alewife Center |
1377 |
Cambridge, MA 02138, USA |
1378 |
|
1379 |
EMail: pbaker@verisign.com |
1380 |
|
1381 |
Jeffery L. Hostetler |
1382 |
Senior Software Engineer |
1383 |
Spyglass, Inc. |
1384 |
3200 Farber Drive |
1385 |
Champaign, IL 61821, USA |
1386 |
|
1387 |
EMail: jeff@spyglass.com |
1388 |
|
1389 |
Franks, et al. [Page 24] |
1390 |
|
1391 |
|
1392 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1393 |
|
1394 |
|
1395 |
Paul J. Leach |
1396 |
Microsoft Corporation |
1397 |
1 Microsoft Way |
1398 |
Redmond, WA 98052, USA |
1399 |
|
1400 |
EMail: paulle@microsoft.com |
1401 |
|
1402 |
Ari Luotonen |
1403 |
Member of Technical Staff |
1404 |
Netscape Communications Corporation |
1405 |
501 East Middlefield Road |
1406 |
Mountain View, CA 94043, USA |
1407 |
|
1408 |
EMail: luotonen@netscape.com |
1409 |
|
1410 |
Eric W. Sink |
1411 |
Senior Software Engineer |
1412 |
Spyglass, Inc. |
1413 |
3200 Farber Drive |
1414 |
Champaign, IL 61821, USA |
1415 |
|
1416 |
EMail: eric@spyglass.com |
1417 |
|
1418 |
Lawrence C. Stewart |
1419 |
Open Market, Inc. |
1420 |
215 First Street |
1421 |
Cambridge, MA 02142, USA |
1422 |
|
1423 |
EMail: stewart@OpenMarket.com |
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
Franks, et al. [Page 25] |
1448 |
|
1449 |
|
1450 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1451 |
|
1452 |
|
1453 |
Index |
1454 |
|
1455 |
While some care was taken producing this index, there is no guarantee |
1456 |
that all occurrences of an index term have been entered into the index. |
1457 |
Italics indicate the definition of a term; bold face is used for the |
1458 |
definition of a header. |
1459 |
|
1460 |
|
1461 |
credentials, 6 |
1462 |
|
1463 |
|
1464 |
301, 16 |
1465 |
13 |
1466 |
digest, 11, 12, 13, 14, 15, 21, |
1467 |
22 |
1468 |
Digest Access Authentication, 2, |
1469 |
401, 5, 6, 9, 10, 15, 16, 17, 19 8, 9 |
1470 |
407, 5, 6 Digest Authentication, 18, 19 |
1471 |
411, 6 digest-challenge, 9, 17 |
1472 |
digest-required, 9, 11, 12 |
1473 |
digest-response, 11, 17 |
1474 |
digest-uri, 11 |
1475 |
absoluteURL, 13 digest-uri-value, 11, 12, 13, 14 |
1476 |
Accept*, 22 domain, 9, 10, 15, 16 |
1477 |
Access Authentication, 5 |
1478 |
algorithm, 8, 9, 10, 11, 12 |
1479 |
AuthenticationInfo, 302, 16 date, 14 |
1480 |
Authentication-Info, 9, 12, 14, entity-body, 13, 14 |
1481 |
15, 16, 17, 22 entity-digest, 11, 12, 13, 14, 15 |
1482 |
Authorization, 5, 6, 7, 9, 11, entity-info, 13, 14 |
1483 |
12, 14, 15, 16, 17, 18 expires, 13 |
1484 |
auth-param, 5 Expires, 13, 14 |
1485 |
auth-scheme, 5 |
1486 |
|
1487 |
|
1488 |
From, 22 |
1489 |
base64-user-pass, 7 |
1490 |
Basic Access Authentication, 1, |
1491 |
7, 8 |
1492 |
Basic authentication, 7, 18, 20 GET, 10, 11, 20, 21 |
1493 |
Basic Authentication Scheme, 6 |
1494 |
basic-credentials, 7 |
1495 |
|
1496 |
last-modified, 13 |
1497 |
Last-Modified, 13 |
1498 |
Cache-Control, 14 LHEX, 11, 12, 13 |
1499 |
challenge, 5 |
1500 |
content-coding, 13 |
1501 |
Content-Encoding, 13 |
1502 |
Content-Length, 13 MD5, 8, 9, 10, 11, 15, 24 |
1503 |
Content-Type, 13 media-type, 13 |
1504 |
|
1505 |
Franks, et al. [Page 26] |
1506 |
|
1507 |
|
1508 |
INTERNET-DRAFT HTTP Authentication Friday 21 November 1997 |
1509 |
|
1510 |
|
1511 |
Method, 12, 13 response, 11, 17 |
1512 |
MIME, 24 response-digest, 11, 12, 15, 22 |
1513 |
must-revalidate, 14 rfc1123-date, 13, 14 |
1514 |
|
1515 |
|
1516 |
|
1517 |
, 17 Security Considerations |
1518 |
nonce, 8, 9, 10, 11, 14, 15, 16, basic scheme is insecure, 18 |
1519 |
17, 18, 21, 23 comparison of digest with basic, |
1520 |
nonce-value, 9, 12, 13, 15 20 |
1521 |
man in the middle attacks, 21 |
1522 |
offering multiple authentication |
1523 |
schemes, 19 |
1524 |
opaque, 9, 10, 11, 12, 15, 16, 17 replay attacks against digest nextnonce, 14, 15 |
1525 |
authentication, 20 |
1526 |
spoofing by counterfeit servers, |
1527 |
22 |
1528 |
password, 1, 7, 8, 9, 10, 12, 15, digest weak, 23 |
1529 |
16, 18, 20, 21, 22, 23 separators, 14 |
1530 |
POST, 10, 11, 13, 14, 21 stale, 9, 10, 15 |
1531 |
Proxy-Authenticate, 5, 6, 7, 16, |
1532 |
17 |
1533 |
Proxy-Authentication, 17 |
1534 |
Proxy-Authentication-Info, 17 token, 5 |
1535 |
Proxy-Authorization, 6 true, 12 |
1536 |
public, 14 |
1537 |
PUT, 10, 11, 13, 21 |
1538 |
|
1539 |
User-Agent, 22 |
1540 |
userid, 7 |
1541 |
quoted-string, 5, 9, 11, 12 username, 8, 9, 10, 11, 12, 15, |
1542 |
16, 18, 22, 23 |
1543 |
username-value, 11, 12 |
1544 |
user-pass, 7 |
1545 |
realm, 5, 9, 11, 12, 16, 17, 22, |
1546 |
23 |
1547 |
realm-value, 5, 12 |
1548 |
Referer, 22 words, 14 |
1549 |
request-uri, 11, 13 WWW-Authenticate, 5, 6, 7, 9, 12, |
1550 |
Request-URI, 6, 7, 13 16, 17, 19 |
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
Franks, et al. [Page 27] |