---
title: "CWE-1254: Incorrect Comparison Logic Granularity"
url: https://radicalnotion.ai/cwe/cwe-1254
type: cwe
description: "The product's comparison logic is performed over a series of steps rather than across the entire string in one operation. If there is a comparison logic failure on one of these steps, the operation may be vulnerable to a timing attack that can result in the interception of the process for nefarious purposes."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1254: Incorrect Comparison Logic Granularity

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 3
- **Of those, in CISA KEV:** 0
- **New in 2026:** 2
- **CWE catalog version:** 4.21

## Description

The product's comparison logic is performed over a series of steps rather than across the entire string in one operation. If there is a comparison logic failure on one of these steps, the operation may be vulnerable to a timing attack that can result in the interception of the process for nefarious purposes.

Comparison logic is used to compare a variety of objects including passwords, Message Authentication Codes (MACs), and responses to verification challenges. When comparison logic is implemented at a finer granularity (e.g., byte-by-byte comparison) and breaks in the case of a comparison failure, an attacker can exploit this implementation to identify when exactly the failure occurred. With multiple attempts, the attacker may be able to guesses the correct password/response to challenge and elevate their privileges.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | - |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Authorization | Bypass Protection Mechanism | - |

## Potential mitigations

### Implementation

The hardware designer should ensure that comparison logic is implemented so as to compare in one operation instead in smaller chunks.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2019-10482 | Smartphone OS uses comparison functions that are not in constant time, allowing side channels |
| CVE-2019-10071 | Java-oriented framework compares HMAC signatures using String.equals() instead of a constant-time algorithm, causing timing discrepancies |
| CVE-2014-0984 | Password-checking function in router terminates validation of a password entry when it encounters the first incorrect character, which allows remote attackers to obtain passwords via a brute-force attack that relies on timing differences in responses to incorrect password guesses, aka a timing side-channel attack. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-28929 | iOS and iPadOS: Mail Drafts - Replying to an email could display remote images in Mail in Lockdown Mode | high | 7.5 | - | No | 2026-05-11 |
| CVE-2013-10031 | Plack::Middleware::Session versions before 0.17 for Perl may be vulnerable to HMAC comparison timing attacks | high | 7.5 | - | No | 2025-12-09 |
| CVE-2026-27007 | OpenClaw's sandbox config hash sorted primitive arrays and suppressed needed container recreation | low | 1.1 | - | No | 2026-02-19 |

## Related attack patterns (CAPEC)

- [CAPEC-26](https://radicalnotion.ai/capec/capec-26): Leveraging Race Conditions

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-208](https://radicalnotion.ai/cwe/cwe-208) | Observable Timing Discrepancy |
| Parent | [CWE-697](https://radicalnotion.ai/cwe/cwe-697) | Incorrect Comparison |
| Peer | [CWE-1261](https://radicalnotion.ai/cwe/cwe-1261) | Improper Handling of Single Event Upsets |

## Frequently asked questions

### What is CWE-1254?

The product's comparison logic is performed over a series of steps rather than across the entire string in one operation. If there is a comparison logic failure on one of these steps, the operation may be vulnerable to a timing attack that can result in the interception of the process for nefarious purposes.

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

3 recorded CVEs are attributed to CWE-1254, including CVE-2026-28929, CVE-2013-10031 and CVE-2026-27007.

### How do you prevent CWE-1254?

The hardware designer should ensure that comparison logic is implemented so as to compare in one operation instead in smaller chunks.

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

Exploiting CWE-1254 can lead to: Bypass Protection Mechanism.

### Is CWE-1254 actively exploited?

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

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

---

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