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.)
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.
What is CWE-500?
Real-world CVEs caused by CWE-500
No public CVE references are linked to this CWE in MITRE's catalog yet.
Step-by-step attacker path
- 1
Identify a code path that handles untrusted input without validation.
- 2
Craft a payload that exercises the unsafe behavior — injection, traversal, overflow, or logic abuse.
- 3
Deliver the payload through a normal request and observe the application's reaction.
- 4
Iterate until the response leaks data, executes attacker code, or escalates privileges.
Vulnerable C++
The following examples use of a public static String variable to contain the name of a property/configuration file for the application.
class SomeAppClass {
public:
static string appPropertiesConfigFile = "app/properties.config";
...
} 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.
class SomeAppClass {
public:
static const string appPropertiesConfigFile = "app/properties.config";
...
} 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
How to detect CWE-500
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
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.
Stop paying per developer.
Start closing the loop.
Plexicus is the AI-native ASPM that scans, filters, fixes, pentests, and explains — autonomously. Unlimited developers, unlimited repos, fair-use AI actions. Real free tier, €269/mo annual when you're ready.