---
title: "CWE-480: Use of Incorrect Operator"
url: https://radicalnotion.ai/cwe/cwe-480
type: cwe
description: "The product accidentally uses the wrong operator, which changes the logic in security-relevant ways."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-480: Use of Incorrect Operator

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** Low
- **CVEs with this as primary weakness:** 17
- **Of those, in CISA KEV:** 0
- **New in 2026:** 13
- **CWE catalog version:** 4.21

## Description

The product accidentally uses the wrong operator, which changes the logic in security-relevant ways.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | These types of errors are generally the result of a typo by the programmer. |

## Applicable platforms

**Languages:** C (Sometimes), C++ (Sometimes), Perl (Sometimes)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Alter Execution Logic | This weakness can cause unintended logic to be executed and other unexpected application behavior. |

## Detection methods

### Automated Static Analysis

This weakness can be found easily using static analysis. However in some cases an operator might appear to be incorrect, but is actually correct and reflects unusual logic within the program.

### Manual Static Analysis

This weakness can be found easily using static analysis. However in some cases an operator might appear to be incorrect, but is actually correct and reflects unusual logic within the program.

## Demonstrative examples

### Example 1

The following C/C++ and C# examples attempt to validate an int input parameter against the integer value 100.

Bad code:

```c
int isValid(int value) {
    if (value=100) {
        printf("Value is valid\n");
        return(1);
    }
    printf("Value is not valid\n");
    return(0);
}
```

Bad code:

```c#
bool isValid(int value) {
    if (value=100) {
        Console.WriteLine("Value is valid.");
        return true;
    }
    Console.WriteLine("Value is not valid.");
    return false;
}
```

However, the expression to be evaluated in the if statement uses the assignment operator "=" rather than the comparison operator "==". The result of using the assignment operator instead of the comparison operator causes the int variable to be reassigned locally and the expression in the if statement will always evaluate to the value on the right hand side of the expression. This will result in the input value not being properly validated, which can cause unexpected results.

### Example 2

The following C/C++ example shows a simple implementation of a stack that includes methods for adding and removing integer values from the stack. The example uses pointers to add and remove integer values to the stack array variable.

Bad code:

```c
#define SIZE 50
int *tos, *p1, stack[SIZE];

void push(int i) {
    p1++;
    if(p1==(tos+SIZE)) {

        // Print stack overflow error message and exit
    }
    *p1 == i;
}

int pop(void) {
    if(p1==tos) {

        // Print stack underflow error message and exit
    }
    p1--;
    return *(p1+1);
}

int main(int argc, char *argv[]) {

    // initialize tos and p1 to point to the top of stack
    tos = stack;
    p1 = stack;
    // code to add and remove items from stack
    ...
    return 0;
}
```

### Example 3

The example code below is taken from the CVA6 processor core of the HACK@DAC'21 buggy OpenPiton SoC. Debug access allows users to access internal hardware registers that are otherwise not exposed for user access or restricted access through access control protocols. Hence, requests to enter debug mode are checked and authorized only if the processor has sufficient privileges. In addition, debug accesses are also locked behind password checkers. Thus, the processor enters debug mode only when the privilege level requirement is met, and the correct debug password is provided.

Bad code:

```systemverilog
module csr_regfile #(
...
    // check that we actually want to enter debug depending on the privilege level we are currently in
    unique case (priv_lvl_o)
        riscv::PRIV_LVL_M: begin
            debug_mode_d = dcsr_q.ebreakm;
...
        riscv::PRIV_LVL_U: begin
            debug_mode_d = dcsr_q.ebreaku;
...
    assign priv_lvl_o = (debug_mode_q || umode_i) ?  riscv::PRIV_LVL_M : priv_lvl_q;
...
    debug_mode_q  <= debug_mode_d;
...
```

Good code:

```systemverilog
module csr_regfile #(
...
    // check that we actually want to enter debug depending on the privilege level we are currently in
    unique case (priv_lvl_o)
        riscv::PRIV_LVL_M: begin
            debug_mode_d = dcsr_q.ebreakm;
...
        riscv::PRIV_LVL_U: begin
            debug_mode_d = dcsr_q.ebreaku;
...
    assign priv_lvl_o = (debug_mode_q && umode_i) ? riscv::PRIV_LVL_M : priv_lvl_q;
...
    debug_mode_q  <= debug_mode_d;
...
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2022-3979 | Chain: data visualization program written in PHP uses the "!=" operator instead of the type-strict "!==" operator (CWE-480) when validating hash values, potentially leading to an incorrect type conversion (CWE-704) |
| CVE-2021-3116 | Chain: Python-based HTTP Proxy server uses the wrong boolean operators (CWE-480) causing an incorrect comparison (CWE-697) that identifies an authN failure if all three conditions are met instead of only one, allowing bypass of the proxy authentication (CWE-1390) |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-15043 | DBI::SQL::Nano versions from 1.42 before 1.651 for Perl have inverted = SQL operators on text | critical | 9.8 | - | No | 2026-07-14 |
| CVE-2026-53045 | memory: tegra124-emc: Fix dll\_change check | critical | 9.8 | - | No | 2026-06-24 |
| CVE-2026-43114 | netfilter: nft\_set\_pipapo\_avx2: don't return non-matching entry on expiry | critical | 9.4 | - | No | 2026-05-06 |
| CVE-2026-123601 | Hickory DNS 0.26.0-beta.1 before 0.26.2 NSEC3 Proof of Nonexistence Forgery | high | 8.3 | - | No | 2026-11-08 |
| CVE-2026-48497 | Envoy: Abnormal process termination in DNS UDP filter | high | 7.5 | - | No | 2026-06-26 |
| CVE-2026-4748 | pf silently ignores certain rules | high | 7.5 | - | No | 2026-04-01 |
| CVE-2026-79643 | - | high | 7.3 | - | No | 2026-09-07 |
| CVE-2025-71106 | fs: PM: Fix reverse check in filesystems\_freeze\_callback() | medium | 6.9 | - | No | 2026-01-14 |
| CVE-2025-52985 | Junos OS Evolved: When a control-plane firewall filter refers to a prefix-list with more than 10 entries it's not matching | medium | 6.9 | - | No | 2025-07-11 |
| CVE-2026-83525 | Apache Kafka: Incorrect boolean operator in FetchSnapshot RPC handler allows authenticated network clients to crash the KRaft controller via a malformed request. | medium | 6.5 | - | No | 2026-10-28 |
| CVE-2022-1947 | Use of Incorrect Operator in polonel/trudesk | medium | 6.5 | - | No | 2022-05-31 |
| CVE-2026-44722 | pyzipper: Encryption bypass for small files encrypted with pyzipper | medium | 6.2 | - | No | 2026-07-17 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-670](https://radicalnotion.ai/cwe/cwe-670) | Always-Incorrect Control Flow Implementation |
| Child | [CWE-481](https://radicalnotion.ai/cwe/cwe-481) | Assigning instead of Comparing |
| Child | [CWE-482](https://radicalnotion.ai/cwe/cwe-482) | Comparing instead of Assigning |
| Child | [CWE-597](https://radicalnotion.ai/cwe/cwe-597) | Use of Wrong Operator in String Comparison |
| Child | [CWE-1077](https://radicalnotion.ai/cwe/cwe-1077) | Floating Point Comparison with Incorrect Operator |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Using the wrong operator | - | - |
| CERT C Secure Coding | Do not perform assignments in selection statements | EXP45-C | CWE More Abstract |
| CERT C Secure Coding | Do not use a bitwise operator with a Boolean-like operand | EXP46-C | CWE More Abstract |
| Software Fault Patterns | Glitch in Computation | SFP1 | - |

## Frequently asked questions

### What is CWE-480?

The product accidentally uses the wrong operator, which changes the logic in security-relevant ways.

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

17 recorded CVEs are attributed to CWE-480, including CVE-2026-15043, CVE-2026-53045 and CVE-2026-43114.

### How is CWE-480 detected?

Automated Static Analysis: This weakness can be found easily using static analysis. However in some cases an operator might appear to be incorrect, but is actually correct and reflects unusual logic within the program.

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

Exploiting CWE-480 can lead to: Alter Execution Logic.

### Is CWE-480 actively exploited?

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

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

---

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