Security Advisory

CVE-2025-34468: libcoap Stack-Based Buffer Overflow in Hostname Address Resolution

Last updated:
  • CVE-2025-34468

CVE-2025-34468 is a critical stack-based buffer overflow in libcoap, the widely embedded open-source C library implementing the CoAP (Constrained Application Protocol) used by many IoT and firmware CoAP clients and servers: when an application built with libcoap's proxy logic enabled resolves an attacker-supplied hostname longer than 255 bytes, the hostname is copied into a fixed 256-byte stack buffer without a length check, letting a remote, unauthenticated attacker crash the process and potentially achieve remote code execution depending on the target's compiler hardening and memory protections; NVD has published its own Primary CVSS v3.1 score of 9.8 (critical) for the flaw.

Vulnerability summary

9.8

Critical

0.7%

EPSS score (FIRST)

No

CISA KEV catalog

2025-12-31

Published

Vulnerability ID: CVE-2025-34468 · Source: NVD

Affected components

ComponentCPEVersion range
obgm/libcoap (open-source C implementation of the CoAP protocol, RFC 7252, commonly embedded in resource-constrained IoT and firmware stacks)cpe:2.3:a:libcoap:libcoap:*:*:*:*:*:*:*:*All versions up to and including 4.3.5, prior to the fix in commit 30db3ea; exploitation requires an application built with libcoap's proxy request-handling path enabled

What does this mean for affected devices?

CVE-2025-34468 (CWE-121, stack-based buffer overflow; also tagged CWE-787, out-of-bounds write) affects libcoap, the obgm/libcoap open-source C implementation of the IETF's CoAP protocol (RFC 7252) that ships inside many resource-constrained IoT and embedded devices using CoAP for machine-to-machine messaging. NVD's description states: "libcoap versions up to and including 4.3.5, prior to commit 30db3ea, contain a stack-based buffer overflow in address resolution when attacker-controlled hostname data is copied into a fixed 256-byte stack buffer without proper bounds checking. A remote attacker can trigger a crash and potentially achieve remote code execution depending on compiler options and runtime memory protections. Exploitation requires the proxy logic to be enabled (i.e., the proxy request handling code path in an application using libcoap)" (NVD).

NVD lists the CVE's status as "Analyzed" with its own Primary CVSS v3.1 base score of 9.8 (critical), vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H; VulnCheck, which disclosed the issue, separately scores it 8.2 under CVSS v4.0 as a Secondary rating, reflecting that exploitation needs the proxy code path to be reachable (NVD, VulnCheck advisory).

The upstream fix, commit 30db3ea in the obgm/libcoap repository, is titled "coap_address.c: Validate length of provided host name" and states plainly: "Host names larger than 255 bytes will cause an internal buffer overflow. Hostnames provided to coap_resolve_address_info() now have their length validated," adding that the flaw was "Discovered by SecMate (https://secmate.dev)" and that coap_split_uri() now sanity-checks host lengths when parsing a CoAP URI (libcoap commit 30db3ea). The fix was tracked upstream via pull request #1737.

This CVE is not listed in the CISA Known Exploited Vulnerabilities catalog as of catalog version 2026.11.06, and FIRST scores the probability of exploitation at 0.00748 (55.065th percentile) as of 2026-11-06 — a critical, NVD-confirmed library flaw with no reported in-the-wild exploitation to date (CISA KEV, FIRST EPSS).

Any firmware or embedded application that links libcoap 4.3.5 or earlier and enables its proxy request-handling functionality should upgrade to a version that includes commit 30db3ea, and should treat CoAP proxy endpoints reachable from untrusted networks as a priority for patching.

How to fix this class of issueThis advisory's weakness class is Memory corruption. Our practical guide covers how to detect, fix, verify and disclose it: How to fix memory corruption in embedded firmware.

Evidence

  • libcoap versions up to and including 4.3.5, prior to commit 30db3ea, contain a stack-based buffer overflow in address resolution: attacker-controlled hostname data is copied into a fixed 256-byte stack buffer without bounds checking, enabling a crash or potential RCE when the proxy request-handling code path is enabled. — NVD
  • NVD status 'Analyzed'; NVD Primary CVSS v3.1 base score 9.8 (critical), vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H; VulnCheck's Secondary CVSS v4.0 score is 8.2. — NVD
  • Fix commit 30db3ea validates hostname length in coap_address.c and coap_uri.c; hostnames longer than 255 bytes previously caused an internal buffer overflow in coap_resolve_address_info(); discovered by SecMate. — libcoap GitHub commit 30db3eaa1f0464722ebea2ca2d5084aebfbd344d
  • VulnCheck rates the flaw 'High' severity, CWE-121 (stack-based buffer overflow), credits SecMate, and confirms exploitation requires the proxy request-handling path. — VulnCheck advisory
  • Not present in the CISA KEV catalog as of catalog version 2026.11.06; EPSS score is 0.00748 (55.065th percentile) as of 2026-11-06. — FIRST EPSS

Related advisories

Sources

  1. NVD
  2. libcoap GitHub commit 30db3eaa1f0464722ebea2ca2d5084aebfbd344d
  3. libcoap pull request #1737
  4. VulnCheck advisory
  5. CISA KEV
  6. FIRST EPSS

Frequently asked questions

What does an attacker need to exploit CVE-2025-34468 in libcoap?

The attacker needs to get a hostname longer than 255 bytes resolved by a libcoap-based application that has its CoAP proxy request-handling code path enabled; libcoap then copies that hostname into a fixed 256-byte stack buffer without checking its length, overflowing the buffer (per NVD; per the libcoap fix commit 30db3ea).

How severe is CVE-2025-34468 according to NVD's own scoring?

NVD has published its own Primary CVSS v3.1 base score of 9.8 (critical), vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, reflecting that no privileges or user interaction are needed and that the impact can include full compromise of confidentiality, integrity and availability (per NVD).

How was CVE-2025-34468 fixed and who found it?

The issue was discovered by the researcher group SecMate and fixed upstream in libcoap commit 30db3ea, which adds length validation for hostnames passed to coap_resolve_address_info() and sanity-checks host lengths when libcoap parses a CoAP URI via coap_split_uri() (per the libcoap GitHub commit).