Skip to content

GHSA-2mhh-w6q8-5hxw CVE-2016-10518

Remote Memory Disclosure in ws

Low npm
Severity
Low
The publisher's own rating, not a CVSS score
Exploit chance (EPSS)
1.98%
Chance of exploitation in the next 30 days. Higher than 80.58% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-201 Insertion of Sensitive Information Into Sent Data
Fix
1.0.1
Upgrade ws to this version or later

Description

Versions of ws prior to 1.0.1 are affected by a remote memory disclosure vulnerability.

In certain rare circumstances, applications which allow users to control the arguments of a client.ping() call will cause ws to send the contents of an allocated but non-zero-filled buffer to the server. This may disclose sensitive information that still exists in memory after previous use of the memory for other tasks.

Proof of Concept

var ws = require('ws')

var server = new ws.Server({ port: 9000 })
var client = new ws('ws://localhost:9000')

client.on('open', function () {
  console.log('open')
  client.ping(50) // this sends a non-zeroed buffer of 50 bytes

  client.on('pong', function (data) {
    console.log('got pong')
    console.log(data) // Data from the client. 
  })
})

Recommendation

Update to version 1.0.1 or greater.

Affected versions

npm

PackageVulnerableFixed in
ws
< 1.0.1
1.0.1

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

ws npm → 1.0.1

npm
npm install ws@1.0.1
yarn
yarn add ws@1.0.1
pnpm
pnpm add ws@1.0.1

Weakness

CWE-201: Insertion of Sensitive Information Into Sent Data

The code transmits data to another actor, but a portion of the data includes sensitive information that should not be accessible to that actor.

How to prevent it
  • Requirements: Specify which data in the software should be regarded as sensitive. Consider which types of users should have access to which types of data.
  • Implementation: Ensure that any possibly sensitive data specified in the requirements is verified with designers to ensure that it is either a calculated risk or mitigated elsewhere. Any information that is not necessary to the functionality should be removed in order to lower both the overhead and the possibility of security sensitive data being sent.
  • System Configuration: Setup default error messages so that unexpected errors do not disclose sensitive information.
  • Architecture and Design: Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-96hv-2xvq-fx4p
ws: Memory exhaustion DoS from tiny fragments and data chunks
High Also affects ws
GHSA-58qx-3vcg-4xpx
ws: Uninitialized memory disclosure
High Also affects ws
GHSA-3h5v-q93c-6h6q
ws affected by a DoS when handling a request with many HTTP headers
High Also affects ws
GHSA-6fc8-4gx4-v693
ReDoS in Sec-Websocket-Protocol header
Medium Also affects ws
GHSA-5v72-xg48-5rpm
Denial of Service in ws
High Also affects ws
GHSA-6663-c963-2gqg
DoS due to excessively large websocket message in ws
High Also affects ws
GHSA-wxxw-5cvc-53j7
Microsoft Security Advisory CVE-2026-66822 - .NET and Visual Studio Information Disclosure Vulnerability
Medium Same weakness, CWE-201
GHSA-g2v8-7jhw-pp8p
Backstage: Sensitive information exposure in Scaffolder
Critical Same weakness, CWE-201
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor