CVE-2016-10518: Ws Remote Memory Disclosure Vulnerability

LOW
Advisory Identifier: GHSA-2mhh-w6q8-5hxw
CWE-201
Published
Advisory Summary

CVE-2016-10518 is a LOW remote memory disclosure vulnerability (CWE-201: Insertion of Sensitive Information Into Sent Data) affecting Ws libraries in the npm ecosystem. The issue involves remote memory disclosure in ws. Remediation is available by upgrading affected packages to version 1.0.1.

CVE-2016-10518 at a Glance

CVE Identifier CVE-2016-10518
GHSA Identifier GHSA-2mhh-w6q8-5hxw
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-201: Insertion of Sensitive Information Into Sent Data
Affected Product Ws
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2016-10518

To remediate this vulnerability, upgrade all affected Ws dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ws fixed: 1.0.1
npm install ws@1.0.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls ws

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2016-10518, inspect your project dependencies using npm:

npm ls ws

Analyze the terminal output to locate any version of Ws in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.1), your application is affected.

Note: The npm ls ws command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-201: Insertion of Sensitive Information Into Sent Data, where the code transmits data to another actor, but a portion of the data includes sensitive information that should not be accessible to that actor. In Ws, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2016-10518 Affected Ws Versions

1 component(s)
Fixed Versions:
1.0.1
Product / Package Ecosystem Affected Versions Fixed Version
ws
npm
< 1.0.1
1.0.1

References

Frequently Asked Questions

What is CVE-2016-10518?
CVE-2016-10518 is a security vulnerability in Ws involving Remote Memory Disclosure in ws under CWE-201: Insertion of Sensitive Information Into Sent Data.
Which Ws versions are affected?
Affected versions include releases prior to 1.0.1 across affected packages: ws.
What version fixes CVE-2016-10518?
Upgrading to 1.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ws affected?
Yes, ws is affected in releases prior to 1.0.1. Upgrade your dependency to 1.0.1 or later.
What CWE is associated with CVE-2016-10518?
CVE-2016-10518 is classified under 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 can I check npm dependencies for CVE-2016-10518?
Run the dependency tree command: 'npm ls ws'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2mhh-w6q8-5hxw",
  "modified" : "2020-08-31T18:09:55Z",
  "published" : "2019-02-18T23:56:42Z",
  "aliases" : [ "CVE-2016-10518" ],
  "summary" : "Remote Memory Disclosure in ws",
  "details" : "Versions of `ws` prior to 1.0.1 are affected by a remote memory disclosure vulnerability.\n\nIn 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.\n\n\n\n## Proof of Concept\n```\nvar ws = require('ws')\n\nvar server = new ws.Server({ port: 9000 })\nvar client = new ws('ws://localhost:9000')\n\nclient.on('open', function () {\n  console.log('open')\n  client.ping(50) // this sends a non-zeroed buffer of 50 bytes\n\n  client.on('pong', function (data) {\n    console.log('got pong')\n    console.log(data) // Data from the client. \n  })\n})\n```\n\n\n## Recommendation\n\nUpdate to version 1.0.1 or greater.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ws"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-10518"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/commit/29293ed11b679e0366fa0f6bb9310b330dafd795"
  }, {
    "type" : "WEB",
    "url" : "https://gist.github.com/c0nrad/e92005446c480707a74a"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-2mhh-w6q8-5hxw"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/releases/tag/1.0.1"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/67"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-201" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T20:52:34Z",
    "nvd_published_at" : null
  }
}