CVE-2020-28481: Insecure Defaults due to CORS Misconfiguration in socket.io

socket.io Updated 02 Oct 2025

Summary

20/01/2021
Yes i
Moderate
4.3

CVE-2020-28481: CORS misconfiguration in socket.io. Affects socket.io versions < 2.4.0. Fixed in 2.4.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Socket.io is a popular JavaScript library that enables real-time, bidirectional communication between web clients and servers. It provides a simple and reliable way to build scalable and efficient applications. However, versions before 2.4.0 are vulnerable to an Insecure Defaults issue due to CORS misconfiguration. By default, all domains are whitelisted, which can lead to potential security risks.

Vulnerability Detail

The vulnerability arises from the insecure default configuration of Cross-Origin Resource Sharing (CORS) in socket.io. CORS is a security mechanism that restricts cross-origin requests in web browsers. In socket.io versions prior to 2.4.0, all domains are whitelisted by default, allowing any website to make cross-origin requests to the socket.io server. This can lead to various security issues, such as unauthorized access to sensitive data or the execution of malicious actions on behalf of authenticated users.

How To Fix

Minimum fixed version

2.4.0

This is the first release that contains the fix.

npm install socket.io@2.4.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version is not feasible, a temporary workaround is to manually configure the CORS settings to restrict access to trusted domains only. This can be done by modifying the server-side code that initializes the socket.io server. Below is an example of how to configure CORS to allow requests only from 'example.com':

const io = require('socket.io')();

io.origins('https://example.com');

// Rest of the socket.io server initialization code

Conclusion

Insecure Defaults due to CORS Misconfiguration in socket.io (CVE-2020-28481) can pose significant security risks to applications using vulnerable versions of socket.io. It is crucial to upgrade to version 2.4.0 or later to mitigate this vulnerability. Administrators should also review and adjust the CORS configuration based on their specific requirements and security policies. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for socket.io →

Share this vulnerability

FAQ

Socket.io is a JavaScript library that enables real-time, bidirectional communication between web clients and servers. It simplifies the development of applications that require real-time updates and interactive features.

Cross-Origin Resource Sharing (CORS) is a security mechanism that restricts cross-origin requests in web browsers. It allows servers to specify which origins are allowed to access their resources.

The insecure default CORS configuration in socket.io can lead to unauthorized access to sensitive data, cross-site scripting (XSS) attacks, and the execution of malicious actions on behalf of authenticated users.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just the package-lock.json file.

You can refer to the official socket.io documentation and security guidelines for more information on how to secure your socket.io applications.

Related vulnerabilities

Recent vulnerabilities recorded for socket.io.

How To Fix

Minimum fixed version

2.4.0

This is the first release that contains the fix.

npm install socket.io@2.4.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback