SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Handle subject for hostname checks.
smicallefcbc103bb64a3
diff --git a/modules/sfp_sslcert.py b/modules/sfp_sslcert.pyindex 3f5c8aa3..97f27563 100644--- a/modules/sfp_sslcert.py+++ b/modules/sfp_sslcert.py@@ -123,9 +123,20 @@ class sfp_sslcert(SpiderFootPlugin):# Check if the hostname matches the name of the serverdef checkHostMatch(self, cert, fqdn, sevt):fqdn = fqdn.lower()- alts = cert.get_ext("subjectAltName").get_value().lower()+ hosts = list()++ # Extract the CN from the issued section+ issued = cert.get_subject().as_text()+ if "cn=" + fqdn in issued.lower():+ hosts = [ fqdn ]++ try:+ hosts = hosts + cert.get_ext("subjectAltName").get_value().lower()+ except LookupError as e:+ sf.debug("No alternative name found in certificate.")+fqdn_tld = ".".join(fqdn.split(".")[1:]).lower()- if "dns:"+fqdn not in alts and "dns:*."+fqdn_tld not in alts:+ if "dns:"+fqdn not in hosts and "dns:*."+fqdn_tld not in hosts:evt = SpiderFootEvent("SSL_CERTIFICATE_MISMATCH", fqdn, self.__name__, sevt)self.notifyListeners(evt)