The product contains dead code, which can never be executed.
View on MITREDead code is code that can never be executed in a running program. The surrounding code makes it impossible for a section of code to ever be executed.
Dead code that results from code that can never be executed is an indication of problems with the source code that needs to be fixed and is an indication of poor quality.
Remove dead code before deploying the application.
Use a static analysis tool to spot dead code.
According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.) Formal Methods / Correct-By-Construction Cost effective for partial coverage: Attack Modeling
According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: Binary / Bytecode Quality Analysis Compare binary / bytecode to application permission manifest
According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: Source Code Quality Analyzer Cost effective for partial coverage: Warning Flags Source code Weakness Analyzer Context-configured Source Code Weakness Analyzer
According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: Manual Source Code Review (not inspections) Cost effective for partial coverage: Focused Manual Spotcheck - Focused manual analysis of source
The condition for the second if statement is impossible to satisfy. It requires that the variables be non-null. However, on the only path where s can be assigned a non-null value, there is a return statement.
In the following class, two private methods call each other, but since neither one is ever invoked from anywhere else, they are both dead code.
(In this case it is a good thing that the methods are dead: invoking either one would cause an infinite loop.)
The field named glue is not used in the following class. The author of the class has accidentally put quotes around the field name, transforming it into a string constant.
chain: incorrect "goto" in Apple SSL product bypasses certificate validation, allowing Adversary-in-the-Middle (AITM) attack (Apple "goto fail" bug). CWE-705 (Incorrect Control Flow Scoping) -> CWE-561 (Dead Code) -> CWE-295 (Improper Certificate Validation) -> CWE-393 (Return of Wrong Status Code) -> CWE-300 (Channel Accessible by Non-Endpoint).
View DetailsNo relationship information available for this CWE.
CWE-561: Dead Code is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product contains dead code, which can never be executed. Dead code is code that can never be executed in a running program. The surrounding code makes it impossible for a section of code to ever be executed.
If exploited, CWE-561 (Dead Code) it can compromise Other, leading to outcomes such as Quality Degradation and Reduce Maintainability.
Recommended mitigations for CWE-561 include: Remove dead code before deploying the application. Use a static analysis tool to spot dead code.
CWE-561 can be detected using Architecture or Design Review, Automated Static Analysis - Binary or Bytecode, Automated Static Analysis - Source Code and Manual Static Analysis - Source Code. Combining automated tooling with manual review typically yields the best coverage.
CWE-561 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.
MITRE documents real CVEs mapped to CWE-561, including CVE-2014-1266. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.
A CWE (Common Weakness Enumeration) like CWE-561 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.