---
title: "CWE-563: Assignment to Variable without Use"
url: https://radicalnotion.ai/cwe/cwe-563
type: cwe
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."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-563: Assignment to Variable without Use

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 3
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

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

## Alternate terms

- Unused Variable

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | The variable assignment without use may be vestigial from previous code changes or refactoring, but it is also possible that the unused variable points out a bug. |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| 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.)

Effectiveness: High

## Demonstrative examples

### Example 1

The following code excerpt assigns to the variable r and then overwrites the value without using it.

Bad code:

```c
r = getName();
r = getNewBuffer(buf);
```

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2021-1620 | Cisco IOS and IOS XE Software IKEv2 AutoReconnect Feature Denial of Service Vulnerability | high | 7.7 | - | No | 2021-09-23 |
| CVE-2024-43851 | soc: xilinx: rename cpu\_number1 to dummy\_cpu\_number | medium | 5.5 | - | No | 2024-08-17 |
| CVE-2024-30120 | HCL DRYiCE Optibot Reset Station is impacted by an Unused Parameter in the web application | low | 2.9 | - | No | 2024-06-14 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-1164](https://radicalnotion.ai/cwe/cwe-1164) | Irrelevant Code |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CERT C Secure Coding | Compile cleanly at high warning levels | MSC00-C | - |
| SEI CERT Perl Coding Standard | Detect and remove unused variables | MSC01-PL | Imprecise |
| Software Fault Patterns | Unused Entities | SFP2 | - |

## Frequently asked questions

### What is CWE-563?

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.

### What CVEs are caused by CWE-563?

3 recorded CVEs are attributed to CWE-563, including CVE-2021-1620, CVE-2024-43851 and CVE-2024-30120.

### How do you prevent CWE-563?

Remove unused variables from the code.

### How is CWE-563 detected?

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

### What are the consequences of CWE-563?

Exploiting CWE-563 can lead to: Quality Degradation, Varies by Context.

### Is CWE-563 actively exploited?

3 recorded CVEs are caused by CWE-563; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/563.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-563). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
