1. CVE archive
  2. Vulnerability types
  3. CWE-562
CWE-562 · #474 most frequent type in the archive

Return of Stack Variable Address

A function returns the address of a stack variable.

Part of: CWE-758 · Reliance on Undefined, Unspecified, or Implementation-Defined Behavior

7CVEs of this type in the archive
1critical (CVSS ≥ 9)
1high severity (7–8.9)
Nov 25, 2026latest published

What it is

A function returns the address of a stack variable.

Because local variables are allocated on the stack, when a program returns a pointer to a local variable, it is returning a stack address. A subsequent function call is likely to re-use this same stack address, thereby overwriting the value of the pointer, which no longer corresponds to the same variable since a function's stack frame is invalidated when it returns. At best this will cause the value of the pointer to change unexpectedly. In many cases it causes the program to crash the next time the pointer is dereferenced.

Impact on systems

ScopeImpact
Availability, Integrity, Confidentiality Read Memory, Modify Memory, Execute Unauthorized Code or Commands, DoS: Crash, Exit, or Restart
If the returned stack buffer address is dereferenced after the return, then an attacker may be able to modify or read memory, depending on how the address is used. If the address is used for reading, then the address itself may be exposed, or the contents that the address points to. If the address is used for writing, this can lead to a crash and possibly code execution.

How to prevent it

Implementation Fix the code so that it does not return a stack address.

Source: MITRE CWE catalog · Official entry on the MITRE website

CWE-562 CVEs published per year

2026: year in progress, updated every hour

Show the data as a table
YearCVE
20211
20221
20231
20241
20263

All CWE-562 CVEs

7 results

Dottor Marc

Is this type of vulnerability in your systems?

An archive tells you what exists; a Vulnerability Assessment tells you what is exposed on your side. Dottor Marc tests your web applications and network with automated and manual checks.