]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix validation of certificates with CN=* (#1523)
authorAndreas Weigel <andreas.weigel@securepoint.de>
Wed, 18 Oct 2023 04:14:31 +0000 (04:14 +0000)
committerFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Wed, 18 Oct 2023 15:30:10 +0000 (17:30 +0200)
The bug was discovered and detailed by Joshua Rogers at
https://megamansec.github.io/Squid-Security-Audit/
where it was filed as "Buffer UnderRead in SSL CN Parsing".

src/anyp/Uri.cc

index eca2c23573dc3faefe324953a6c82068d3c66a1f..b0f2ce0307a29e36ae5fc90ed22c9e36e9963f95 100644 (file)
@@ -174,6 +174,10 @@ urlInitialize(void)
     assert(0 == matchDomainName("*.foo.com", ".foo.com", mdnHonorWildcards));
     assert(0 != matchDomainName("*.foo.com", "foo.com", mdnHonorWildcards));
 
+    assert(0 != matchDomainName("foo.com", ""));
+    assert(0 != matchDomainName("foo.com", "", mdnHonorWildcards));
+    assert(0 != matchDomainName("foo.com", "", mdnRejectSubsubDomains));
+
     /* more cases? */
 }
 
@@ -748,6 +752,8 @@ matchDomainName(const char *h, const char *d, MatchDomainNameFlags flags)
         return -1;
 
     dl = strlen(d);
+    if (dl == 0)
+        return 1;
 
     /*
      * Start at the ends of the two strings and work towards the