CWEweakness

CWE-297 Improper Validation of Certificate with Host Mismatch

High Official page ↗
Abstraction
Variant
Structure
Simple
Status
Incomplete
Likelihood of exploit
High
Languages
Not Language-Specific
CWE version
5.0

Description

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.

Common consequences

• Access Control: Gain Privileges or Assume Identity — The data read from the system vouched for by the certificate may not be from the expected system. • Authentication, Other: Other — Trust afforded to the system in question - based on the malicious certificate - may allow for spoofing or redirection attacks. • Access Control, Other: Gain Privileges or Assume Identity, Other — If the certificate's host-specific data is not properly checked - such as the Common Name (CN) in the Subject or the Subject Alternative Name (SAN) extension of an X.509 certificate - it may be possible for a redirection or spoofing attack to allow a malicious host with a valid certificate to provide data, impersonating a trusted host.

Potential 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.

Detection methods

• Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.) • Dynamic Analysis with Manual Results Interpretation: Set up an untrusted endpoint (e.g. a server) with which the product will connect. Create a test certificate that uses an invalid hostname but is signed by a trusted CA and provide this certificate from the untrusted endpoint. If the product performs any operations instead of disconnecting and reporting an error, then this indicates that the hostname is not being checked and the test certificate has been accepted. • Black Box: When Certificate Pinning is being used in a mobile application, consider using a tool such as Spinner [REF-955]. This methodology might be extensible to other technologies.

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.

Related

Observed example · CVE (20)

  • CVE-2012-3446 Apache Libcloud before 0.11.1 uses an incorrect regular expression during verification of whether the server hostname matches a domain name… vulnerability
  • CVE-2012-5780 The Amazon merchant SDK does not verify that the server hostname matches a domain name in the subject's Common Name (CN) or subjectAltName… vulnerability
  • CVE-2012-5782 Amazon Flexible Payments Service (FPS) PHP Library does not verify that the server hostname matches a domain name in the subject's Common… vulnerability
  • CVE-2012-5784 Apache Axis 1.4 and earlier, as used in PayPal Payments Pro, PayPal Mass Pay, PayPal Transactional Information SOAP, the Java Message… vulnerability
  • CVE-2012-5804 The CyberSource module in Ubercart does not verify that the server hostname matches a domain name in the subject's Common Name (CN) or… vulnerability
  • CVE-2012-5806 The PayPal Payments Pro module in Zen Cart does not verify that the server hostname matches a domain name in the subject's Common Name (CN)… vulnerability
  • CVE-2012-5807 The Authorize.Net eCheck module in Zen Cart does not verify that the server hostname matches a domain name in the subject's Common Name… vulnerability
  • CVE-2012-5810 The Chase mobile banking application for Android does not verify that the server hostname matches a domain name in the subject's Common… vulnerability
  • CVE-2012-5811 The Breezy application for Android does not verify that the server hostname matches a domain name in the subject's Common Name (CN) or… vulnerability
  • CVE-2012-5817 Codehaus XFire 1.2.6 and earlier, as used in the Amazon EC2 API Tools Java library and other products, does not verify that the server… vulnerability
  • CVE-2012-5819 FilesAnywhere does not verify that the server hostname matches a domain name in the subject's Common Name (CN) or subjectAltName field of… vulnerability
  • CVE-2012-5822 The contribution feature in Zamboni does not verify that the server hostname matches a domain name in the subject's Common Name (CN) or… vulnerability
  • CVE-2012-5824 Trillian 5.1.0.19 does not verify that the server hostname matches a domain name in the subject's Common Name (CN) or subjectAltName field… vulnerability
  • CVE-2012-2993 Microsoft Windows Phone 7 does not verify the domain name in the subject's Common Name (CN) field of an X.509 certificate, which allows… vulnerability
  • CVE-2012-0867 PostgreSQL 8.4.x before 8.4.11, 9.0.x before 9.0.7, and 9.1.x before 9.1.3 truncates the common name to only 32 characters when verifying… vulnerability
  • CVE-2010-2074 istream.c in w3m 0.5.2 and possibly other versions, when ssl_verify_server is enabled, does not properly handle a '\0' character in a… vulnerability
  • CVE-2009-4565 sendmail before 8.14.4 does not properly handle a '\0' character in a Common Name (CN) field of an X.509 certificate, which (1) allows… vulnerability
  • CVE-2009-3767 libraries/libldap/tls_o.c in OpenLDAP 2.2 and 2.4, and possibly other versions, when OpenSSL is used, does not properly handle a '\0'… vulnerability
  • CVE-2009-2408 Mozilla Network Security Services (NSS) before 3.12.3, Firefox before 3.0.13, Thunderbird before 2.0.0.23, and SeaMonkey before 1.1.18 do… vulnerability
  • CVE-2003-0355 Safari 1.0 Beta 2 (v73) and earlier does not validate the Common Name (CN) field for X.509 Certificates, which could allow remote attackers… vulnerability

Child of · CWE (2)

  • CWE-295 Improper Certificate Validation weakness
  • CWE-923 Improper Restriction of Communication Channel to Intended Endpoints weakness

Referenced by CVE · weakness (91)

  • CVE-2026-66392 Apache bRPC versions before 1.18.0 validate the server certificate chain when client TLS peer verification is enabled, but do not bind the… vulnerability
  • CVE-2026-85974 Progress MarkLogic Server 12.x releases before 12.1.0 and 11.x releases before 11.3.7 do not consistently validate TLS certificate… vulnerability
  • CVE-2026-107819 MariaDB Connector/C is a C and C++ client library for connecting applications to MariaDB and MySQL databases. vulnerability
  • CVE-2026-107938 In Apache CXF, the Netty-based HTTP client transport (cxf-rt-transports-http-netty-client) did not verify that the hostname in the server’s… vulnerability
  • CVE-2026-107660 FFmpeg before 8.1.3 and 9.x before 9.0.2 contains an improper certificate validation vulnerability in tls_open() of… vulnerability
  • CVE-2026-88647 A hostname verification bypass in GnuTLS v3.8.13 allows attackers to circumvent the Common Name fallback mechanism and eavesdrop on… vulnerability
  • CVE-2026-85088 Improper Validation of Certificate with Host Mismatch in the C++ and D libraries of Apache Thrift. vulnerability
  • CVE-2026-102669 Joyland AI app does not verify hostnames, allowing a malicious host to connect or intercept chat messages. vulnerability
  • CVE-2026-19553 ssl.SSLContext.wrap_bio() didn't require the server_hostname argument to not be None if ssl.SSLContext.check_hostname was set. vulnerability
  • CVE-2026-91769 PHP's OpenSSL stream peer verification checks the certificate's subjectAltName entries first and, whenever no entry matches, falls back to… vulnerability
  • CVE-2026-63374 AnyIO is a high level asynchronous concurrency and networking framework that works on top of either Trio or asyncio. vulnerability
  • CVE-2026-91166 Warpgate is an open source SSH, HTTPS and MySQL bastion host for Linux. vulnerability
  • CVE-2026-84975 PJSIP is a free and open source multimedia communication library written in C. vulnerability
  • CVE-2026-92943 Improper validation of certificate with host mismatch in the MQTT client TLS connection layer in AWS IoT Device SDK for Python 1.5.3… vulnerability
  • CVE-2026-59969 Apache ZooKeeper quorum TLS fails to enforce peer hostname verification in FIPS-mode deployments. vulnerability
  • CVE-2026-79636 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions prior to 5.36.00.00, contains an Improper… vulnerability
  • CVE-2026-84197 In Eclipse Ditto's Node.js JavaScript client, all released versions of @eclipse-ditto/ditto-javascript-client-node from 2.0.0 to 3.9.0 and… vulnerability
  • CVE-2026-84393 A improper validation of certificate with host mismatch vulnerability in Fortinet FortiOS 7.6.1 through 7.6.6, FortiProxy 7.6.2 through… vulnerability
  • CVE-2026-79943 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions prior to 5.36.00.00, contains an Improper… vulnerability
  • CVE-2026-9744 IBM Netezza Software 11.3.0.3 through Interim Fix 002 does not validate or improperly validates TLS certificate validation, which could… vulnerability
  • CVE-2026-59272 Any application shipping logs to RabbitMQ over TLS via the Log4j2 appender, relying on the documented default, is exposed to… vulnerability
  • CVE-2026-62243 Netty (io.netty:netty-handler) versions from 4.2.0.Final through 4.2.16.Final and versions through 4.1.136.Final disable TLS hostname… vulnerability
  • CVE-2026-53583 libgit2 is a portable C implementation of the Git core methods provided as a linkable library with a solid API, allowing to build Git… vulnerability
  • CVE-2026-49457 erlang_quic is a pure Erlang QUIC implementation. vulnerability
  • CVE-2026-65942 TLS hostname verification issue in Apache Ranger Client Code in versions <= 2.8.0. vulnerability
  • CVE-2026-12730 IBM Business Automation Workflow containers and traditional 26.0.0, 25.0.0 through 25.0.0 Interim Fix 005, 24.0.1 through 24.0.1 Interim… vulnerability
  • CVE-2026-59638 In Bouncy Castle for Java before 1.85, JSSE hostname verifier CN-fallback enabled by default despite documented opt-in. vulnerability
  • CVE-2026-58040 An incomplete fix has been identified in Node.js: HTTPS Agent TLS session reuse skips hostname verification across identity policies… vulnerability
  • CVE-2026-48144 Improper Validation of Certificate with Host Mismatch vulnerability in Apache Thrift c_glib bindings. vulnerability
  • CVE-2026-48145 Improper Validation of Certificate with Host Mismatch vulnerability in Apache Thrift C++ bindings. vulnerability
Show all 91 ›

Referenced by CWE · peer of (1)

  • CWE-370 Missing Check for Certificate Revocation after Initial Check weakness

Referenced by OWASP · mapped cwe (2)

  • A07:2025 Authentication Failures Top 10 2025
  • A07:2021 Identification and Authentication Failures Top 10 2021