CWE-500 Variant Draft High likelihood

Public Static Field Not Marked Final

This vulnerability occurs when a class exposes a public static field without declaring it as final, allowing unintended modification from anywhere in the application.

Definition

What is CWE-500?

This vulnerability occurs when a class exposes a public static field without declaring it as final, allowing unintended modification from anywhere in the application.
Public static fields act as global variables within your application's classloader. Because they are public, any other class can directly read and, crucially, modify their value without using proper getter or setter methods. This bypasses any validation, logging, or synchronization logic you might have in place, leading to unpredictable state changes that are difficult to trace and debug. To prevent this, you should mark any necessary public static fields as `final` to make them constants. If a field truly needs to be mutable, consider making it private and providing controlled access through static methods, applying the principle of encapsulation even to static members to maintain data integrity and thread safety.
Real-world impact

Real-world CVEs caused by CWE-500

No public CVE references are linked to this CWE in MITRE's catalog yet.

How attackers exploit it

Step-by-step attacker path

  1. 1

    Identify a code path that handles untrusted input without validation.

  2. 2

    Craft a payload that exercises the unsafe behavior — injection, traversal, overflow, or logic abuse.

  3. 3

    Deliver the payload through a normal request and observe the application's reaction.

  4. 4

    Iterate until the response leaks data, executes attacker code, or escalates privileges.

Vulnerable code example

Vulnerable C++

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

Vulnerable C++
class SomeAppClass {
  		public:
  			static string appPropertiesConfigFile = "app/properties.config";
  		...
  }
Secure code example

Secure C++

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.

Secure C++
class SomeAppClass {
  		public:
  			static const string appPropertiesConfigFile = "app/properties.config";
  		...
  }
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Prevention checklist

How to prevent CWE-500

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

How to detect CWE-500

Automated Static Analysis High

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

Plexicus auto-fix

Plexicus auto-detects CWE-500 and opens a fix PR in under 60 seconds.

Codex Remedium scans every commit, identifies this exact weakness, and ships a reviewer-ready pull request with the patch. No tickets. No hand-offs.

Frequently asked questions

Frequently asked questions

What is CWE-500?

This vulnerability occurs when a class exposes a public static field without declaring it as final, allowing unintended modification from anywhere in the application.

How serious is CWE-500?

MITRE rates the likelihood of exploit as High — this weakness is actively exploited in the wild and should be prioritized for remediation.

What languages or platforms are affected by CWE-500?

MITRE lists the following affected platforms: C++, Java.

How can I prevent CWE-500?

Clearly identify the scope for all critical data elements, including whether they should be regarded as static. Make any static fields private and constant. A constant field is denoted by the keyword 'const' in C/C++ and ' final' in Java

How does Plexicus detect and fix CWE-500?

Plexicus's SAST engine matches the data-flow signature for CWE-500 on every commit. When a match is found, our Codex Remedium agent opens a fix PR with the corrected code, tests, and a one-line summary for the reviewer.

Where can I learn more about CWE-500?

MITRE publishes the canonical definition at https://cwe.mitre.org/data/definitions/500.html. You can also reference OWASP and NIST documentation for adjacent guidance.

Ready when you are

Don't Let Security
Weigh You Down.

Stop choosing between AI velocity and security debt. Plexicus is the only platform that runs Vibe Coding Security and ASPM in parallel — one workflow, every codebase.