# CVE-2026-8718: Out-of-bounds write in DTLS peer Connection ID getsockopt (`TLS_DTLS_PEER_CID_VALUE`) in Zephyr net sockets/TLS

> An out-of-bounds write in Zephyr's DTLS getsockopt handler allows kernel heap corruption, potentially leading to privilege escalation or code execution.

- **Severity:** High 8.4 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 10 Aug 2026
- **Updated:** 12 Aug 2026
- **Also known as:** GHSA-p3r6-mx6c-33gq

## What is CVE-2026-8718?

CVE-2026-8718 is a high-severity memory corruption vulnerability in zephyrproject zephyr, published on 10 Aug 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official 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.

Weakness: CWE-787 (Out-of-bounds Write)

## Which versions are affected by CVE-2026-8718?


## How do I fix CVE-2026-8718?

No fix has been published for CVE-2026-8718 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-8718 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-8718 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-8718 and fix it if it is affected.

What it is: CVE-2026-8718 is a high-severity memory corruption vulnerability in zephyrproject zephyr, published on 10 Aug 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-8718 exists.

Affected product: zephyrproject zephyr. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-8718/ (Markdown: https://insights.sbomify.com/CVE-2026-8718/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-8718
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-8718
- OSV: https://osv.dev/vulnerability/CVE-2026-8718

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-8718/
Summaries are generated and may contain mistakes; the official description above is the record.
