GHSA-8pgj-qvjv-j4fq: ThreadX Modules invokes trace-full callbacks after module unload

GHSA ID

GHSA‑8pgj‑qvjv‑j4fq

CVE ID

CVE‑2026‑113421

Severity

High

CWE

CWE-416

Published

2026‑11‑01

Last updated

2026‑11‑01

Affected packages

Package Vulnerable versions Patched versions

ThreadX

>= 6.0.1, ⇐ 6.5.2.202603

6.5.2.202603b

Description

Summary

ThreadX Modules retains a module’s trace-buffer-full callback after the module is stopped and unloaded. If a kernel-owned trace buffer remains active, a subsequent buffer wrap can invoke the callback after the module’s code allocation has been released.

The reporter observed a callback belonging to an unloaded user-mode module executing in privileged thread context on Cortex-M3. Explicitly unregistering the callback before unload prevented the reported invocation.

Details

A module calls tx_trace_buffer_full_notify, whose module dispatcher forwards the supplied function pointer to _tx_trace_buffer_full_notify. The kernel stores the pointer globally in _tx_trace_full_notify_function, and trace insertion invokes it directly when the active buffer wraps.

_txm_module_manager_stop disables tracing when the trace buffer belongs to the stopping module, but does not revoke the module’s callback when a kernel-owned buffer remains active. _txm_module_manager_unload releases module allocations without clearing the registration. Ordinary kernel operations that generate trace events can therefore reach the retained callback after unload.

The reporter observed post-unload invocation in ten independent Cortex-M3 runs. The callback address was within the unloaded module’s returned code range, and execution occurred in privileged thread context. Unregister-before-unload controls produced no callback invocation in ten runs. These observations have not been independently reproduced by the maintainers.

Impact

An attacker able to execute code in a user-mode module can leave a callback registered beyond the module’s lifetime. On configurations that leave the released code executable, a later trace wrap can execute retained module code in privileged context, bypassing the intended module lifetime and isolation boundaries.

If the released allocation is reused or becomes inaccessible, the stale function pointer can instead redirect control flow or cause a fault. The reporter did not demonstrate code reuse, information disclosure, an attacker-controlled payload, or a product-level exploit.

Affected configurations

Affected configurations use ThreadX Modules, enable TX_ENABLE_EVENT_TRACE, expose trace-buffer-full notification to modules, and directly invoke the registered callback when an active trace buffer wraps. The reported configuration uses a user-mode, MPU-protected GNU Cortex-M3 module, dynamically allocated module code, and a kernel-owned trace buffer that remains active after unload.

Affected versions: [6.0.1, 6.5.2.202603]. The defect originated with the Modules implementation. The reported GNU Cortex-M3 module configuration is available from ThreadX 6.1.7. Whether a stale callback executes successfully depends on the code allocation and executable-memory configuration.

Severity

High, CVSS v4.0 CVSS-B 7.3: CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N. CWE-416: Use After Free.

The attacker requires execution in a loaded user-mode module. AT:P reflects the required resident-managed unload followed by a trace wrap before the released code is overwritten or becomes unavailable, execution conditions not fully controlled by the module. Privileged execution can compromise the kernel’s confidentiality, integrity, and availability; no separate subsequent-system impact is established.

Patches

Fixed in ThreadX 6.5.2.202603b. The Module Manager dispatcher now refuses tx_trace_buffer_full_notify from user-mode modules with TXM_MODULE_INVALID_PROPERTIES, for a null pointer as well as a function, so a user-mode module can no longer leave a callback registered. The same change fixes GHSA-xr9m-8j99-rw4m, which reports the registration itself. A regression test drives the dispatcher with user-mode and privileged modules and fails without the fix.

This differs from the correction proposed when the report was accepted, which revoked a module’s callback at unload. Refusing the registration removes the user-mode attack path entirely. A privileged module can still register a callback that outlives it; privileged modules run with the kernel’s privileges and are trusted, so this is not a security boundary.

Workarounds

Build without TX_ENABLE_EVENT_TRACE, or do not enable tracing at run time, on systems that load untrusted modules. Alternatively, define TXM_TRACE_BUFFER_FULL_NOTIFY_CALL_NOT_USED when building the Module Manager to remove the service from the dispatch table.

Credits

Reported by testacegi (@testacegi) and alex16848 (@alex16848). Fixed by Frédéric Desbiens.

The analysis, fix and regression test were produced with AI assistance under human review, in accordance with the Eclipse Foundation’s Generative AI Usage Guidelines.