1281
Nature Type ID Name Page
MemberOf 1006 Bad Coding Practices 2422
Weakness Ordinalities
Indirect :
Alternate Terms
Unused Variable :
Common Consequences
Scope Impact Likelihood
Other Quality Degradation
Varies by Context
This weakness could be an indication of a bug in the
program or a deprecated variable that was not removed
and is an indication of poor quality. This could lead to
further bugs and the introduction of weaknesses.
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
Remove unused variables from the code.
Demonstrative Examples
Example 1:
The following code excerpt assigns to the variable r and then overwrites the value without using it.
Example Language: C (Bad)
r = getName();
r = getNewBuffer(buf);
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 747 CERT C Secure Coding Standard (2008) Chapter 14 -
Miscellaneous (MSC)
734 2350
MemberOf 883 CERT C++ Secure Coding Section 49 - Miscellaneous
(MSC)
868 2381
MemberOf 884 CWE Cross-section 884 2567
MemberOf 886 SFP Primary Cluster: Unused entities 888 2382
CWE Version 4.14
CWE-564: SQL Injection: Hibernate
CWE-564: SQL Injection: Hibernate