1316
Applicable Platforms
Language : Java (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Confidentiality
Integrity
Availability
Alter Execution Logic
Execute Unauthorized Code or Commands
Modify Application Data
Detection Methods
Automated Static Analysis
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.)
Effectiveness = High
Potential Mitigations
Phase: Implementation
If you are using finalize() as it was designed, there is no reason to declare finalize() with anything
other than protected access.
Demonstrative Examples
Example 1:
The following Java Applet code mistakenly declares a public finalize() method.
Example Language: Java (Bad)
public final class urlTool extends Applet {
public void finalize() {
...
}
...
}
Mobile code, in this case a Java Applet, is code that is transmitted across a network and executed
on a remote machine. Because mobile code developers have little if any control of the environment
in which their code will execute, special security concerns become relevant. One of the biggest
environmental threats results from the risk that the mobile code will run side-by-side with other,
potentially malicious, mobile code. Because all of the popular web browsers execute code from
multiple sources together in the same JVM, many of the security guidelines for mobile code are
focused on preventing manipulation of your objects' state and behavior by adversaries who have
access to the same virtual machine where your product is running.
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 850 The CERT Oracle Secure Coding Standard for Java
(2011) Chapter 7 - Methods (MET)
844 2364
MemberOf 1002 SFP Secondary Cluster: Unexpected Entry Points 888 2421
CWE Version 4.14
CWE-584: Return Inside Finally Block
CWE-584: Return Inside Finally Block