---
title: "CWE-570: Expression is Always False"
url: https://radicalnotion.ai/cwe/cwe-570
type: cwe
description: "The product contains an expression that will always evaluate to false."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-570: Expression is Always False

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

## Description

The product contains an expression that will always evaluate to false.

## Modes of introduction

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

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Quality Degradation, Varies by Context | - |

## Potential mitigations

### Implementation (Refactoring)

Consider refactoring the code, or determine if the code is not including a condition that could cause the expression to become false.

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Effectiveness: High

## Demonstrative examples

### Example 1

In the following Java example the updateUserAccountOrder() method used within an e-business product ordering/inventory application will validate the product number that was ordered and the user account number. If they are valid, the method will update the product inventory, the user account, and the user order appropriately.

Bad code:

```java
public void updateUserAccountOrder(String productNumber, String accountNumber) {
    boolean isValidProduct = false;
    boolean isValidAccount = false;

    if (validProductNumber(productNumber)) {
        isValidProduct = true;
        updateInventory(productNumber);
    }
    else {
        return;
    }

    if (validAccountNumber(accountNumber)) {
        isValidProduct = true;
        updateAccount(accountNumber, productNumber);
    }

    if (isValidProduct && isValidAccount) {
        updateAccountOrder(accountNumber, productNumber);
    }
}
```

Good code:

```java
...
if (validAccountNumber(accountNumber)) {
    isValidAccount = true;
    updateAccount(accountNumber, productNumber);
}
...
```

### Example 2

In the following example, the hasReadWriteAccess method uses bit masks and bit operators to determine if a user has read and write privileges for a particular process. The variable mask is defined as a bit mask from the BIT\_READ and BIT\_WRITE constants that have been defined. The variable mask is used within the predicate of the hasReadWriteAccess method to determine if the userMask input parameter has the read and write bits set.

Bad code:

```c
#define BIT_READ 0x0001 // 00000001
#define BIT_WRITE 0x0010 // 00010000

unsigned int mask = BIT_READ & BIT_WRITE; /* intended to use "|" */

// using "&", mask = 00000000
// using "|", mask = 00010001

// determine if user has read and write access
int hasReadWriteAccess(unsigned int userMask) {
    // if the userMask has read and write bits set
    // then return 1 (true)
    if (userMask & mask) {
        return 1;
    }

    // otherwise return 0 (false)
    return 0;
}
```

### Example 3

In the following example, the updateInventory method used within an e-business inventory application will update the inventory for a particular product. This method includes an if statement with an expression that will always evaluate to false. This is a common practice in C/C++ to introduce debugging statements quickly by simply changing the expression to evaluate to true and then removing those debugging statements by changing expression to evaluate to false. This is also a common practice for disabling features no longer needed.

Bad code:

```c
int updateInventory(char* productNumber, int numberOfItems) {
    int initCount = getProductCount(productNumber);

    int updatedCount = initCount + numberOfItems;

    int updated = updateProductCount(updatedCount);

    // if statement for debugging purposes only
    if (1 == 0) {

        char productName[128];
        productName = getProductName(productNumber);

        printf("product %s initially has %d items in inventory \n", productName, initCount);
        printf("adding %d items to inventory for %s \n", numberOfItems, productName);

        if (updated == 0) {
            printf("Inventory updated for product %s to %d items \n", productName, updatedCount);
        }

        else {
            printf("Inventory not updated for product: %s \n", productName);
        }
    }

    return updated;
}
```

Using this practice for introducing debugging statements or disabling features creates dead code that can cause problems during code maintenance and potentially introduce vulnerabilities. To avoid using expressions that evaluate to false for debugging purposes a logging API or debugging API should be used for the output of debugging messages.

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2024-32633 | Unsigned compared against 0 | medium | 4.0 | - | No | 2024-04-16 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-710](https://radicalnotion.ai/cwe/cwe-710) | Improper Adherence to Coding Standards |
| Can precede | [CWE-561](https://radicalnotion.ai/cwe/cwe-561) | Dead Code |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CERT C Secure Coding | Compile cleanly at high warning levels | MSC00-C | - |
| Software Fault Patterns | Glitch in computation | SFP1 | - |

## Frequently asked questions

### What is CWE-570?

The product contains an expression that will always evaluate to false.

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

1 recorded CVE is attributed to CWE-570: CVE-2024-32633.

### How do you prevent CWE-570?

Consider refactoring the code, or determine if the code is not including a condition that could cause the expression to become false.

### How is CWE-570 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

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

Exploiting CWE-570 can lead to: Quality Degradation, Varies by Context.

### Is CWE-570 actively exploited?

1 recorded CVE is caused by CWE-570; it is not currently in CISA's KEV catalog of actively exploited flaws.

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

---

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