---
title: "CWE-344: Use of Invariant Value in Dynamically Changing Context"
url: https://radicalnotion.ai/cwe/cwe-344
type: cwe
description: "The product uses a constant value, name, or reference, but this value can (or should) vary across different environments."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-344: Use of Invariant Value in Dynamically Changing Context

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

## Description

The product uses a constant value, name, or reference, but this value can (or should) vary across different environments.

## Modes of introduction

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

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Varies by Context | - |

## Demonstrative examples

### Example 1

The following code is an example of an internal hard-coded password in the back-end:

Bad code:

```c
int VerifyAdmin(char *password) {
    if (strcmp(password, "Mew!")) {
        printf("Incorrect Password!\n");
        return(0)
    }
    printf("Entering Diagnostic Mode...\n");
    return(1);
}
```

Bad code:

```java
int VerifyAdmin(String password) {
    if (!password.equals("Mew!")) {
        return(0)
    }
    //Diagnostic Mode
    return(1);
}
```

Every instance of this program can be placed into diagnostic mode with the same password. Even worse is the fact that if this program is distributed as a binary-only distribution, it is very difficult to change that password or disable this "functionality."

### Example 2

This code assumes a particular function will always be found at a particular address. It assigns a pointer to that address and calls the function.

Bad code:

```c
int (*pt2Function) (float, char, char)=0x08040000;
int result2 = (*pt2Function) (12, 'a', 'b');
// Here we can inject code to execute.
```

The same function may not always be found at the same memory address. This could lead to a crash, or an attacker may alter the memory at the expected address, leading to arbitrary code execution.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2002-0980 | Component for web browser writes an error message to a known location, which can then be referenced by attackers to process HTML/script in a less restrictive context |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2023-22746 | CKAN is vulnerable to session secret shared across instances using Docker images | high | 8.6 | - | No | 2023-02-03 |
| CVE-2026-89903 | LoongArch: Do not save/restore percpu base register in rethook trampoline | high | 7.8 | - | No | 2026-09-16 |
| CVE-2026-72357 | uprobes/x86: Use proper mm\_struct in \_\_in\_uprobe\_trampoline | high | 7.8 | - | No | 2026-08-15 |
| CVE-2022-36022 | Some Deeplearning4J packages use unclaimed s3 bucket in tests and examples | medium | 5.3 | - | No | 2022-11-10 |
| CVE-2026-42961 | Inadequate CSRF protection in WAB-BE187-M and other products | medium | 5.1 | - | No | 2026-05-13 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-330](https://radicalnotion.ai/cwe/cwe-330) | Use of Insufficiently Random Values |
| Child | [CWE-323](https://radicalnotion.ai/cwe/cwe-323) | Reusing a Nonce, Key Pair in Encryption |
| Child | [CWE-587](https://radicalnotion.ai/cwe/cwe-587) | Assignment of a Fixed Address to a Pointer |
| Child | [CWE-798](https://radicalnotion.ai/cwe/cwe-798) | Use of Hard-coded Credentials |
| Child | [CWE-1188](https://radicalnotion.ai/cwe/cwe-1188) | Initialization of a Resource with an Insecure Default |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Static Value in Unpredictable Context | - | - |

## Frequently asked questions

### What is CWE-344?

The product uses a constant value, name, or reference, but this value can (or should) vary across different environments.

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

5 recorded CVEs are attributed to CWE-344, including CVE-2023-22746, CVE-2026-89903 and CVE-2026-72357.

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

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

### Is CWE-344 actively exploited?

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

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

---

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