CoAP (RFC 7252) is a REST-like protocol built for constrained IoT devices over UDP, and it ships with no security by default — NoSec is a named, legitimate configuration, not an oversight. Two independent internet-wide scans, Shadowserver's in 2020 and NETSCOUT's in 2019, each found several hundred thousand exposed CoAP hosts and measured amplification factors of roughly 27x and 34x respectively, confirming CoAP's unsecured default is not a theoretical risk but a measured, ongoing source of DDoS reflection capacity and real attacks already observed in the wild.
Key takeaways
- CoAP (RFC 7252) is a REST-like protocol built for constrained IoT devices over UDP, and it ships with no security by default — NoSec is a named, legitimate configuration, not an oversight.
- Source: RFC 7252 §6.1, §6.2, §9 and §9.1.3, read 2026-11-12.
- Source: RFC 9528 Table 2, read 2026-11-12.
- Three questions decide it: is there a proxy in the path, does the device have public-key code, and how many devices share a key?
What is CoAP, and what does "no security by default" actually mean?
CoAP is an IETF standard published by the Constrained RESTful Environments (CoRE) Working Group as RFC 7252, described in the spec's own abstract as "a specialized web transfer protocol for use with constrained nodes and constrained (e.g., low-power, lossy) networks." It gives small, often battery-powered IoT devices a REST-style interface — GET, PUT, POST, DELETE against named resources — without the overhead of a full TCP/TLS stack, running instead over UDP. That design choice is also the source of CoAP's two defining security properties: the protocol itself applies no cryptography unless an implementer deliberately configures it, and because it rides on UDP rather than a connection-oriented transport, a small request can trigger a disproportionately larger response — the mechanism DDoS amplification depends on.
The RFC is explicit that the base protocol carries no authentication of its own: "CoAP itself does not provide protocol primitives for authentication or authorization; where this is required, it can either be provided by communication security (i.e., IPsec or DTLS) or by object security (within the payload)."
What security modes does CoAP define, and why does OSCORE exist?
RFC 7252's Section 9 ("Securing CoAP") specifies DTLS as CoAP's primary security binding and defines four modes: NoSec (no security — the default unless changed), PreSharedKey (symmetric key authentication, keys distributed out of band), RawPublicKey (public-key authentication without a full certificate infrastructure), and Certificate (X.509 certificate-based authentication, the same trust model TLS uses on the web). The RFC makes NoSec and RawPublicKey the two modes that are "mandatory to implement", and it names a mandatory cipher suite for each DTLS mode:
| Mode | URI scheme / default port | Key material on the device | Mandatory-to-implement cipher suite (RFC 7252 §9.1.3) |
|---|---|---|---|
| NoSec | coap://, UDP 5683 |
none | none (DTLS disabled) |
| PreSharedKey | coaps://, UDP 5684 |
list of pre-shared keys, each tied to the nodes it may talk to | TLS_PSK_WITH_AES_128_CCM_8 |
| RawPublicKey | coaps://, UDP 5684 |
asymmetric key pair without a certificate, validated out of band | TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 |
| Certificate | coaps://, UDP 5684 |
key pair plus X.509 certificate and a list of trust anchors | TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 |
Source: RFC 7252 §6.1, §6.2, §9 and §9.1.3, read 2026-11-12.
These modes protect a CoAP exchange hop by hop: DTLS, like TLS, terminates at each proxy or protocol translator, so every intermediary can see (and potentially alter) the message in the clear.
RFC 8613 defines OSCORE (Object Security for Constrained RESTful Environments) specifically to close that gap. Rather than securing the transport, OSCORE applies end-to-end, object-level protection directly to the CoAP request/response content using CBOR Object Signing and Encryption (COSE), so the payload stays protected across however many proxies or protocol translations sit between endpoints. The RFC sorts every message field into Class E (encrypted and integrity protected), Class I (integrity protected only) or Class U (unprotected, so a proxy can still read what it needs to route). Its defaults are AES-CCM-16-64-128 for the AEAD algorithm, HKDF SHA-256 for key derivation and an anti-replay window of 32 messages. OSCORE and DTLS are complementary: a device can run OSCORE end to end while still running DTLS hop by hop, or use OSCORE alone where DTLS isn't practical — OMA's LwM2M added OSCORE as an option to support proxy operations its original pure-DTLS model couldn't handle.
How does EDHOC set up OSCORE keys on a constrained device?
OSCORE needs a shared Master Secret, and RFC 9528 (March 2024) defines EDHOC, "a very compact and lightweight authenticated Diffie-Hellman key exchange with ephemeral keys" that provides "mutual authentication, forward secrecy, and identity protection." The RFC names establishing an OSCORE security context as "a main use case", and it reuses COSE, CBOR and CoAP so that "the additional code size can be kept very low" on a device that already speaks OSCORE. EDHOC has three mandatory messages and four authentication methods:
| EDHOC method | Initiator authenticates with | Responder authenticates with |
|---|---|---|
| 0 | Signature key | Signature key |
| 1 | Signature key | Static Diffie-Hellman key |
| 2 | Static Diffie-Hellman key | Signature key |
| 3 | Static Diffie-Hellman key | Static Diffie-Hellman key |
Source: RFC 9528 Table 2, read 2026-11-12.
None of the methods is mandatory to implement, but implementations "MUST support cipher suites 2 and 3" (AES-CCM-16-64-128 or AES-CCM-16-128-128 with SHA-256, P-256 and ES256). A follow-on standard, RFC 9668 (November 2024), adds an optimisation that combines the last EDHOC message with the first OSCORE-protected request, which "reduces the number of round trips required" — useful on a sleepy radio link where each round trip costs battery.
Which CoAP security option fits which deployment?
Three questions decide it: is there a proxy in the path, does the device have public-key code, and how many devices share a key?
| Deployment | Usual choice | Why |
|---|---|---|
| Direct device ↔ server, small fleet, factory-provisioned keys | DTLS PreSharedKey with one key per device | Smallest code and handshake; RFC 7252 warns a key shared by more than two entities "only enables the entities to authenticate as a member of that group and not as a specific peer" |
| Direct device ↔ server, large fleet | DTLS RawPublicKey or Certificate | Per-device identity without distributing symmetric secrets |
| Device behind a CoAP proxy, HTTP translator or border router | OSCORE (optionally over DTLS) | Only end-to-end protection survives the intermediary |
| Device that needs per-session keys for OSCORE | EDHOC, then OSCORE | Forward secrecy and mutual authentication inside the CoAP stack |
| LwM2M-managed device | LwM2M security mode 0, 1, 2 or 4, plus OSCORE behind proxies | The LwM2M 1.1.1 transport specification defines modes 0–4 (3 is NoSec) and says LwM2M "MUST NOT be deployed without appropriate security" |
The same reasoning applies to the other lightweight protocols a device may carry; our MQTT security guide and Thread mesh guide cover the equivalent choices there.
How exposed are real CoAP devices, and how bad is the amplification risk?
Two independent, differently-run scans reached similar numbers. The Shadowserver Foundation's internet-wide IPv4 scan, dated 21 June 2020, sent a 21-byte CoAP discovery request to UDP port 5683 across routable address space and found 464,159 exposed hosts, concentrated in the Philippines, China and Russia (roughly 93% of the total between them), with an average response of 569 bytes — which Shadowserver itself calculates as "roughly 27 times of the inbound request", while noting that the average CoAP amplification factor "has been quantified in the past at around 34." NETSCOUT's ASERT team, publishing in January 2019, found 388,344 exposed devices (81% in China) with a 21-byte request producing a 720-byte average response — the source of that factor of 34 — and reported observing real DDoS attacks already using CoAP reflection beginning in mid-January 2019.
| Source | Date | Exposed hosts found | Average response to a 21-byte request | Amplification factor |
|---|---|---|---|---|
| Shadowserver Foundation | 21 Jun 2020 | 464,159 | 569 bytes | ~27x |
| NETSCOUT ASERT | 31 Jan 2019 | 388,344 | 720 bytes | ~34x |
Sources: Shadowserver and NETSCOUT ASERT, read 2026-11-12.
Shadowserver has since turned this into a standing daily "Accessible CoAP Report" for network owners and national CSIRTs, so the exposure is tracked, not a one-off. The report also flags a second risk beyond DDoS: some exposed CoAP services leak information directly to anyone who queries them, including "authorization credentials to services, such as wifi networks."
How can a CoAP server limit amplification?
RFC 7252 §11.3 already says "large amplification factors SHOULD NOT be provided in the response if the request is not authenticated", and RFC 9175 (February 2022) adds a concrete tool. In order of effort:
Do not answer the internet at allFirewall UDP/5683 and 5684 to the hosts that need them; RFC 7252 notes the problem is worst for nodes that "enable NoSec access, are accessible from an attacker, and can access potential victims." Use block-wise transfer for large resourcesThe RFC's own example: a 10-byte request for a 1000-byte resource can produce an 80-byte response with a 64-byte block instead of a 1016-byte one. Check the source address with the Echo optionRFC 9175 recommends that a server facing an unverified peer reply with a short message carrying an Echo option (for example 4.01 Unauthorized) so the client proves it is reachable at its claimed address; it cites an amplification factor of 3 as acceptable and gives 136 bytes as a safe default size for initial responses. Refuse unauthenticated multicastRFC 7252 says servers "SHOULD NOT accept multicast requests that can not be authenticated in some way."
Have real vulnerabilities been found in CoAP implementations?
Yes, consistently in the two most widely used open-source CoAP libraries, though these are implementation bugs rather than protocol-design flaws.
| CVE | Library | What NVD records | Score (source) |
|---|---|---|---|
| CVE-2021-34433 | Eclipse Californium 2.0.0–2.6.4, 3.0.0-M1–M3 | Certificate-based (X.509 and RPK) DTLS handshakes succeed "without verifying the server side's signature on the client side" when the signature is missing from ServerKeyExchange | 7.5 (NVD, CVSS 3.1) |
| CVE-2022-39368 | Eclipse Californium before 3.7.0 and 2.7.4 | Failing handshakes don't clean up throttling counters, so records end up permanently dropped | 8.2 (NVD, CVSS 3.1) |
| CVE-2024-0962 | libcoap 4.3.4 (NVD CPE); 4.3.2 to 4.3.4 (Debian security tracker: code added in 4.3.2-rc1, fixed in 4.3.5-rc1) | Stack-based buffer overflow in get_split_entry of src/coap_oscore.c, the OSCORE configuration handler |
7.8 (NVD, CVSS 3.1) |
| CVE-2025-65496 and siblings CVE-2025-65493 to -65501 | libcoap 4.3.5 with OpenSSL | NULL-pointer dereferences and related errors in src/coap_openssl.c triggered by a crafted DTLS handshake or certificate |
NVD records published 2025-11-24 |
| CVE-2025-34468 (VulnCheck advisory) | libcoap up to 4.3.5, before commit 30db3ea | "attacker-controlled hostname data is copied into a fixed 256-byte stack buffer without proper bounds checking"; needs the proxy code path enabled | 9.8 (NVD, CVSS 3.1); 8.2 (VulnCheck, CVSS 4.0) |
Sources: NVD CVE records and VulnCheck, read 2026-11-12; Debian security tracker for CVE-2024-0962, read 2026-11-19.
None of these are fixed by turning on DTLS or OSCORE correctly — they are bugs in the code parsing CoAP and DTLS messages, which is exactly why patching the library version matters independently of which security mode a device uses. Several sit in DTLS glue code, so track the TLS library underneath too; see our mbed TLS and wolfSSL vulnerabilities guide. The libcoap ChangeLog shows how much the DTLS surface moves between releases: version 4.3.5 alone added wolfSSL support, DTLS 1.3 via wolfSSL and Connection-ID support.
What does a CoAP security review look like on one device?
Worked example — synthetic device and values, for illustration only. A battery-powered sensor ships libcoap 4.3.4 linked against OpenSSL, serves /.well-known/core and two resources, and reports to the cloud through a gateway.
List the CoAP stackThe firmware's SBOM shows libcoap 4.3.4 and OpenSSL 3.0.x. CVE-2024-0962 applies to libcoap 4.3.4 if OSCORE configuration files are parsed: NVD's CPE names only 4.3.4, but the Debian security tracker traces the code to 4.3.2-rc1 and the fix to 4.3.5-rc1, so 4.3.2 and 4.3.3 builds are affected too; the CVE-2025-65493 to -65501 group is recorded against 4.3.5 with OpenSSL, so the upgrade target is a release or patch set that includes those fixes. Read the configured modeThe device listens on coap://port 5683 only — NoSec — and relies on the gateway's network for protection.Measure the replyThe 21-byte discovery request returns 410 bytes: roughly 20x, well above the factor of 3 RFC 9175 treats as acceptable. Decide the target designThe gateway is a CoAP proxy, so DTLS alone would leave readings readable on it; the team picks OSCORE with EDHOC method 3 for per-device keys, and keeps DTLS PreSharedKey with one key per device on the gateway link. Cut the reflection surfacewith authenticated discovery, 64-byte blocks and the Echo option.
What should a device maker or integrator check first?
Confirm which security mode is actually configured, not just supported. NoSec is a legitimate protocol mode, which is precisely why it shows up in production by accident — many libraries default to it unless a developer explicitly switches to PreSharedKey, RawPublicKey, Certificate, or adds OSCORE. Firewall UDP/5683 if any device is reachable from the public internetCoAP was designed for constrained local or operator networks, not open exposure — Shadowserver's hundreds of thousands of exposed hosts are the direct, measured cost of skipping this. Patch the specific CoAP library in your firmwareA correctly configured DTLS/OSCORE setup does not protect against a buffer overflow in the code that parses the message first. If using OMA LwM2M for device management, check its security-mode configuration explicitly— its Security Object carries CoAP's DTLS modes plus a Certificate-with-EST mode, and version 1.1 adds OSCORE as a separately configured layer. Re-verify after any firmware updatethat the configured security mode and library version weren't silently reset to a less secure default.
What are the common CoAP security pitfalls?
- One pre-shared key for the whole fleet. RFC 7252 is direct that a key shared by more than two parties only proves group membership; one extracted key then speaks for every device.
- OSCORE sequence numbers lost on reboot. RFC 8613 Appendix B.1 describes storing the Sender Sequence Number in persistent memory with a margin, because reusing a number with the same key breaks the AEAD nonce.
- Assuming DTLS protects through a proxy. It ends at the proxy; only OSCORE carries protection end to end.
- Leaving
/.well-known/coreopen and verbose. It is the request scanners and reflection attacks both use.
Where does SoftWSP fit in a CoAP review?
SoftWSP works from the firmware, not the network. It extracts a CycloneDX 1.6 SBOM from a firmware image and matches components such as libcoap, Californium or the TLS library under them against NVD, CISA KEV, FIRST EPSS and CISA CSAF ICS advisories, and a watchlist can alert on a CVE ID or a vendor-product pair. The AI-drafted report cites the record behind every finding, and an engineer reviews it before it goes out. SoftWSP does not parse CoAP traffic, read the configured security mode or scan the internet; those checks stay with your own tests. You can open an existing SBOM in the free SBOM viewer, read how firmware SBOMs are built in our firmware SBOM guide, or see Device & Firmware Security.
This guide draws on RFC 7252, RFC 8613, RFC 9528, RFC 9668 and RFC 9175 fetched directly from the IETF RFC Editor, the OMA LwM2M 1.1.1 transport specification, the Shadowserver Foundation's and NETSCOUT ASERT's published internet-wide CoAP exposure research, and NVD and VulnCheck records for libcoap and Eclipse Californium, read 2026-11-12. No CISA ICS-advisory (ICSA-prefixed) naming CoAP directly was found for 2023-2026; the one CISA-relayed CoAP finding identified (a 2020 Cisco IoT Field Network Director advisory, CVE-2020-3162) predates that window and is cited for historical context. It is general information, not a substitute for an exposure scan of your own deployment or a CVE search against your exact library version.
Put this guide to work
Frequently asked questions
What is CoAP, and does it include security by default?
The Constrained Application Protocol (CoAP) is an IETF standard, RFC 7252, published by the Constrained RESTful Environments (CoRE) Working Group as "a specialized web transfer protocol for use with constrained nodes and constrained (e.g., low-power, lossy) networks." It gives small, battery-powered or low-bandwidth IoT devices a REST-like way to expose GET/PUT/POST/DELETE-style resources, deliberately over UDP rather than TCP to avoid the overhead of a full connection-oriented stack. By default, CoAP runs with no security at all — the spec calls this the NoSec mode. Security is an optional add-on, typically DTLS, that an implementer has to deliberately turn on; nothing in CoAP's base request/response exchange requires it, which is the same "secure by default is not the default" pattern seen across other lightweight IoT protocols.
What security modes does CoAP actually define, and what is OSCORE?
RFC 7252's Section 9 ("Securing CoAP") defines DTLS as CoAP's primary security binding, with four security modes an implementation can choose: NoSec (no security applied at all), PreSharedKey (authentication via symmetric keys shared out of band), RawPublicKey (public-key authentication without a full certificate chain), and Certificate (full X.509 certificate-based authentication, the same model as TLS on the web). The problem DTLS alone doesn't solve is that CoAP deployments commonly route through proxies and protocol translators, and DTLS — like TLS — has to be terminated at each hop, meaning every proxy in the path can read and potentially modify the message. RFC 8613 defines OSCORE (Object Security for Constrained RESTful Environments) to close that gap: it applies end-to-end, object-level encryption and integrity protection to the CoAP request/response payload itself, independent of how many proxies or protocol translations sit in between, using CBOR Object Signing and Encryption (COSE). OSCORE and DTLS are not mutually exclusive — a device can run both, layering end-to-end object security on top of hop-by-hop transport security, or run OSCORE alone where DTLS isn't practical.
How big is CoAP's amplification/DDoS exposure, and how many devices are affected?
Large enough that it has its own name in DDoS research, and two independent measurements land close together. The Shadowserver Foundation's internet-wide IPv4 scan (dated 21 June 2020) found 464,159 exposed CoAP hosts responding to a 21-byte discovery request on UDP port 5683, concentrated in the Philippines, China and Russia (roughly 93% of exposures combined), with an average response size of 569 bytes — "roughly 27 times" the inbound request by Shadowserver's own calculation, against the "around 34" it cites from earlier measurements. NETSCOUT's ASERT research team, publishing in January 2019, independently found 388,344 exposed CoAP devices (81% in China) and calculated a 34x amplification factor from a 21-byte request producing a 720-byte average response, and documented real-world DDoS attacks already using CoAP reflection as of mid-January 2019. Shadowserver has since turned this into a continuing daily "Accessible CoAP Report" distributed to national CSIRTs, meaning the exposure is tracked as an ongoing condition, not a one-time finding. Beyond DDoS amplification, Shadowserver's report also flags that many exposed CoAP services leak information directly — including, in some cases, credentials to other services such as Wi-Fi networks.
What should a device maker or integrator using CoAP check first?
Confirm which security mode is actually configured on every CoAP endpoint — NoSec should not be the deployed configuration for any device reachable from an untrusted network, and the default in many libraries is exactly that unless explicitly changed. If devices are reachable from the public internet at all, firewall UDP/5683 to only the hosts that genuinely need it; CoAP was designed for constrained local and operator networks, not open internet exposure, and Shadowserver's hundreds of thousands of exposed hosts are the direct, measurable cost of skipping that step. Patch the specific CoAP library your firmware uses — libcoap has had multiple CVEs in 2024-2025, including stack-based buffer overflows and NULL-pointer dereferences triggered by crafted DTLS handshakes, and Eclipse Californium's own known-vulnerabilities list, as of 2026-11-19, ends with CVE-2022-39368, a 2022 DTLS-handshake denial-of-service bug, with later entries only for its dependencies; none of these are fixed by configuring DTLS correctly, since they are implementation bugs in the library parsing CoAP messages, not gaps in the protocol's security design. If the deployment uses OMA LwM2M for device management (which commonly carries CoAP as its transport), check which of LwM2M's own security modes is configured, since LwM2M inherits CoAP's NoSec/PreSharedKey/RawPublicKey/Certificate options directly and newer LwM2M versions add OSCORE as an additional, separately-configured layer.
Sources
- IETF RFC 7252: The Constrained Application Protocol (CoAP) — Constrained RESTful Environments (CoRE) Working Group
- IETF RFC 8613: Object Security for Constrained RESTful Environments (OSCORE)
- Shadowserver Foundation: Accessible CoAP Report — scanning for exposed Constrained Application Protocol services
- NETSCOUT ASERT: "CoAP Attacks in the Wild" (31 January 2019)
- VulnCheck: CVE-2025-34468 — libcoap stack-based buffer overflow in address resolution
- Cisco Security Advisory cisco-sa-iot-coap-dos-WTBu6YTq: IoT Field Network Director CoAP DoS (CVE-2020-3162)
- IETF RFC 9528: Ephemeral Diffie-Hellman Over COSE (EDHOC), March 2024
- IETF RFC 9668: Using EDHOC with CoAP and OSCORE, November 2024
- IETF RFC 9175: CoAP Echo, Request-Tag, and Token Processing, February 2022
- OMA LightweightM2M 1.1.1 Transport Bindings technical specification (security modes, OSCORE)
- NVD: CVE-2021-34433 (Eclipse Californium DTLS server signature not verified)
- NVD: CVE-2022-39368 (Eclipse Californium DTLS throttling counters)
- NVD: CVE-2025-65496 (libcoap OpenSSL DTLS cookie NULL dereference)
- libcoap ChangeLog (GitHub)
- Debian security tracker: CVE-2024-0962 (libcoap)
- Eclipse Californium security policy: known vulnerabilities
About this guide
SoftWSP Firmware Security Desk
Covers the Firmware vulnerabilities & fixes cluster: 131 guides.

In this cluster
Questions about this page?
