CWEweakness

CWE-563 Assignment to Variable without Use

Official page ↗
Alternate terms
Unused Variable
Abstraction
Base
Structure
Simple
Status
Draft
Languages
Not Language-Specific
CWE version
5.0

Description

The variable's value is assigned but never used, i.e., is a dead store. That is, after the assignment, the variable is either assigned another value or goes out of scope.

Common consequences

• 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.

Potential mitigations

• [Implementation] Remove unused variables from the code.

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.)

Related

Child of · CWE (1)

Referenced by CVE · weakness (2)

  • CVE-2024-30120 HCL DRYiCE Optibot Reset Station is impacted by an Unused Parameter in the web application. vulnerability
  • CVE-2021-1620 A vulnerability in the Internet Key Exchange Version 2 (IKEv2) support for the AutoReconnect feature of Cisco IOS Software and Cisco IOS XE… vulnerability

Referenced by CWE · has member (1)