← Back to the chapter · Previous detail

Technical detail · CoAP Security: Protection and Application Fit

CoAP correlation, retry congestion and public exposure

18.11 Common Implementation Pitfalls

A protected Constrained Application Protocol (CoAP) path alone cannot fix three failures: a reply assigned to the wrong resource, retries that worsen congestion, and a publicly exposed server used against someone else.

A notification is a resource-update message; a peer is the remote endpoint, and a security context contains protection keys and associated state. A Token matches a response or notification to its request within the peer context. If the client watches both /temperature and /humidity, it must keep their streams distinct even when they arrive on the same UDP socket, the transport endpoint receiving datagrams. Include the peer and security context in correlation, avoid collisions among active exchanges to that peer, and remove cancelled observations, the registrations for continuing resource updates.

Retries also need discipline. Rapid fixed-interval retransmissions can multiply traffic on a lossy link and worsen congestion. Use CoAP’s bounded exponential backoff, and measure retry load. More attempts are not evidence that the application completed its operation.

Public exposure risks other people as well as the flat. A forged source address can direct the server’s larger response at a victim. An exposed unprotected endpoint can become a reflector that amplifies an attack. Restrict exposed resources through a gateway or firewall, require authenticated and authorized access to private data, and consider response-size and rate limits.

  1. A small request with a forged return address causes a larger reply to hit a victim; Bex points to a firewall blocking the path. Public access can endanger others as well as expose device data.

    Wrong: An open device server risks only its own data. Fake return addresses can make it flood someone else.

A forged return address sends the server’s larger reply toward a victim. Restrict public access so the server cannot become a reflector.

A publicly reachable CoAP server needs separate checks for message handling, peer identity, permitted operations and traffic limits.

Consider a dispatch sketch, written as pseudocode rather than executable implementation, that unconditionally sends Reset for an unknown notification. A notification reports a resource update; Reset rejects a message. That unconditional reset is not a general rule for every response or acknowledgement; inspect the message type before responding.

A DTLS cookie exchange requires the client to return a server-supplied value, checking return reachability before costly handshake work. It does not establish client identity or resource permission. Test aggregate limits as well as per-source limits because spoofed addresses can evade a simple per-source policy.

Credentials establish peer identity; authorization grants permission for an operation. Response correlation matches an answer to its request; retransmission sends a message again after missing delivery evidence. Keep credential failure, authorization refusal, response correlation, retransmission, and application outcome as separate diagnostic questions. The answer to one does not settle the others.

← Back to the chapter · Previous detail