CWE-561: Dead Code

BaseDraft

The product contains dead code, which can never be executed.

View on MITRE
Back to CWE Lookup

Extended Description

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.

Technical Details

Structure
Simple

Applicable To

Languages
Not Language-Specific
Platforms

Frequently Asked Questions

What is CWE-561: Dead Code?+

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.

What are the security consequences of Dead Code?+

If exploited, CWE-561 (Dead Code) it can compromise Other, leading to outcomes such as Quality Degradation and Reduce Maintainability.

How do you prevent or mitigate Dead Code?+

Recommended mitigations for CWE-561 include: Remove dead code before deploying the application. Use a static analysis tool to spot dead code.

How is Dead Code detected?+

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.

Which programming languages are affected by Dead Code?+

CWE-561 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Dead Code?+

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.

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

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.

Learn More