Common Weakness Enumeration

CWE-562

Allowed

Return of Stack Variable Address

Abstraction: Base · Status: Draft

A function returns the address of a stack variable, which will cause unintended program behavior, typically in the form of a crash.

11 vulnerabilities reference this CWE, most recent first.

GHSA-VXCH-4R45-JHW9

Vulnerability from github – Published: 2026-04-20 18:31 – Updated: 2026-04-21 21:31
VLAI
Details

A stack-use-after-return issue exists in the Arduino_Core_STM32 library prior to version 1.7.0. The pwm_start() function allocates a TIM_HandleTypeDef structure on the stack and passes its address to HAL initialization routines, where it is stored in a global timer handle registry. After the function returns, interrupt service routines may dereference this dangling pointer, resulting in memory corruption.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-26399"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-562",
      "CWE-825"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-04-20T18:16:25Z",
    "severity": "MODERATE"
  },
  "details": "A stack-use-after-return issue exists in the Arduino_Core_STM32 library prior to version 1.7.0. The pwm_start() function allocates a TIM_HandleTypeDef structure on the stack and passes its address to HAL initialization routines, where it is stored in a global timer handle registry. After the function returns, interrupt service routines may dereference this dangling pointer, resulting in memory corruption.",
  "id": "GHSA-vxch-4r45-jhw9",
  "modified": "2026-04-21T21:31:20Z",
  "published": "2026-04-20T18:31:49Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-26399"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Acen28/CVE-2026-26399-Disclosure"
    },
    {
      "type": "WEB",
      "url": "https://github.com/stm32duino/Arduino_Core_STM32/releases/tag/1.6.1"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L",
      "type": "CVSS_V3"
    }
  ]
}

Mitigation
Implementation

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

No CAPEC attack patterns related to this CWE.