Skip to content

Uninitialized mutex in TLS trusted-credential backend causes kernel NULL-deref DoS under contention

Moderate
d3zd3z published GHSA-57c4-xcq2-fqj7 Aug 12, 2026

Software

zephyr

Affected versions

>= 3.2.0, < 4.4.2

Patched versions

4.4.2

Description

The PSA Protected Storage credential backend (subsys/net/lib/tls_credentials/tls_credentials_trusted.c) declared its credential-store mutex as a plain zero-filled static struct k_mutex credential_lock; and never called k_mutex_init() on it. A statically zero-filled k_mutex has an uninitialized wait queue (its dlist head/tail are NULL instead of the self-referential sentinels that k_mutex_init/K_MUTEX_DEFINE install). The uncontended lock path does not touch the wait queue, so the defect is latent and serialized use behaves correctly.

When two execution contexts contend on the lock, k_mutex_lock() pends the blocking thread on the wait queue via z_pend_curr(), which calls sys_dlist_append() on the zeroed list and dereferences a NULL tail pointer (tail->next = node), faulting the kernel. The lock is held during TLS handshake credential loading and by all credential add/get/delete operations, so a deployment performing concurrent TLS handshakes (for example a server handling multiple simultaneous connections from a remote peer) or a credential-management operation concurrent with a handshake can trigger the dereference.

The impact is a denial of service: a deterministic kernel panic / device reset on the first contention. There is no memory corruption beyond the NULL dereference and no confidentiality or integrity impact; mutual exclusion on the fast path remains correct. Exposure is limited to builds with CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE enabled (PSA Protected Storage / TF-M platforms); the default volatile RAM backend initializes its lock correctly and is unaffected.

The fix initializes the mutex statically with K_MUTEX_DEFINE(credential_lock), providing a valid wait queue so the contended path no longer touches a NULL list.

Affected components

  • subsys/net/lib/tls_credentials

Affected versions

v3.2.0 through v4.4.0 (all releases since the trusted PSA credential backend was added), only when CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE is enabled

Fix

Fixed (merged) in 29581d5

Projected fixed version: 4.5.0 (the fix is merged on main but not yet released; this forecast should be confirmed against the actual release).

Introduced by: fe7ffcf (tls_credentials: add Trusted Credential storage backend, 2022-08-18)

Evidence

  • subsys/net/lib/tls_credentials/tls_credentials_trusted.c:41 — pre-fix static struct k_mutex credential_lock; with no k_mutex_init anywhere in the file (post-fix uses K_MUTEX_DEFINE)
  • subsys/net/lib/tls_credentials/tls_credentials_trusted.c:306-365 — credential_lock guards credentials_lock() (held during TLS handshake credential load) and tls_credential_add/get/delete
  • subsys/net/lib/tls_credentials/tls_credentials.c:22-28 — the sibling volatile backend correctly calls k_mutex_init(&credential_lock), confirming the trusted backend's omission
  • kernel/mutex.c:120-168 — uncontended path skips the wait queue; contended path calls z_pend_curr(&mutex->wait_q,...)
  • include/zephyr/sys/dlist.h:415-424 — sys_dlist_append on a zeroed list does tail = list->tail (NULL); tail->next = node; → NULL pointer dereference
  • subsys/net/lib/tls_credentials/CMakeLists.txt:9-10 — file built only under CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE
  • git tag --contains fe7ffcf — introduced 2022-08-18, present v3.2.0 through v4.4.0 (shipped, reportable)

Patches

Branch Pull request Status
main #110943 merged
v4.4-branch #112741 merged
v4.3-branch #112740 open
v3.7-branch #112739 merged

For more information

If you have any questions or comments about this advisory:

embargo: 2026-08-11

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

CVE ID

CVE-2026-12233

Weaknesses

Improper Initialization

The product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used. Learn more on MITRE.