Digest Authentication: How the Challenge-and-Response Login Works
Digest authentication lets a web server check a password without receiving the password itself in each request. The browser sends a calculated answer to a challenge, but the rest of the conversation still needs its own protection.
It's an authentication method for HTTP, short for Hypertext Transfer Protocol, the rules browsers and servers use to exchange web requests and responses. Authentication means checking a claimed identity.
The challenge changes the answer
Suppose you're opening a protected equipment dashboard. Your browser requests the page, and the server replies with a challenge before it'll let you in.
That challenge includes a realm, a name identifying the protected area, and a nonce, a server-chosen value used in calculating the reply. The nonce helps tie the answer to this authentication exchange.
Your browser combines password-related information with the challenge and details of its request. It uses a hash function, a calculation that turns input into a fixed-length result, to produce the response, or digest.
The server calculates the expected response using its stored account information and compares the answers. A matching response supplies evidence that the browser has the required secret; it isn't simply sending a permanent password hash for comparison.
How Can a Website Check a Password It Does Not Store?
The Digest specification also includes a browser-generated challenge value and a request counter. Checking these details helps the server detect a replay attack, where someone resends a captured response to impersonate the user.
Don't assume a nonce must expire after exactly one request: implementations can reuse one across requests while tracking that counter.
A successful login has limits
The account still needs permission to do the requested job. A technician might be allowed to read the dashboard but barred from changing its settings.
That's authorization, the decision about allowed actions, rather than authentication. Mozilla's HTTP guide describes how a server can reject a request even when the supplied credentials are valid.
Digest also differs from Basic authentication, which sends a username and password in Base64, an easily reversible text encoding. Without an encrypted connection, anyone who captures Basic's credentials can decode them.
Digest avoids sending that directly recoverable password, but its response isn't a guarantee against password theft.
- Learn to find the flaws in a web app before someone else does.
- Understand injection, broken logins and logic bugs well enough to fix them.
- Build the skills that web security jobs ask for.
Captured answers can still reveal a weak password
An attacker who captures a Digest exchange can try candidate passwords and calculate the answers they'd produce. A matching answer can reveal the password without repeated attempts at the real login screen.
That's a dictionary attack: testing likely passwords and predictable variations. Apache's Digest documentation warns that its MD5-based implementation allows fast guessing and that stolen Digest password-file entries can be used directly to impersonate users within the protected realm.
MD5 is the older hash algorithm used by that Apache module; newer Digest specifications also support algorithms such as SHA-256. Changing the hash algorithm doesn't rescue a password that's easy to guess.
Why HTTPS still belongs here
HTTPS adds Transport Layer Security, or TLS, to HTTP. TLS encrypts the connection, meaning it scrambles the exchanged information, and checks for tampering in transit.
That protection covers the requested pages and submitted information as well as the authentication exchange, as Mozilla's TLS explanation describes.
If you're maintaining a system that offers Digest, check its actual software support and use HTTPS. The word “Digest” in a settings menu doesn't tell you whether the connection is private or the stored account secrets are well protected.
Basic Authentication: Why an Encoded Password Still Needs HTTPS

CHAP: A Password Can Stay Hidden and Still Be Guessed

HTTP: The Requests and Replies That Make the Web Work

QUOTE:
"Amateurs hack systems, professionals hack people."
