I am working through my textbook and I came across this question:
Below is the message format for a browser response to access a password-protected web page using HTTP digest authentication.
GET URI HTTP/1.1 Host: URL ... Authorization: Digest username="UserName", realm="Realm", nonce="Nonce", uri="URI", algorithm=MD5, response="Response", qop=QoP, nc=NonceCount, cnonce="ClientNonce"
How will the server validate this response?
I came up with this scheme:
1. Use UserName and Realm to retrieve D1 = md5sum(Username:Realm:Password) from the password file. 2. Compute D2 = md5sum(GET:URI). 3. Compute r = md5sum(D1 : Nonce:NonceCount:ClientNonce:QoP:D2). 4. If r == Response, authentication succeeds and return the content of URI; otherwise authentication fails and return an error code.
Is this correct or are there any flaws in my method?
The only thing I can think of is that a Man in the Middle attacker could tell clients to use basic access authentication because digest authentication provides no mechanism for clients to verify the server's identity. It may also be vulnerable to replay attacks, i.e., if the client can replay the message digest created by the encryption, the server will allow access to the client.