---
title: "CWE-500: Public Static Field Not Marked Final"
url: https://radicalnotion.ai/cwe/cwe-500
type: cwe
description: "An object contains a public static field that is not marked final."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-500: Public Static Field Not Marked Final

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

## Description

An object contains a public static field that is not marked final.

## Background

When a field is declared public but not final, the field can be read and written to by arbitrary Java code.

## Modes of introduction

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

## Applicable platforms

**Languages:** C++ (Undetermined), Java (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity | Modify Application Data | The object could potentially be tampered with in unexpected ways. Public static variables can be read without an accessor and changed without a mutator by any classes in the application. |
| Confidentiality | Read Application Data | The object could potentially allow the object to be read. |

## Potential mitigations

### Architecture and Design

Clearly identify the scope for all critical data elements, including whether they should be regarded as static.

### Implementation

Make any static fields private and constant.

A constant field is denoted by the keyword 'const' in C/C++ and ' final' in Java

## 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

The following examples use of a public static String variable to contain the name of a property/configuration file for the application.

Bad code:

```c++
class SomeAppClass {

    public:
        static string appPropertiesConfigFile = "app/properties.config";

    ...
}
```

Bad code:

```java
public class SomeAppClass {

    public static String appPropertiesFile = "app/Application.properties";
    ...
}
```

Good code:

```c++
class SomeAppClass {

    public:
        static const string appPropertiesConfigFile = "app/properties.config";

    ...
}
```

Good code:

```java
public class SomeAppClass {

    public static final String appPropertiesFile = "app/Application.properties";
    ...
}
```

Having a public static variable that is not marked final (constant) may allow the variable to the altered in a way not intended by the application. In this example the String variable can be modified to indicate a different on nonexistent properties file which could cause the application to crash or caused unexpected behavior.

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-493](https://radicalnotion.ai/cwe/cwe-493) | Critical Public Variable Without Final Modifier |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Overflow of static internal buffer | - | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | Do not use public static nonfinal variables | OBJ10-J | - |
| Software Fault Patterns | Unexpected access points | SFP28 | - |

## Frequently asked questions

### What is CWE-500?

An object contains a public static field that is not marked final.

### How do you prevent CWE-500?

Clearly identify the scope for all critical data elements, including whether they should be regarded as static.

### How is CWE-500 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-500?

Exploiting CWE-500 can lead to: Modify Application Data, Read Application Data.

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

---

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