Digest access authentication: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Alter: template type. Add: s2cid, doi, date, newspaper, authors 1-7. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | Suggested by Anderjef | #UCB_toolbar
OAbot (talk | contribs)
m Open access bot: url-access updated in citation with #oabot.
 
(27 intermediate revisions by 24 users not shown)
Line 3:
'''Digest access authentication''' is one of the agreed-upon methods a [[web server]] can use to negotiate credentials, such as username or password, with a user's [[web browser]]. This can be used to confirm the identity of a user before sending sensitive information, such as online banking transaction history. It applies a [[hash function]] to the username and [[password]] before sending them over the network. In contrast, [[basic access authentication]] uses the easily reversible [[Base64]] encoding instead of hashing, making it non-secure unless used in conjunction with [[Transport Layer Security|TLS]].
 
Technically, digest authentication is an application of [[MD5]] [[cryptographic hash]]ing with usage of [[cryptographic nonce|nonce]] values to prevent [[replay attack]]s. It uses the [[Hypertext Transfer Protocol|HTTP]] protocol.
 
DIGEST-MD5 as a [[Simple_Authentication_and_Security_Layer|SASL]] mechanism specified by {{IETF RFC|2831}} is obsolete since July 2011.<ref>[https://datatracker.ietf.org/doc/html/rfc6331 Moving DIGEST-MD5 to Historic, July 2011].</ref>
 
== Overview ==
 
Digest access authentication was originally specified by RFC{{IETF RFC|2069}} (''An Extension to HTTP: Digest Access Authentication''). RFC 2069 specifies roughly a traditional digest authentication scheme with security maintained by a server-generated ''[[Cryptographic nonce|nonce value]]''. The authentication response is formed as follows (where HA1 and HA2 are names of string variables):
 
:<syntaxhighlight lang="text">
Line 17 ⟶ 19:
An MD5 hash is a 16-byte value. The HA1 and HA2 values used in the computation of the response are the hexadecimal representation (in lowercase) of the MD5 hashes respectively.
 
RFC 2069 was later replaced by RFC{{IETF RFC|2617}} (''HTTP Authentication: Basic and Digest Access Authentication''). RFC 2617 introduced a number of optional security enhancements to digest authentication; '''"quality of protection" (qop)''', nonce counter incremented by client, and a client-generated random nonce. These enhancements are designed to protect against, for example, [[chosen-plaintext attack]] [[cryptanalysis]].
 
If the algorithm directive's value is "MD5" or unspecified, then HA1 is
Line 57 ⟶ 59:
The above shows that when qop is not specified, the simpler RFC 2069 standard is followed.
 
In September 2015, RFC 7616 replaced RFC 2617 by adding 4 new [[Algorithm|algorithms]]: "SHA-256", "SHA-256-sess", "SHA-512-256" and "SHA-512-256-sess". The encoding is equivalent to "MD5" and "MD5-sess" algorithms, with [[MD5|MD5 hashing function]] replaced with [[SHA-256]] and [[SHA-256|SHA-512-256]]. However, {{as of July |2021|7|lc=y}}, none of popular browsers, including Firefox<ref>{{cite web |title=Bug 472823: SHA 256 Digest Authentication |url=https://bugzilla.mozilla.org/show_bug.cgi?id=472823 |website=Mozilla Bugzilla}}</ref> and Chrome,<ref>{{cite web |title= Issue 1160478: SHA-256 for HTTP Digest Access Authentication in accordance with rfc7616 |url=https://bugs.chromium.org/p/chromium/issues/detail?id=1160478 |website=Chromium bugs}}</ref> support SHA-256 as the hash function. {{As of October |2021|10}}, Firefox 93<ref>{{cite web |title=Bug 472823: SHA 256 Digest Authentication |url=https://bugzilla.mozilla.org/show_bug.cgi?id=472823 |website=Mozilla Bugzilla}}</ref> officially supports "SHA-256" and "SHA-256-sess" algorithms for digest authentication. However, support for "SHA-512-256", "SHA-512-256-sess" algorithms and username hashing<ref>{{cite news |title=IETF.org: RFC 7616 Username Hashing |url=https://datatracker.ietf.org/doc/html/rfc7616#section-3.4.4 |newspaper=Ietf Datatracker|date=30 September 2015 }}</ref> is still lacking.<ref>{{cite web |title=Mozilla-central: support SHA-256 HTTP Digest auth |url=https://hg.mozilla.org/mozilla-central/rev/7a4994734e00 |website=Mozilla-central}}</ref> {{As of|2023|8}}, Chromium 117 (then Chrome and Edge) supports "SHA-256".<ref>{{cite web |title=Chrome Feature: RFC 7616 Digest auth: Support SHA-256 and username hashing|url=https://chromestatus.com/feature/5139896267702272?context=myfeatures}}</ref>
 
== Impact of MD5 security on digest authentication ==
Line 70 ⟶ 72:
| archiveurl = https://web.archive.org/web/20100306180648/http://www.cryptography.com/cnews/hash.html
| archivedate = 2010-03-06
}}{{better source needed|date=June 2010|reason=NOTE: Specific information not given; needs quote from exact version of this page originally cited.}}</ref> However, claims in 2006<ref>{{cite web
| url = https://eprint.iacr.org/2006/187.pdf
| title = On the Security of HMAC and NMAC Based on HAVAL, MD4, MD5, SHA-0 and SHA-1
|author1=Jongsung Kim |author2=Alex Biryukov |author3=Bart Preneel |author4=Seokhie Hong | publisher = [[International Association for Cryptologic Research|IACR]]
}}</ref> cause some doubt over other MD5 applications as well. So far, however, MD5 collision attacks have not been shown to pose a threat to digest authentication{{Citation needed|date=November 2014}}, and the RFC 2617 allows servers to implement mechanisms to detect some collision and [[replay attack]]s.
 
== HTTP digest authentication considerations ==
{{Unreferenced section|date=July 2024}}
 
=== Advantages ===
Line 86 ⟶ 89:
* The password is not sent clear to the server.
* The password is not used directly in the digest, but rather HA1 = MD5(username:realm:password). This allows some implementations (e.g. [[JBoss]]<ref>{{cite web
|url | url = https://community.jboss.org/wiki/DIGESTAuth
|title | title = DIGEST Authentication (4.0.4+)
|author | author = Scott Stark
|date | date = 2005-10-08
|publisher | publisher = [[JBoss]]
|access-date = 2013-03-04
|archive-date = 2015-10-18
|archive-url = https://web.archive.org/web/20151018155102/https://community.jboss.org/wiki/DIGESTAuth
|url-status = dead
}}</ref>) to store HA1 rather than the cleartext password (however, see disadvantages of this approach)
* Client nonce was introduced in RFC 2617, which allows the client to prevent [[chosen-plaintext attack]]s, such as [[rainbow table]]s that could otherwise threaten digest authentication schemes
Line 103 ⟶ 110:
* Many of the security options in RFC 2617 are optional. If quality-of-protection (qop) is not specified by the server, the client will operate in a security-reduced legacy RFC 2069 mode
* Digest access authentication is vulnerable to a [[Man-in-the-middle attack|man-in-the-middle (MITM) attack]]. For example, a MITM attacker could tell clients to use basic access authentication or legacy RFC2069 digest access authentication mode. To extend this further, digest access authentication provides no mechanism for clients to verify the server's identity
* A server can store HA1 = MD5(username:realm:password) instead of the password itself. However, if the stored HA1 is leaked, an attacker can generate valid responses and access documents in the realm just as easily as if they had access to the password itself. The table of HA1 values must therefore be protected as securely as a file containing plaintext passwords. <ref>{{cite journal
| url = https://tools.ietf.org/html/rfc2617#section-4.13
| title = HTTP Authentication: Basic and Digest Access Authentication: Storing passwords
Line 124 ⟶ 131:
| first7 = L.
| s2cid = 27137261
| url-access = subscription
}}</ref>
* Digest access authentication prevents the use of a strong password hash (such as [[bcrypt]]) when storing passwords (since either the password, or the digested username, realm and password must be recoverable)
Line 144 ⟶ 152:
* [[Kerberos (protocol)|Kerberos]] or [[SPNEGO]] authentication, employed for example by [[Microsoft IIS]] running configured for [[Integrated Windows Authentication]] (IWA).
* [[Secure Remote Password protocol]] (preferably within the [[HTTPS]] / [[Transport Layer Security|TLS]] layer). However, this is not implemented by any mainstream browsers.
* [[JSON Web Token]] (JWT) is a [[JSON]]-based standard RFC 7519 for creating [[Accessaccess token|access tokens]]s that assert some number of claims.
 
== Example with explanation ==
 
The following example was originally given in RFC 2617 and is expanded here to show the full text expected for each [[HTTP request|request]] and [[HTTP response|response]]. Note that only the "auth" (authentication) quality of protection code is covered&nbsp;– {{as of|2005|04|lc=y}},<!-- https://en.wikipedia.org/w/index.php?title=Digest_access_authentication&diff=prev&oldid=12216793 --> only the [[Opera (web browser)|Opera]] and [[Konqueror]] web browsers are known to support "auth-int" (authentication with integrity protection).{{citation needed|date=January 2024}} Although the specification mentions HTTP version 1.1, the scheme can be successfully added to a version 1.0 server, as shown here.
 
This typical transaction consists of the following steps:
Line 308 ⟶ 316:
}}</ref> (not including auth-int)
* [[Presto (layout engine)|Presto]]-based:
** [[Opera (web browser)|Opera]] (Opera switched away from Presto in 2013)<ref>{{cite web |last1=Anthony |first1=Sebastian |title=Opera admits defeat, switches to Google's Chromium |url=https://www.extremetech.com/computing/148312-opera-drops-presto-switch-to-google-and-apples-webkit-rendering-engine |website=Extreme Tech |publisher=Ziff Davis |access-date=19 January 2024 |date=February 13, 2013}}</ref>
** [[Opera (web browser)|Opera]]
** [[Opera Mobile]]
** [[Opera Mini]]
Line 318 ⟶ 326:
== Deprecations ==
Because of the disadvantages of Digest authentication compared to Basic authentication over HTTPS it has been deprecated by a lot of software e.g.:
* Bitbucket<ref>{{Cite web |last=DeLorenzo |first=Ike |date=2015-04-03 |title=Fare-thee-well, Digest access authentication |url=https://bitbucket.org/blog/fare-thee-well-digest-access-authentication |access-date=2025-01-21 |website=Bitbucet |archive-url=https://web.archive.org/web/20240423145906/https://bitbucket.org/blog/fare-thee-well-digest-access-authentication |archive-date=2024-04-23}}</ref>
* Symfony PHP framework<ref>{{Cite web |title=[RFC] Deprecate HTTP Digest authentication · Issue #24325 · symfony/symfony |url=https://github.com/symfony/symfony/issues/24325 |access-date=2025-01-21 |archive-url=https://web.archive.org/web/20231012074234/https://github.com/symfony/symfony/issues/24325 |archive-date=2023-10-12 |website=GitHub |language=en}}</ref>
* Symfony PHP framework: https://github.com/symfony/symfony/issues/24325
 
== See also ==
Line 337 ⟶ 345:
== External links ==
* [https://datatracker.ietf.org/doc/html/rfc7235 RFC 7235]
* [https://datatracker.ietf.org/doc/html/rfc6331 RFC 6331]
* [https://datatracker.ietf.org/doc/html/rfc2617 RFC 2617] (updated by RFC 7235)
* [https://datatracker.ietf.org/doc/html/rfc2069 RFC 2069] (obsolete)