Skip to content

Commit 1615a7f

Browse files
committed
Fix validation of Digest auth header parameters (#1906)
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".
1 parent b4addc2 commit 1615a7f

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/auth/digest/Config.cc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -966,13 +966,19 @@ Auth::Digest::Config::decode(char const *proxy_auth, const HttpRequest *request,
966966
return rv;
967967
}
968968
} else {
969-
/* cnonce and nc both require qop */
970-
if (digest_request->cnonce || digest_request->nc[0] != '\0') {
971-
debugs(29, 2, "missing qop!");
972-
rv = authDigestLogUsername(username, digest_request, aRequestRealm);
973-
safe_free(username);
974-
return rv;
975-
}
969+
/* RFC7616 section 3.3, qop:
970+
* "MUST be used by all implementations"
971+
*
972+
* RFC7616 section 3.4, qop:
973+
* "value MUST be one of the alternatives the server
974+
* indicated it supports in the WWW-Authenticate header field"
975+
*
976+
* Squid sends qop=auth, reject buggy or outdated clients.
977+
*/
978+
debugs(29, 2, "missing qop!");
979+
rv = authDigestLogUsername(username, digest_request, aRequestRealm);
980+
safe_free(username);
981+
return rv;
976982
}
977983

978984
/** below nonce state dependent **/

0 commit comments

Comments
 (0)