CVE-2024-11831: Critical XSS Vulnerability in serialize-javascript Package

serialize-javascript Updated 02 Oct 2025

Summary

10/02/2025
Yes i
Moderate
5.4

CVE-2024-11831: Cross-site Scripting (XSS) in serialize-javascript. Affects serialize-javascript versions >= 6.0.0, < 6.0.2. Fixed in 6.0.2. How to fix ↓

Also tracked for

The same CVE-2024-11831 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The serialize-javascript package is a popular npm module used for serializing JavaScript objects into a format that can be safely transmitted over a network. It is widely utilized in web applications to handle data serialization. However, it has been found to have a critical vulnerability that allows for Cross-site Scripting (XSS) attacks due to improper input sanitization.

Vulnerability Detail

A flaw exists in the serialize-javascript module where it fails to adequately sanitize certain inputs, such as regular expressions or specific JavaScript object types. This oversight allows attackers to inject malicious code into serialized data. When this data is deserialized by a web browser, it can execute the injected code, leading to potential XSS attacks. Such vulnerabilities are particularly dangerous in environments where serialized data is sent to web clients, as they can compromise the security of websites and web applications that utilize this package.

How To Fix

Latest published version: 7.1.3 as of 22 Oct 2026

npm install serialize-javascript@7.1.3

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

If you need the minimum change

6.0.2

This is the first release that contains the fix.

npm install serialize-javascript@6.0.2

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

Workaround

If immediate updating is not feasible, consider sanitizing inputs before passing them to the serialize-javascript function. This can be done by implementing a custom sanitization function to filter out potentially harmful characters or patterns.

Conclusion

The serialize-javascript package has a critical vulnerability that can lead to XSS attacks due to improper input sanitization. It is essential to update to the patched version 6.0.2 or later to mitigate this risk. Implementing input sanitization can serve as a temporary workaround while updates are being applied.

See every vulnerability recorded for serialize-javascript →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 5.4, indicating a moderate severity level.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The potential impacts include unauthorized access to sensitive data, session hijacking, and the ability to execute arbitrary scripts in the context of the user's browser.

Yes, you can implement input sanitization to filter out harmful inputs before serialization as a temporary measure.

More information can be found in the official advisory on GitHub or by searching for CVE-2024-11831.

Related vulnerabilities

Recent vulnerabilities recorded for serialize-javascript.

How To Fix

Latest published version: 7.1.3 as of 22 Oct 2026

npm install serialize-javascript@7.1.3

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

If you need the minimum change

6.0.2

This is the first release that contains the fix.

npm install serialize-javascript@6.0.2

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