CWE-295: Improper Certificate Validation (Base)

Description: The product does not validate, or incorrectly validates, a certificate.

Extended Description: When a certificate is invalid or malicious, it might allow an attacker to spoof a trusted entity by interfering in the communication path between the host and client. The product might connect to a malicious host while believing it is a trusted host, or the product might be deceived into accepting spoofed data that appears to originate from a trusted host.

Background Details: ::A certificate is a token that associates an identity (principal) to a cryptographic key. Certificates can be used to check if a public key belongs to the assumed owner.::


Applicable Platforms: ::LANGUAGE CLASS:Not Language-Specific:LANGUAGE PREVALENCE:Undetermined::TECHNOLOGY CLASS:Mobile:TECHNOLOGY PREVALENCE:Undetermined::

Modes of Introduction: ::PHASE:Architecture and Design::PHASE:Implementation:NOTE:REALIZATION: This weakness is caused during implementation of an architectural security tactic.::PHASE:Implementation:NOTE:When the product uses certificate pinning, the developer might not properly validate all relevant components of the certificate before pinning the certificate. This can make it difficult or expensive to test after the pinning is complete.::



Common Consequences: ::SCOPE:Integrity:SCOPE:Authentication:IMPACT:Bypass Protection Mechanism:IMPACT:Gain Privileges or Assume Identity::

Detection Methods: ::METHOD:Automated Static Analysis - Binary or Bytecode:DESCRIPTION:According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Bytecode Weakness Analysis - including disassembler + source code weakness analysis Binary Weakness Analysis - including disassembler + source code weakness analysis:EFFECTIVENESS:SOAR Partial::METHOD:Manual Static Analysis - Binary or Bytecode:DESCRIPTION:According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies:EFFECTIVENESS:SOAR Partial::METHOD:Dynamic Analysis with Automated Results Interpretation:DESCRIPTION:According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Web Application Scanner:EFFECTIVENESS:SOAR Partial::METHOD:Dynamic Analysis with Manual Results Interpretation:DESCRIPTION:According to SOAR, the following detection techniques may be useful: Highly cost effective: Man-in-the-middle attack tool:EFFECTIVENESS:High::METHOD:Manual Static Analysis - Source Code:DESCRIPTION:According to SOAR, the following detection techniques may be useful: Highly cost effective: Focused Manual Spotcheck - Focused manual analysis of source Manual Source Code Review (not inspections):EFFECTIVENESS:High::METHOD:Automated Static Analysis - Source Code:DESCRIPTION:According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Source code Weakness Analyzer Context-configured Source Code Weakness Analyzer:EFFECTIVENESS:SOAR Partial::METHOD:Architecture or Design Review:DESCRIPTION:According to SOAR, the following detection techniques may be useful: Highly cost effective: Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.):EFFECTIVENESS:High::

Potential Mitigations: ::PHASE:Architecture and Design Implementation:DESCRIPTION:Certificates should be carefully managed and checked to assure that data are encrypted with the intended owner's public key.::PHASE:Implementation:DESCRIPTION: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.::

Observed Examples: ::REFERENCE:CVE-2019-12496:DESCRIPTION:A Go framework for robotics, drones, and IoT devices skips verification of root CA certificates by default.:LINK:https://www.cve.org/CVERecord?id=CVE-2019-12496::REFERENCE:CVE-2014-1266:DESCRIPTION:chain: incorrect goto in Apple SSL product bypasses certificate validation, allowing Adversary-in-the-Middle (AITM) attack (Apple goto fail bug). CWE-705 (Incorrect Control Flow Scoping) -> CWE-561 (Dead Code) -> CWE-295 (Improper Certificate Validation) -> CWE-393 (Return of Wrong Status Code) -> CWE-300 (Channel Accessible by Non-Endpoint).:LINK:https://www.cve.org/CVERecord?id=CVE-2014-1266::REFERENCE:CVE-2021-22909:DESCRIPTION:Chain: router's firmware update procedure uses curl with -k (insecure) option that disables certificate validation (CWE-295), allowing adversary-in-the-middle (AITM) compromise with a malicious firmware image (CWE-494).:LINK:https://www.cve.org/CVERecord?id=CVE-2021-22909::REFERENCE:CVE-2008-4989:DESCRIPTION:Verification function trusts certificate chains in which the last certificate is self-signed.:LINK:https://www.cve.org/CVERecord?id=CVE-2008-4989::REFERENCE:CVE-2012-5821:DESCRIPTION:Web browser uses a TLS-related function incorrectly, preventing it from verifying that a server's certificate is signed by a trusted certification authority (CA):LINK:https://www.cve.org/CVERecord?id=CVE-2012-5821::REFERENCE:CVE-2009-3046:DESCRIPTION:Web browser does not check if any intermediate certificates are revoked.:LINK:https://www.cve.org/CVERecord?id=CVE-2009-3046::REFERENCE:CVE-2011-0199:DESCRIPTION:Operating system does not check Certificate Revocation List (CRL) in some cases, allowing spoofing using a revoked certificate.:LINK:https://www.cve.org/CVERecord?id=CVE-2011-0199::REFERENCE:CVE-2012-5810:DESCRIPTION:Mobile banking application does not verify hostname, leading to financial loss.:LINK:https://www.cve.org/CVERecord?id=CVE-2012-5810::REFERENCE:CVE-2012-3446:DESCRIPTION:Cloud-support library written in Python uses incorrect regular expression when matching hostname.:LINK:https://www.cve.org/CVERecord?id=CVE-2012-3446::REFERENCE:CVE-2009-2408:DESCRIPTION:Web browser does not correctly handle '0' character (NUL) in Common Name, allowing spoofing of https sites.:LINK:https://www.cve.org/CVERecord?id=CVE-2009-2408::REFERENCE:CVE-2012-2993:DESCRIPTION:Smartphone device does not verify hostname, allowing spoofing of mail services.:LINK:https://www.cve.org/CVERecord?id=CVE-2012-2993::REFERENCE:CVE-2012-5822:DESCRIPTION:Application uses third-party library that does not validate hostname.:LINK:https://www.cve.org/CVERecord?id=CVE-2012-5822::REFERENCE:CVE-2012-5819:DESCRIPTION:Cloud storage management application does not validate hostname.:LINK:https://www.cve.org/CVERecord?id=CVE-2012-5819::REFERENCE:CVE-2012-5817:DESCRIPTION:Java library uses JSSE SSLSocket and SSLEngine classes, which do not verify the hostname.:LINK:https://www.cve.org/CVERecord?id=CVE-2012-5817::REFERENCE:CVE-2010-1378:DESCRIPTION:chain: incorrect calculation allows attackers to bypass certificate checks.:LINK:https://www.cve.org/CVERecord?id=CVE-2010-1378::REFERENCE:CVE-2005-3170:DESCRIPTION:LDAP client accepts certificates even if they are not from a trusted CA.:LINK:https://www.cve.org/CVERecord?id=CVE-2005-3170::REFERENCE:CVE-2009-0265:DESCRIPTION:chain: DNS server does not correctly check return value from the OpenSSL EVP_VerifyFinal function allows bypass of validation of the certificate chain.:LINK:https://www.cve.org/CVERecord?id=CVE-2009-0265::REFERENCE:CVE-2003-1229:DESCRIPTION:chain: product checks if client is trusted when it intended to check if the server is trusted, allowing validation of signed code.:LINK:https://www.cve.org/CVERecord?id=CVE-2003-1229::REFERENCE:CVE-2002-0862:DESCRIPTION:Cryptographic API, as used in web browsers, mail clients, and other software, does not properly validate Basic Constraints.:LINK:https://www.cve.org/CVERecord?id=CVE-2002-0862::REFERENCE:CVE-2009-1358:DESCRIPTION:chain: OS package manager does not check properly check the return value, allowing bypass using a revoked certificate.:LINK:https://www.cve.org/CVERecord?id=CVE-2009-1358::