CWE-297: Improper Validation of Certificate with Host Mismatch
89 CVEs have CWE-297 as their primary weakness. 0 of them are in the CISA KEV catalog. The highest EPSS score among them is 5.581%.
The product communicates with a host that provides a certificate, but the product does not properly ensure that the certificate is actually associated with that host.
Child of CWE-923: Improper Restriction of Communication Channel to Intended Endpoints
OWASP Top 10: A07:2021 Identification and Authentication Failures · A07:2025 Authentication Failures
Mitigations
- Architecture and Design: In order to ensure data integrity, the certificate must be valid, and it must pertain to the site that is being accessed.Fully check the hostname of the certificate and provide the user with adequate information about the nature of the problem and how to proceed.
- Implementation: If certificate pinning is being used, ensure that all relevant properties of the certificate are fully validated before the certificate is pinned, including the hostname.
- Implementation: Be careful of other weaknesses in the code that checks the hostname, since it is still possible to incorrectly check the hostname. For example, attackers could create a certificate with a name that begins with a trusted name followed by a NUL byte, which could cause some string-based comparisons to only examine the portion that contains the trusted name.
Observed examples
- CVE-2012-5810: Mobile banking application does not verify hostname, leading to financial loss.
- CVE-2012-5811: Mobile application for printing documents does not verify hostname, allowing attackers to read sensitive documents.
- CVE-2012-5807: Software for electronic checking does not verify hostname, leading to financial loss.
- CVE-2012-3446: Cloud-support library written in Python uses incorrect regular expression when matching hostname.
- CVE-2009-2408: Web browser does not correctly handle '0' character (NUL) in Common Name, allowing spoofing of https sites.
- CVE-2012-0867: Database program truncates the Common Name during hostname verification, allowing spoofing.
- CVE-2010-2074: Incorrect handling of '0' character (NUL) in hostname verification allows spoofing.
- CVE-2009-4565: Mail server's incorrect handling of '0' character (NUL) in hostname verification allows spoofing.
- CVE-2009-3767: LDAP server's incorrect handling of '0' character (NUL) in hostname verification allows spoofing.
- CVE-2012-5806: Payment processing module does not verify hostname when connecting to PayPal using PHP fsockopen function.
- CVE-2012-2993: Smartphone device does not verify hostname, allowing spoofing of mail services.
- CVE-2012-5804: E-commerce module does not verify hostname when connecting to payment site.
- CVE-2012-5824: Chat application does not validate hostname, leading to loss of privacy.
- CVE-2012-5822: Application uses third-party library that does not validate hostname.
- CVE-2012-5819: Cloud storage management application does not validate hostname.
- CVE-2012-5817: Java library uses JSSE SSLSocket and SSLEngine classes, which do not verify the hostname.
- CVE-2012-5784: SOAP platform does not verify the hostname.
- CVE-2012-5782: PHP library for payments does not verify the hostname.
- CVE-2012-5780: Merchant SDK for payments does not verify the hostname.
- CVE-2003-0355: Web browser does not validate Common Name, allowing spoofing of https sites.
Get more CVE data from the API.
curl 'https://api.contrastcyber.com/cwe_lookup/CWE-297'curl 'https://api.contrastcyber.com/cve_search?cwe_id=CWE-297'
Sources
- Vulnerability data from the National Vulnerability Database (NIST) and the CVE Program. CVE records: Copyright © 1999-2026, The MITRE Corporation, used under the CVE Program Terms of Use. CVE® is a registered trademark of The MITRE Corporation.
- CWE definitions: Copyright © 2006-2026, The MITRE Corporation, used under the CWE Terms of Use. CWE is a trademark of The MITRE Corporation.
- OWASP Top 10 categories by the OWASP Foundation (CC BY 3.0).
- EPSS scores by FIRST.org EPSS, used with attribution.
- KEV catalog and SSVC decisions by CISA.
- Advisory data from the GitHub Advisory Database through OSV.dev (CC BY 4.0).
- Exploit metadata from the Exploit Database (GPL-2.0-only, metadata only).
- Nuclei template names from nuclei-templates (MIT).