Search code examples
c++http-authenticationdigest-authentication

Browser support of nextnonce directive in HTTP digest authentication


I've done a C++ based HTTP server (or to rephrase - spilled another drop in the ocean) and encountered an issue with HTTP digest authentication.

According to the HTTP authentication RFC using the nextnonce directive in the Authentication-Info header is a valid way of implementing a single use nonce mechanism. I've done this according to the RFC but both Chrome and Firefox seem to ignore the directive and issue all further requests with the initial nonce thus triggering unneeded 401 responses. An example illustration with Firefox:

First request - my server returns 401 and issues the initial nonce a1f778b2afc8590e4a64f414f663128b enter image description here

Firefox successfully authenticates and gets a reply with the Authentication-Info: nextnonce="0b72e74afbcab33a5aba05d4db03b801" header enter image description here

Firefox issues a new request to fetch image from the returned html - still the initial nonce c1587dd7be6251fa715540e0d6121aa5 is used and thus a reply with a new nonce and a flag that the provided nonce is expired is sent back. enter image description here

Same scenario as for the first image request. enter image description here

Now authentication succeeds with the new nonce. enter image description here

The authentication succeeds for the second request as well. enter image description here

As can be seen in the images - even though I reply with Authentication-Info: nextnonce="0b72e74afbcab33a5aba05d4db03b801" upon a successful authorization on the first request the next two requests still use the original nonce instead of the provided nextnonce value. Has anyone had a similar experience? I am most certainly doing something wrong - even though the RFC says that the client SHOULD reply with the provided nextnonce value and thus it is not mandatory I highly doubt that the most popular browsers do not use this technique.


Solution

  • Looks like it's a known Firefox bug that's been open since 2001.

    Bug 150605 - digest authentication problem: Mozilla ignores the nextnonce parameter of Authentication-Info Response Header.
    which is a duplicate of
    Bug 116177 - next nonce digest auth test fails