CWE-500: Public Static Field Not Marked Final

VariantDraftExploit Likelihood: High

An object contains a public static field that is not marked final, which might allow it to be modified in unexpected ways.

View on MITRE
Back to CWE Lookup

Extended Description

Public static variables can be read without an accessor and changed without a mutator by any classes in the application.

Technical Details

Structure
Simple

Applicable To

Languages
C++Java
Platforms

Frequently Asked Questions

What is CWE-500: Public Static Field Not Marked Final?+

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.

What are the security consequences of Public Static Field Not Marked Final?+

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.

How do you prevent or mitigate Public Static Field Not Marked Final?+

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

Which programming languages are affected by Public Static Field Not Marked Final?+

CWE-500 commonly affects C++ and Java. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What is the difference between a CWE and a CVE?+

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.

Learn More