CVE-2020-8823: Cross-site scripting in SocksJS-node

sockjs Updated 02 Oct 2025

Summary

13/04/2021
Yes i
Moderate
6.1

CVE-2020-8823: Cross-site scripting in SocksJS-node. Affects sockjs versions < 0.3.0. Fixed in 0.3.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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

SockJS is an open-source JavaScript library that provides a WebSocket-like object in the browser. It allows browsers to communicate with servers using a variety of transport mechanisms, including WebSocket, HTTP streaming, and HTTP long-polling. SockJS-node is the server-side component of SockJS, written in Node.js. It enables server-side implementation of SockJS protocols. The vulnerability identified as CVE-2020-8823 affects SockJS-node versions prior to 0.3.0.

Vulnerability Detail

The vulnerability in SockJS-node is a cross-site scripting (XSS) vulnerability that exists in the 'htmlfile' module of the 'lib/transport/htmlfile.js' file. It is caused by a lack of proper input sanitization in the 'callback' parameter of the '/htmlfile' endpoint. An attacker can exploit this vulnerability by injecting malicious JavaScript code into the 'callback' parameter, which will be executed in the context of the victim's browser when the response is rendered. This can lead to various attacks, such as session hijacking, defacement, or stealing sensitive information.

How To Fix

Latest published version: 0.3.24 as of 23 Oct 2026

npm install sockjs@0.3.24

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.3.0

This is the first release that contains the fix.

npm install sockjs@0.3.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 immediately feasible, a temporary workaround is to manually sanitize the 'callback' parameter input before processing it. This can be done by implementing input validation and filtering techniques, such as HTML entity encoding or using a dedicated XSS protection library.

Conclusion

The vulnerability in SockJS-node versions prior to 0.3.0 allows for cross-site scripting (XSS) attacks, which can have serious security implications. It is crucial to upgrade to the latest version or apply the provided workaround to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for sockjs →

Share this vulnerability

FAQ

SockJS is a JavaScript library that enables browsers to establish a WebSocket-like connection with servers using various transport mechanisms.

SockJS-node is the server-side component of SockJS, written in Node.js. It allows server-side implementation of SockJS protocols.

Cross-site scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users.

The vulnerability can be exploited by attackers to execute arbitrary JavaScript code in the context of a victim's browser, leading to various attacks such as session hijacking, defacement, or data theft.

To mitigate the risk, it is recommended to upgrade to SockJS-node version 0.3.0 or later. If immediate upgrade is not possible, manually sanitize the 'callback' parameter input before processing it.

Related vulnerabilities

Recent vulnerabilities recorded for sockjs.

How To Fix

Latest published version: 0.3.24 as of 23 Oct 2026

npm install sockjs@0.3.24

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.3.0

This is the first release that contains the fix.

npm install sockjs@0.3.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