CWE-296 – Improper Following of a Certificate’s Chain of Trust

Read Time:1 Minute, 45 Second

Description

The software does not follow, or incorrectly follows, the chain of trust for a certificate back to a trusted root certificate, resulting in incorrect trust of any resource that is associated with that certificate.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: Low

 

Related Weaknesses

CWE-295
CWE-573

 

Consequences

Non-Repudiation: Hide Activities

Exploitation of this flaw can lead to the trust of data that may have originated with a spoofed source.

Integrity, Confidentiality, Availability, Access Control: Gain Privileges or Assume Identity, Execute Unauthorized Code or Commands

Data, requests, or actions taken by the attacking entity can be carried out as a spoofed benign entity.

 

Potential Mitigations

Phase: Architecture and Design

Description: 

Ensure that proper certificate checking is included in the system design.

Phase: Implementation

Description: 

Understand, and properly implement all checks necessary to ensure the integrity of certificate trust integrity.

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 full chain of trust.

CVE References

  • CVE-2016-2402
    • Server allows bypass of certificate pinning by sending a chain of trust that includes a trusted CA that is not pinned.
  • CVE-2008-4989
    • Verification function trusts certificate chains in which the last certificate is self-signed.
  • CVE-2012-5821
    • Chain: 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).
  • CVE-2009-3046
    • Web browser does not check if any intermediate certificates are revoked.
  • CVE-2009-0265
    • chain: DNS server does not correctly check return value from the OpenSSL EVP_VerifyFinal function allows bypass of validation of the certificate chain.
  • CVE-2009-0124
    • chain: incorrect check of return value from the OpenSSL EVP_VerifyFinal function allows bypass of validation of the certificate chain.
  • CVE-2002-0970
    • File-transfer software does not validate Basic Constraints of an intermediate CA-signed certificate.
  • CVE-2002-0862
    • Cryptographic API, as used in web browsers, mail clients, and other software, does not properly validate Basic Constraints.

CWE-295 – Improper Certificate Validation

Read Time:2 Minute, 53 Second

Description

The software does not validate, or incorrectly validates, a certificate.

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 software might connect to a malicious host while believing it is a trusted host, or the software might be deceived into accepting spoofed data that appears to originate from a trusted host.

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.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-287
CWE-287
CWE-322

 

Consequences

Integrity, Authentication: Bypass Protection Mechanism, Gain Privileges or Assume Identity

 

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.

CVE References

  • CVE-2014-1266
    • 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).
  • CVE-2021-22909
    • 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).
  • CVE-2008-4989
    • Verification function trusts certificate chains in which the last certificate is self-signed.
  • CVE-2012-5821
    • 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)
  • CVE-2009-3046
    • Web browser does not check if any intermediate certificates are revoked.
  • CVE-2011-0199
    • Operating system does not check Certificate Revocation List (CRL) in some cases, allowing spoofing using a revoked certificate.
  • CVE-2012-5810
    • Mobile banking application does not verify hostname, leading to financial loss.
  • CVE-2012-3446
    • Cloud-support library written in Python uses incorrect regular expression when matching hostname.