]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix validation of Digest auth header parameters (#1906)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Mon, 7 Oct 2024 08:13:17 +0000 (08:13 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 8 Oct 2024 09:33:29 +0000 (09:33 +0000)
Insufficient validation of Digest authentication parameters resulted in
a DigestCalcHA1() call that dereferenced a nil pointer.

This bug was discovered and detailed by Joshua Rogers at
https://megamansec.github.io/Squid-Security-Audit/ where it was filed as
"strlen(NULL) Crash Using Digest Authentication".

src/auth/digest/Config.cc

index e00e15099b8665cf7bf1453c2f7111e90ab3c510..a412521086124730c43b9e407649b066cb914609 100644 (file)
@@ -967,13 +967,19 @@ Auth::Digest::Config::decode(char const *proxy_auth, const HttpRequest *request,
             return rv;
         }
     } else {
-        /* cnonce and nc both require qop */
-        if (digest_request->cnonce || digest_request->nc[0] != '\0') {
-            debugs(29, 2, "missing qop!");
-            rv = authDigestLogUsername(username, digest_request, aRequestRealm);
-            safe_free(username);
-            return rv;
-        }
+        /* RFC7616 section 3.3, qop:
+         *  "MUST be used by all implementations"
+         *
+         * RFC7616 section 3.4, qop:
+         *  "value MUST be one of the alternatives the server
+         *   indicated it supports in the WWW-Authenticate header field"
+         *
+         * Squid sends qop=auth, reject buggy or outdated clients.
+        */
+        debugs(29, 2, "missing qop!");
+        rv = authDigestLogUsername(username, digest_request, aRequestRealm);
+        safe_free(username);
+        return rv;
     }
 
     /** below nonce state dependent **/