CVE-2020-28481: Socket.io CORS Misconfiguration Vulnerability

MODERATE
Advisory Identifier: GHSA-fxwf-4rqh-v8g3
CVSS 4.3
CWE-453 CWE-346
Published
Advisory Summary

CVE-2020-28481 is a MODERATE (CVSS 4.3) cors misconfiguration vulnerability (CWE-453: Insecure Default Variable Initialization) affecting Socket.io libraries in the npm ecosystem. The issue involves cors misconfiguration in socket.io. Remediation is available by upgrading affected packages to version 2.4.0.

CVE-2020-28481 at a Glance

CVE Identifier CVE-2020-28481
GHSA Identifier GHSA-fxwf-4rqh-v8g3
Severity MODERATE
CVSS v3.1 Base Score 4.3
CWE Classification CWE-453: Insecure Default Variable Initialization
Affected Product Socket.io
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.3

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

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

How to Fix CVE-2020-28481

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

socket.io fixed: 2.4.0
npm install socket.io@2.4.0
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 socket.io

How to Check if You Are Affected

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

npm ls socket.io

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

Note: The npm ls socket.io 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-453: Insecure Default Variable Initialization, where the product, by default, initializes an internal variable with an insecure or less secure value than is possible. In Socket.io, 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

The package socket.io before 2.4.0 are vulnerable to Insecure Defaults due to CORS Misconfiguration. All domains are whitelisted by default.

CVE-2020-28481 Affected Socket.io Versions

1 component(s)
Fixed Versions:
2.4.0
Product / Package Ecosystem Affected Versions Fixed Version
socket.io
npm
< 2.4.0
2.4.0

References

Frequently Asked Questions

What is CVE-2020-28481?
CVE-2020-28481 is a security vulnerability in Socket.io involving CORS misconfiguration in socket.io under CWE-453: Insecure Default Variable Initialization.
Which Socket.io versions are affected?
Affected versions include releases prior to 2.4.0 across affected packages: socket.io.
What version fixes CVE-2020-28481?
Upgrading to 2.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is socket.io affected?
Yes, socket.io is affected in releases prior to 2.4.0. Upgrade your dependency to 2.4.0 or later.
What is the CVSS score of CVE-2020-28481?
CVE-2020-28481 has a CVSS v3.1 base score of 4.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2020-28481?
CVE-2020-28481 is classified under CWE-453: Insecure Default Variable Initialization (The product, by default, initializes an internal variable with an insecure or less secure value than is possible.).
How can I check npm dependencies for CVE-2020-28481?
Run the dependency tree command: 'npm ls socket.io'. 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-fxwf-4rqh-v8g3",
  "modified" : "2023-09-11T22:46:42Z",
  "published" : "2021-01-20T21:22:37Z",
  "aliases" : [ "CVE-2020-28481" ],
  "summary" : "CORS misconfiguration in socket.io",
  "details" : "The package socket.io before 2.4.0 are vulnerable to Insecure Defaults due to CORS Misconfiguration. All domains are whitelisted by default.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "socket.io"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.4.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-28481"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/socketio/socket.io/issues/3671"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/socketio/socket.io/commit/f78a575f66ab693c3ea96ea88429ddb1a44c86c7"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWER-1056358"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1056357"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-SOCKETIO-1024859"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-346", "CWE-453" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-01-20T05:39:24Z",
    "nvd_published_at" : "2021-01-19T15:15:00Z"
  }
}