An object contains a public static field that is not marked final, which might allow it to be modified in unexpected ways.
View on MITREPublic static variables can be read without an accessor and changed without a mutator by any classes in the application.
The object could potentially be tampered with.
The object could potentially allow the object to be read.
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
No detection method information available for this CWE.
The following examples use of a public static String variable to contain the name of a property/configuration file for the application.
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.
The following examples use of a public static String variable to contain the name of a property/configuration file for the application.
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.
The following examples use of a public static String variable to contain the name of a property/configuration file for the application.
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.
The following examples use of a public static String variable to contain the name of a property/configuration file for the application.
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.
CWE-500: Public Static Field Not Marked Final is a Common Weakness Enumeration (CWE) entry maintained by MITRE. An object contains a public static field that is not marked final, which might allow it to be modified in unexpected ways. Public static variables can be read without an accessor and changed without a mutator by any classes in the application.
If exploited, CWE-500 (Public Static Field Not Marked Final) it can compromise Integrity and Confidentiality, leading to outcomes such as Modify Application Data and Read Application Data.
Recommended mitigations for CWE-500 include: 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
CWE-500 commonly affects C++ and Java. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.
A CWE (Common Weakness Enumeration) like CWE-500 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.