diff --git a/packages/binding-coap/src/coap-server.ts b/packages/binding-coap/src/coap-server.ts index af9529edf..474538737 100644 --- a/packages/binding-coap/src/coap-server.ts +++ b/packages/binding-coap/src/coap-server.ts @@ -435,6 +435,14 @@ export default class CoapServer implements ProtocolServer { } private async handleRequest(req: IncomingMessage, res: OutgoingMessage) { + const sourcePort = req.rsinfo.port; + const hasInvalidPortRange = sourcePort < 1 || sourcePort > 65535; + if (hasInvalidPortRange) { + // Ignore requests with an invalid source port + // See https://github.com/eclipse-thingweb/node-wot/issues/1182 + return; + } + const origin = this.formatRequestOrigin(req); debug(