CWE-487: Reliance on Package-level Scope
Java packages are not inherently closed; therefore, relying on them for code security is not a good practice.
Last updated
Overview
The purpose of package scope is to prevent accidental access by other parts of a program. This is an ease-of-software-development feature but not a security feature.
Common consequences
What can happen when CWE-487 is exploited.
Read Application Data
Affects: Confidentiality
Any data in a Java package can be accessed outside of the Java framework if the package is distributed.
Modify Application Data
Affects: Integrity
The data in a Java class can be modified by anyone outside of the Java framework if the package is distributed.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
Applies to
Languages
How to prevent it
Practical mitigations for CWE-487, grouped by where in the lifecycle they apply.