
Disclosure of a stack-based use-after-return vulnerability in Arduino_Core_STM32, detailing technical root cause, affected versions, and fix, with security impact analysis.
A stack-based use-after-return vulnerability exists in legacy versions of Arduino_Core_STM32 prior to version 1.7.0.
The issue is located in the pwm_start() implementation, where a TIM_HandleTypeDef object is allocated on the stack and its address is passed into HAL initialization logic. That pointer may later be retained in a global timer handle registry and dereferenced asynchronously by interrupt service routines after the original stack frame has already returned.
This vulnerability has been assigned CVE-2026-26399 by MITRE.
Arduino_Core_STM32stm32duino / STMicroelectronics ecosystemv0.1.0 through v1.6.1v1.7.0In the legacy implementation of pwm_start(), a TIM_HandleTypeDef structure is created as a local stack variable:
void pwm_start(...) {
TIM_HandleTypeDef timHandle = {};
HAL_TIM_PWM_Init(&timHandle);
...
}
The address of this local object is passed into HAL support logic and may be stored in global timer-management state, such as a global timer handle registry.
After pwm_start() returns, the stack object is no longer valid. However, subsequent asynchronous timer interrupt handlers may still dereference the stale pointer, causing memory corruption and undefined behavior.
Possible security impact includes:
Because this is a library-level issue, real exploitability depends on how the vulnerable library is integrated into firmware and how attacker-controlled input can influence stack reuse and interrupt timing.
cores/arduino/stm32/analog.cpwm_start()TIM_HandleTypeDeftimer_handles)The issue appears to have been resolved indirectly in version 1.7.0 during a refactoring that replaced the previous stack-based handling path with a different timer-management design. No dedicated security advisory appears to have been issued for the legacy vulnerability.
This issue was identified during firmware security research involving fuzzing and root-cause analysis of legacy STM32-based firmware built on Arduino_Core_STM32.
The vendor PSIRT was contacted. The response indicated that current versions are not affected because the issue had already been fixed in version 1.7.0, but no dedicated CVE appears to have been requested by the vendor at that time.
Discovered by Jin Chang.
CVE-2026-26399