CWEweakness

CWE-1254 Incorrect Comparison Logic Granularity

Official page ↗
Abstraction
Base
Structure
Simple
Status
Draft
Languages
Not Language-Specific
CWE version
5.0

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.

Extended description

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.

Common consequences

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

Related

Attack pattern · CAPEC (1)

  • CAPEC-26 Leveraging Race Conditions attack pattern

Observed example · CVE (3)

  • CVE-2019-10482 Due to the use of non-time-constant comparison functions there is issue in timing side channels which can be used as a potential side… vulnerability
  • CVE-2019-10071 The code which checks HMAC in form submissions used String.equals() for comparisons, which results in a timing side channel for the… vulnerability
  • CVE-2014-0984 The passwordCheck function in SAP Router 721 patch 117, 720 patch 411, 710 patch 029, and earlier terminates validation of a Route… vulnerability

Child of · CWE (2)

  • CWE-208 Observable Timing Discrepancy weakness
  • CWE-697 Incorrect Comparison weakness

Referenced by CAPEC · weakness (1)

  • CAPEC-26 Leveraging Race Conditions attack pattern

Referenced by CVE · weakness (6)

  • CVE-2026-28929 A logic issue was addressed with improved checks. vulnerability
  • CVE-2026-34570 CI4MS is a CodeIgniter 4-based CMS skeleton that delivers a production-ready, modular architecture with RBAC authorization and theme… vulnerability
  • CVE-2026-34572 CI4MS is a CodeIgniter 4-based CMS skeleton that delivers a production-ready, modular architecture with RBAC authorization and theme… vulnerability
  • CVE-2026-27007 OpenClaw is a personal AI assistant. vulnerability
  • CVE-2013-10031 Plack-Middleware-Session versions before 0.17 may be vulnerable to HMAC comparison timing attacks vulnerability
  • CVE-2022-39308 GoCD is a continuous delivery server. vulnerability

Referenced by CWE · peer of (1)

  • CWE-1261 Improper Handling of Single Event Upsets weakness