---
title: "CWE-295: Improper Certificate Validation"
url: https://radicalnotion.ai/cwe/cwe-295
type: cwe
description: "The product does not validate, or incorrectly validates, a certificate."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-295: Improper Certificate Validation

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 1,705
- **Of those, in CISA KEV:** 5
- **New in 2026:** 556
- **CWE catalog version:** 4.21

## Description

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

## Background

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

| Phase | Note |
| --- | --- |
| Architecture and Design | - |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |
| Implementation | 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. |

## Applicable platforms

**Languages:** Go (Undetermined)

**Technologies:** Web Based (Undetermined), Mobile (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Authentication | Bypass Protection Mechanism, Gain Privileges or Assume Identity | 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. |

## Potential mitigations

### Architecture and Design, Implementation

Certificates should be carefully managed and checked to assure that data are encrypted with the intended owner's public key.

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

## Detection methods

### Automated Static Analysis - Binary or Bytecode

According to SOAR \[REF-1479\], 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

### Manual Static Analysis - Binary or Bytecode

According to SOAR \[REF-1479\], 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

### Dynamic Analysis with Automated Results Interpretation

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Web Application Scanner

Effectiveness: SOAR Partial

### Dynamic Analysis with Manual Results Interpretation

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

- Man-in-the-middle attack tool

Effectiveness: High

### Manual Static Analysis - Source Code

According to SOAR \[REF-1479\], 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

### Automated Static Analysis - Source Code

According to SOAR \[REF-1479\], 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

### Architecture or Design Review

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

- Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

Effectiveness: High

## Demonstrative examples

### Example 1

This code checks the certificate of a connected peer.

Bad code:

```c
if ((cert = SSL_get_peer_certificate(ssl)) && host)
    foo=SSL_get_verify_result(ssl);

if ((X509_V_OK==foo) || X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN==foo))

    // certificate looks good, host can be trusted
```

In this case, because the certificate is self-signed, there was no external authority that could prove the identity of the host. The program could be communicating with a different system that is spoofing the host, e.g. by poisoning the DNS cache or using an Adversary-in-the-Middle (AITM) attack to modify the traffic from server to client.

### Example 2

The following OpenSSL code obtains a certificate and verifies it.

Bad code:

```c
cert = SSL_get_peer_certificate(ssl);
if (cert && (SSL_get_verify_result(ssl)==X509_V_OK)) {

    // do secret things
}
```

Even though the "verify" step returns X509\_V\_OK, this step does not include checking the Common Name against the name of the host. That is, there is no guarantee that the certificate is for the desired host. The SSL connection could have been established with a malicious host that provided a valid certificate.

### Example 3

The following OpenSSL code ensures that there is a certificate and allows the use of expired certificates.

Bad code:

```c
if (cert = SSL_get_peer(certificate(ssl)) {
    foo=SSL_get_verify_result(ssl);
    if ((X509_V_OK==foo) || (X509_V_ERR_CERT_HAS_EXPIRED==foo))

        //do stuff
```

If the call to SSL\_get\_verify\_result() returns X509\_V\_ERR\_CERT\_HAS\_EXPIRED, this means that the certificate has expired. As time goes on, there is an increasing chance for attackers to compromise the certificate.

### Example 4

The following OpenSSL code ensures that there is a certificate before continuing execution.

Bad code:

```c
if (cert = SSL_get_peer_certificate(ssl)) {

    // got a certificate, do secret things
```

Because this code does not use SSL\_get\_verify\_results() to check the certificate, it could accept certificates that have been revoked (X509\_V\_ERR\_CERT\_REVOKED). The software could be communicating with a malicious host.

### Example 5

The following OpenSSL code ensures that the host has a certificate.

Bad code:

```c
if (cert = SSL_get_peer_certificate(ssl)) {

    // got certificate, host can be trusted

    //foo=SSL_get_verify_result(ssl);

    //if (X509_V_OK==foo) ...
}
```

Note that the code does not call SSL\_get\_verify\_result(ssl), which effectively disables the validation step that checks the certificate.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2019-12496 | A Go framework for robotics, drones, and IoT devices skips verification of root CA certificates by default. |
| 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). The code's whitespace indentation did not reflect the actual control flow (CWE-1114) and did not explicitly delimit the block (CWE-483), which could have made it more difficult for human code auditors to detect the vulnerability. |
| 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 | 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-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. |
| CVE-2009-2408 | Web browser does not correctly handle '\\0' character (NUL) in Common Name, allowing spoofing of https sites. |
| CVE-2012-2993 | Smartphone device does not verify hostname, allowing spoofing of mail services. |
| 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-2010-1378 | Chain: incorrect calculation (CWE-682) allows attackers to bypass certificate checks (CWE-295) |
| CVE-2007-6746 | library for SSL and TLS does not check the activation or expiration dates of CA certificates |
| CVE-2005-3170 | LDAP client accepts certificates even if they are not from a trusted CA. |
| 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-2003-1229 | Chain: product checks if client is trusted when it intended to check if the server is trusted, allowing validation of signed code. |
| CVE-2002-0862 | Cryptographic API, as used in web browsers, mail clients, and other software, does not properly validate Basic Constraints. |
| CVE-2009-1358 | Chain: OS package manager does not properly check the return value, allowing bypass using a revoked certificate. |

## Real CVEs with this weakness (sample of 12 of 1,705)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-85102 | Improper Certificate Validation in Quantum Security Gateway | critical | 9.8 | - | Yes | 2026-09-09 |
| CVE-2022-26923 | Active Directory Domain Services Elevation of Privilege Vulnerability | high | 8.7 | - | Yes | 2022-05-10 |
| CVE-2020-0601 | Windows CryptoAPI Spoofing Vulnerability | high | 8.6 | - | Yes | 2020-01-14 |
| CVE-2023-20963 | Android Framework Privilege Escalation Vulnerability | high | 8.5 | - | Yes | 2023-03-24 |
| CVE-2023-41991 | iOS and iPadOS: Security - A malicious app may be able to bypass signature validation | medium | 6.7 | - | Yes | 2023-09-21 |
| CVE-2026-75521 | Miren Runtime: Authentication bypass in RPC layer: unverified TLS client certificates grant cluster superuser access | critical | 10.0 | - | No | 2026-11-18 |
| CVE-2026-112816 | Improper certificate validation in the HTTPS listener in LXD | critical | 10.0 | - | No | 2026-10-30 |
| CVE-2026-96207 | Microsoft Partner Center Elevation of Privilege Vulnerability | critical | 10.0 | - | No | 2026-10-08 |
| CVE-2026-4370 | Improper TLS Client/Server authentication and certificate verification on Database Cluster | critical | 10.0 | - | No | 2026-04-01 |
| CVE-2025-68121 | Unexpected session resumption in crypto/tls | critical | 10.0 | - | No | 2026-02-05 |
| CVE-2024-5261 | TLS certificate are not properly verified when utilizing LibreOfficeKit | critical | 10.0 | - | No | 2024-06-25 |
| CVE-2026-133648 | Flowintel Disables TLS Certificate Verification for MISP and Mail Connections | critical | 9.9 | - | No | 2026-11-20 |

## Related attack patterns (CAPEC)

- [CAPEC-459](https://radicalnotion.ai/capec/capec-459): Creating a Rogue Certification Authority Certificate
- [CAPEC-475](https://radicalnotion.ai/capec/capec-475): Signature Spoofing by Improper Validation

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-287](https://radicalnotion.ai/cwe/cwe-287) | Improper Authentication |
| Child | [CWE-296](https://radicalnotion.ai/cwe/cwe-296) | Improper Following of a Certificate's Chain of Trust |
| Child | [CWE-297](https://radicalnotion.ai/cwe/cwe-297) | Improper Validation of Certificate with Host Mismatch |
| Child | [CWE-298](https://radicalnotion.ai/cwe/cwe-298) | Improper Validation of Certificate Expiration |
| Child | [CWE-299](https://radicalnotion.ai/cwe/cwe-299) | Improper Check for Certificate Revocation |
| Child | [CWE-599](https://radicalnotion.ai/cwe/cwe-599) | Missing Validation of OpenSSL Certificate |
| Peer | [CWE-322](https://radicalnotion.ai/cwe/cwe-322) | Key Exchange without Entity Authentication |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| OWASP Top Ten 2004 | Insecure Configuration Management | A10 | CWE More Specific |
| OWASP Golang Secure Coding Practices Guide | Communication Security | - | - |

## Frequently asked questions

### What is CWE-295?

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

### What CVEs are caused by CWE-295?

1,705 recorded CVEs are attributed to CWE-295, including CVE-2026-85102, CVE-2022-26923 and CVE-2020-0601. 5 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### Is CWE-295 part of the OWASP Top 10?

CWE-295 maps to OWASP Top Ten 2004: Insecure Configuration Management (A10) in the OWASP security taxonomy.

### How do you prevent CWE-295?

Certificates should be carefully managed and checked to assure that data are encrypted with the intended owner's public key.

### How is CWE-295 detected?

Automated Static Analysis - Binary or Bytecode: According to SOAR, the following detection techniques may be useful:

### What are the consequences of CWE-295?

Exploiting CWE-295 can lead to: Bypass Protection Mechanism, Gain Privileges or Assume Identity.

### Is CWE-295 actively exploited?

Yes. 5 CWE-295 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 1,705 recorded CVEs.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/295.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-295). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
