Critical WebSocket Payload Length Vulnerability in node-ws Package

node-ws Updated 02 Oct 2025

Summary

31/05/2018
N/A
Yes i
High
7.5

CVE-2016-10542: ws is a "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455". Affects node-ws across 2 version ranges.

< 1.1.0+ds1.e6ddaae4-5 < 4263f26d4dbe27e781c41a1ddfe3dab87dd9e1dc

Fixed in 1.1.0+ds1.e6ddaae4-5. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The node-ws package is a widely used WebSocket client and server for Node.js, designed for high performance and compliance with RFC-6455. It allows real-time communication between clients and servers, making it essential for applications requiring instant data exchange. However, versions 1.1.0 and earlier are susceptible to a vulnerability that can crash the Node.js process when an overly long WebSocket payload is sent to the server.

Vulnerability Detail

The vulnerability, identified as CVE-2016-10542, arises from the handling of WebSocket payloads in the node-ws package. By sending a payload that exceeds the expected length, an attacker can cause the Node.js process to crash. This can lead to denial of service, affecting the availability of applications relying on the node-ws package. The issue affects all versions of node-ws up to and including 1.1.0, making it critical for users to upgrade to a patched version to mitigate the risk.

How To Fix

Minimum fixed version

1.1.0+ds1.e6ddaae4-5

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-ws

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading is not immediately possible, consider implementing input validation on the server side to limit the size of incoming WebSocket payloads. This can help prevent overly long payloads from being processed. For example, you can check the length of the payload before processing it:

const WebSocket = require('ws');
const server = new WebSocket.Server({ port: 8080 });

server.on('connection', (ws) => {
  ws.on('message', (message) => {
    if (message.length > MAX_PAYLOAD_LENGTH) {
      console.error('Payload too long');
  return;
    }
    // Process the message
  });
});

Conclusion

The CVE-2016-10542 vulnerability in the node-ws package poses a significant risk to applications using versions 1.1.0 and earlier. Users are strongly advised to upgrade to a patched version to ensure the security and availability of their applications. Implementing input validation can serve as a temporary measure while preparing for the upgrade.

See every vulnerability recorded for node-ws →

Share this vulnerability

FAQ

CVE-2016-10542 is a vulnerability in the node-ws package that allows an attacker to crash the Node.js process by sending an overly long WebSocket payload.

All versions of node-ws up to and including 1.1.0 are affected by this vulnerability.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Exploiting this vulnerability can lead to a denial of service, causing the application to become unavailable to users.

Yes, implementing input validation to limit the size of incoming WebSocket payloads can serve as a temporary workaround.

Related vulnerabilities

Recent vulnerabilities recorded for node-ws.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

1.1.0+ds1.e6ddaae4-5

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-ws

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback