Description
tls_opt_dtls_peer_connection_id_value_get() in subsys/net/lib/sockets/sockets_tls.c, which handles getsockopt(SOL_TLS, TLS_DTLS_PEER_CID_VALUE), passed the caller-supplied optval directly to mbedtls_ssl_get_peer_cid() without verifying the buffer was at least MBEDTLS_SSL_CID_OUT_LEN_MAX (default 32) bytes. mbedtls_ssl_get_peer_cid() copies the peer-negotiated DTLS Connection ID (length 1..MBEDTLS_SSL_CID_OUT_LEN_MAX) into that buffer without a destination-size parameter, so a caller-supplied optlen smaller than the CID causes a write of up to 31 bytes past the buffer end.

In CONFIG_USERSPACE builds the getsockopt syscall verifier (z_vrfy_zsock_getsockopt) bounce-buffers the user's optval into a kernel allocation of exactly optlen bytes (k_usermode_alloc_from_copy -> z_thread_malloc), so an unprivileged user thread that passes a small optlen on a connected DTLS socket with Connection ID enabled induces a kernel-heap buffer overflow, with the overflowing content being the remote peer's CID.

The defect requires CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID, an established DTLS session with a negotiated peer CID, and (for the kernel-crossing case) CONFIG_USERSPACE. Introduced when the TLS_DTLS_CID option was added (v3.5.0).

The fix rejects callers whose optlen is below MBEDTLS_SSL_CID_OUT_LEN_MAX with -EINVAL.
Published: 2026-08-10
Score: 8.4 High
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

A vulnerable getsockopt call in Zephyr’s TLS subsystem passes the caller’s optval directly to mbedTLS without verifying the buffer length. When the length supplied is smaller than the maximum DTLS Connection ID size (32 bytes), the copied CID overflows the destination buffer, potentially writing up to 31 bytes beyond its end. This out‑of‑bounds write occurs on the kernel heap when CONFIG_USERSPACE is enabled, allowing an unprivileged user thread to corrupt kernel memory. The weakness is a classic buffer overflow (CWE‑787) that can lead to process crash or privilege escalation.

Affected Systems

The flaw exists in Zephyr Project: Zephyr OS, introduced with the TLS_DTLS_CID option in version 3.5.0 and present in all later releases until patched. It requires the CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID option and an established DTLS session with a negotiated peer CID. Devices running Zephyr with userspace enabled and DTLS Connection ID support are thus impacted.

Risk and Exploitability

The CVSS score is 8.4, indicating high severity, and the vulnerability is not listed in the CISA KEV catalog. Although EPSS data are unavailable, the attack can be performed by any unprivileged user that can invoke getsockopt on a connected DTLS socket. Because the overflow writes data supplied by a remote peer, an attacker could craft a malicious CID to influence the kernel heap layout, potentially enabling arbitrary code execution or privilege escalation. The combination of kernel‑heap corruption and lack of buffer‑size checks makes exploitation straightforward once the conditions are met.

Generated by OpenCVE AI on August 11, 2026 at 00:21 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Zephyr to a version that includes the getsockopt buffer‑size validation, such as v3.5.1 or later.
  • If an upgrade is not immediately possible, disable DTLS Connection ID support by setting CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID=n.
  • Alternatively, restrict the use of SOL_TLS sockets or enforce a minimum optlen of 32 bytes before invoking getsockopt on TLS_DTLS_PEER_CID_VALUE.

Generated by OpenCVE AI on August 11, 2026 at 00:21 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 11 Aug 2026 02:15:00 +0000

Type Values Removed Values Added
First Time appeared Zephyrproject
Zephyrproject zephyr
Vendors & Products Zephyrproject
Zephyrproject zephyr

Mon, 10 Aug 2026 23:00:00 +0000

Type Values Removed Values Added
Description tls_opt_dtls_peer_connection_id_value_get() in subsys/net/lib/sockets/sockets_tls.c, which handles getsockopt(SOL_TLS, TLS_DTLS_PEER_CID_VALUE), passed the caller-supplied optval directly to mbedtls_ssl_get_peer_cid() without verifying the buffer was at least MBEDTLS_SSL_CID_OUT_LEN_MAX (default 32) bytes. mbedtls_ssl_get_peer_cid() copies the peer-negotiated DTLS Connection ID (length 1..MBEDTLS_SSL_CID_OUT_LEN_MAX) into that buffer without a destination-size parameter, so a caller-supplied optlen smaller than the CID causes a write of up to 31 bytes past the buffer end. In CONFIG_USERSPACE builds the getsockopt syscall verifier (z_vrfy_zsock_getsockopt) bounce-buffers the user's optval into a kernel allocation of exactly optlen bytes (k_usermode_alloc_from_copy -> z_thread_malloc), so an unprivileged user thread that passes a small optlen on a connected DTLS socket with Connection ID enabled induces a kernel-heap buffer overflow, with the overflowing content being the remote peer's CID. The defect requires CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID, an established DTLS session with a negotiated peer CID, and (for the kernel-crossing case) CONFIG_USERSPACE. Introduced when the TLS_DTLS_CID option was added (v3.5.0). The fix rejects callers whose optlen is below MBEDTLS_SSL_CID_OUT_LEN_MAX with -EINVAL.
Title Out-of-bounds write in DTLS peer Connection ID getsockopt (`TLS_DTLS_PEER_CID_VALUE`) in Zephyr net sockets/TLS
Weaknesses CWE-787
References
Metrics cvssV3_1

{'score': 8.4, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:H'}


Subscriptions

Zephyrproject Zephyr
cve-icon MITRE

Status: PUBLISHED

Assigner: zephyr

Published:

Updated: 2026-08-10T22:40:26.836Z

Reserved: 2026-05-15T21:27:25.564Z

Link: CVE-2026-8718

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-11T02:00:06Z

Weaknesses