---
title: "CWE-1025: Comparison Using Wrong Factors"
url: https://radicalnotion.ai/cwe/cwe-1025
type: cwe
description: "The code performs a comparison between two entities, but the comparison examines the wrong factors or characteristics of the entities."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1025: Comparison Using Wrong Factors

- **Abstraction:** Class
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 41
- **Of those, in CISA KEV:** 0
- **New in 2026:** 28
- **CWE catalog version:** 4.21

## Description

The code performs a comparison between two entities, but the comparison examines the wrong factors or characteristics of the entities.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Varies by Context | This can lead to incorrect results and resultant weaknesses. For example, the code might inadvertently compare references to objects, instead of the relevant contents of those objects, causing two "equal" objects to be considered unequal. |

## Detection methods

### Manual Static Analysis

Thoroughly test the comparison scheme before deploying code into production. Perform positive testing as well as negative testing.

## Demonstrative examples

### Example 1

In the example below, two Java String objects are declared and initialized with the same string values. An if statement is used to determine if the strings are equivalent.

Bad code:

```java
String str1 = new String("Hello");
String str2 = new String("Hello");
if (str1 == str2) {
    System.out.println("str1 == str2");
}
```

Good code:

```java
if (str1.equals(str2)) {
    System.out.println("str1 equals str2");
}
```

However, the if statement will not be executed as the strings are compared using the "==" operator. For Java objects, such as String objects, the "==" operator compares object references, not object values. While the two String objects above contain the same string values, they refer to different object references, so the System.out.println statement will not be executed. To compare object values, the previous code could be modified to use the equals method:

## Real CVEs with this weakness (sample of 12 of 41)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-82442 | Apache StormCrawler: HostURLFilter Domain Scoping Silently Disabled by a Wrong Variable Check | critical | 9.1 | - | No | 2026-11-24 |
| CVE-2026-74521 | ksmbd: use memcmp() to compare ClientGUIDs | critical | 9.1 | - | No | 2026-08-15 |
| CVE-2026-72320 | netfilter: nft\_lookup: fix catchall element handling with inverted lookups | critical | 9.1 | - | No | 2026-08-15 |
| CVE-2023-54390 | PocketMine-MP before 5.3.1 Denial of Service via LoginPacket | high | 8.7 | - | No | 2026-09-09 |
| CVE-2026-75840 | ArcadeDB before 26.8.1 Arbitrary File Read via Unescaped Regex | high | 8.7 | - | No | 2026-08-18 |
| CVE-2025-71377 | stoatchat before 20250210-1 Unrestricted Message History Fetch | high | 8.7 | - | No | 2026-07-16 |
| CVE-2024-20342 | Cisco Firepower Threat Defense Software Rate Filter Bypass Vulnerability | high | 8.6 | - | No | 2024-10-23 |
| CVE-2026-125271 | AWS API MCP Server Security Policy Bypass via Incorrect Operation Name Normalization | high | 8.5 | - | No | 2026-11-10 |
| CVE-2026-100248 | - | high | 8.4 | - | No | 2026-09-25 |
| CVE-2026-123592 | Hickory DNS 0.26.0-beta.1 before 0.26.2 DNSSEC Validation Bypass via Name Hash Collision | high | 8.2 | - | No | 2026-11-08 |
| CVE-2026-104048 | Sssd: sssd: authorization bypass via cross-domain username collision in hbac evaluation | high | 8.1 | - | No | 2026-10-06 |
| CVE-2026-9800 | Keycloak-policy-enforcer: keycloak policy enforcer: authorization bypass via incorrect uri comparison | high | 8.1 | - | No | 2026-06-25 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-697](https://radicalnotion.ai/cwe/cwe-697) | Incorrect Comparison |
| Child | [CWE-486](https://radicalnotion.ai/cwe/cwe-486) | Comparison of Classes by Name |
| Child | [CWE-595](https://radicalnotion.ai/cwe/cwe-595) | Comparison of Object References Instead of Object Contents |

## Frequently asked questions

### What is CWE-1025?

The code performs a comparison between two entities, but the comparison examines the wrong factors or characteristics of the entities.

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

41 recorded CVEs are attributed to CWE-1025, including CVE-2026-82442, CVE-2026-74521 and CVE-2026-72320.

### How is CWE-1025 detected?

Manual Static Analysis: Thoroughly test the comparison scheme before deploying code into production. Perform positive testing as well as negative testing.

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

Exploiting CWE-1025 can lead to: Varies by Context.

### Is CWE-1025 actively exploited?

41 recorded CVEs are caused by CWE-1025; none are currently in CISA's KEV catalog of actively exploited flaws.

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

---

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