Vulnerabilities in pkg:npm/websocket-extensions

PACKAGE
Advisory Identifier: GHSA-g78m-2chm-r7qv
Advisory Summary

CVE-2020-7662 is a HIGH (CVSS 8.2) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Websocket extensions libraries in the npm ecosystem. The issue involves regular expression denial of service in websocket-extensions (npm package). Remediation is available by upgrading affected packages to version 0.1.4.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/websocket-extensions

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/websocket-extensions. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-g78m-2chm-r7qv CVE-2020-7662 HIGH Regular Expression Denial of Service in websocket-extensions (NPM package)

CVE-2020-7662 at a Glance

CVE Identifier CVE-2020-7662
GHSA Identifier GHSA-g78m-2chm-r7qv
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Websocket extensions
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability High (A:H)

How to Fix CVE-2020-7662

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

websocket-extensions fixed: 0.1.4
npm install websocket-extensions@0.1.4
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 websocket-extensions

How to Check if You Are Affected

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

npm ls websocket-extensions

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

Note: The npm ls websocket-extensions 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Websocket extensions, 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

### Impact The ReDoS flaw allows an attacker to exhaust the server's capacity to process incoming requests by sending a WebSocket handshake request containing a header of the following form: Sec-WebSocket-Extensions: a; b="\c\c\c\c\c\c\c\c\c\c ... That is, a header containing an unclosed string parameter value whose content is a repeating two-byte sequence of a backslash and some other character. The parser takes exponential time to reject this header as invalid, and this will block the processing of any other work on the same thread. Thus if you are running a single-threaded server, such a request can render your service completely unavailable. ### Patches Users should upgrade to version 0.1.4. ### Workarounds There are no known work-arounds other than disabling any public-facing WebSocket functionality you are operating. ### References - https://blog.jcoglan.com/2020/06/02/redos-vulnerability-in-websocket-extensions/

CVE-2020-7662 Affected Websocket extensions Versions

1 component(s)
Fixed Versions:
0.1.4
Product / Package Ecosystem Affected Versions Fixed Version
websocket-extensions
npm
< 0.1.4
0.1.4

References

Frequently Asked Questions

What is CVE-2020-7662?
CVE-2020-7662 is a security vulnerability in Websocket extensions involving Regular Expression Denial of Service in websocket-extensions (NPM package) under CWE-400: Uncontrolled Resource Consumption.
Which Websocket extensions versions are affected?
Affected versions include releases prior to 0.1.4 across affected packages: websocket-extensions.
What version fixes CVE-2020-7662?
Upgrading to 0.1.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is websocket-extensions affected?
Yes, websocket-extensions is affected in releases prior to 0.1.4. Upgrade your dependency to 0.1.4 or later.
What is the CVSS score of CVE-2020-7662?
CVE-2020-7662 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H.
What CWE is associated with CVE-2020-7662?
CVE-2020-7662 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2020-7662?
Run the dependency tree command: 'npm ls websocket-extensions'. 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-g78m-2chm-r7qv",
  "modified" : "2021-08-25T21:51:05Z",
  "published" : "2020-06-05T16:16:12Z",
  "aliases" : [ "CVE-2020-7662" ],
  "summary" : "Regular Expression Denial of Service in websocket-extensions (NPM package)",
  "details" : "### Impact\n\nThe ReDoS flaw allows an attacker to exhaust the server's capacity to process\nincoming requests by sending a WebSocket handshake request containing a header\nof the following form:\n\n    Sec-WebSocket-Extensions: a; b=\"\\c\\c\\c\\c\\c\\c\\c\\c\\c\\c ...\n\nThat is, a header containing an unclosed string parameter value whose content is\na repeating two-byte sequence of a backslash and some other character. The\nparser takes exponential time to reject this header as invalid, and this will\nblock the processing of any other work on the same thread. Thus if you are\nrunning a single-threaded server, such a request can render your service\ncompletely unavailable.\n\n### Patches\n\nUsers should upgrade to version 0.1.4.\n\n### Workarounds\n\nThere are no known work-arounds other than disabling any public-facing\nWebSocket functionality you are operating.\n\n### References\n\n- https://blog.jcoglan.com/2020/06/02/redos-vulnerability-in-websocket-extensions/",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "websocket-extensions"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/faye/websocket-extensions-node/security/advisories/GHSA-g78m-2chm-r7qv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7662"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/faye/websocket-extensions-node/commit/29496f6838bfadfe5a2f85dff33ed0ba33873237"
  }, {
    "type" : "WEB",
    "url" : "https://blog.jcoglan.com/2020/06/02/redos-vulnerability-in-websocket-extensions"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/faye/websocket-extensions-node"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-WEBSOCKETEXTENSIONS-570623"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-03T23:10:26Z",
    "nvd_published_at" : null
  }
}