CVE-2020-7693: Sockjs Improper Input Validation Vulnerability

MODERATE
Advisory Identifier: GHSA-c9g6-9335-x697
CVSS 5.3
CWE-20
Published
Advisory Summary

CVE-2020-7693 is a MODERATE (CVSS 5.3) improper input validation vulnerability (CWE-20: Improper Input Validation) affecting Sockjs libraries in the npm ecosystem. The issue involves improper input validation in socksjs-node. Remediation is available by upgrading affected packages to version 0.3.20.

CVE-2020-7693 at a Glance

CVE Identifier CVE-2020-7693
GHSA Identifier GHSA-c9g6-9335-x697
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-20: Improper Input Validation
Affected Product Sockjs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

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:N/A:L).

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 None (I:N)
Availability Low (A:L)

How to Fix CVE-2020-7693

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

sockjs fixed: 0.3.20
npm install sockjs@0.3.20
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 sockjs

How to Check if You Are Affected

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

npm ls sockjs

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

Note: The npm ls sockjs 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Sockjs, 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

Incorrect handling of Upgrade header with the value websocket leads in crashing of containers hosting sockjs apps. This affects the package sockjs before 0.3.20.

CVE-2020-7693 Affected Sockjs Versions

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

References

Frequently Asked Questions

What is CVE-2020-7693?
CVE-2020-7693 is a security vulnerability in Sockjs involving Improper Input Validation in SocksJS-Node under CWE-20: Improper Input Validation.
Which Sockjs versions are affected?
Affected versions include releases prior to 0.3.20 across affected packages: sockjs.
What version fixes CVE-2020-7693?
Upgrading to 0.3.20 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sockjs affected?
Yes, sockjs is affected in releases prior to 0.3.20. Upgrade your dependency to 0.3.20 or later.
What is the CVSS score of CVE-2020-7693?
CVE-2020-7693 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2020-7693?
CVE-2020-7693 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2020-7693?
Run the dependency tree command: 'npm ls sockjs'. 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-c9g6-9335-x697",
  "modified" : "2021-04-06T21:47:25Z",
  "published" : "2021-04-13T15:27:51Z",
  "aliases" : [ "CVE-2020-7693" ],
  "summary" : "Improper Input Validation in SocksJS-Node",
  "details" : "Incorrect handling of Upgrade header with the value websocket leads in crashing of containers hosting sockjs apps. This affects the package sockjs before 0.3.20.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "sockjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.3.20"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7693"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sockjs/sockjs-node/issues/252"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sockjs/sockjs-node/pull/265"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sockjs/sockjs-node/commit/dd7e642cd69ee74385825816d30642c43e051d16"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/andsnw/sockjs-dos-py"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-575448"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-SOCKJS-575261"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/sockjs"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-06T21:47:25Z",
    "nvd_published_at" : "2020-07-09T14:15:00Z"
  }
}