CVE-2026-97711: serialize-javascript Cross-Site Scripting (XSS) Vulnerability in Function Serialization

serialize-javascript Updated 30 Sep 2026

Summary

30/09/2026
Yes i
Low
2.3

CVE-2026-97711: Serialize JavaScript: Cross-site scripting (XSS) via unescaped in serialized function bodies. Affects serialize-javascript versions >= 7.1.1, < 7.1.2. Fixed in 7.1.2. 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

serialize-javascript is a popular npm package used to serialize JavaScript objects into a format that can be safely embedded in HTML. It ensures that the serialized output is safe for inclusion within <script> tags. However, a vulnerability was discovered in version 7.1.1 that compromises this safety for function values, allowing potential XSS attacks.

Vulnerability Detail

The vulnerability arises from the way serialize-javascript handles function values. In version 7.1.1, it fails to properly escape certain characters, specifically allowing a crafted function body to include an unescaped </script> tag. This can lead to early termination of the <script> element, causing subsequent HTML to be parsed and executed, which may include malicious scripts. The issue is rooted in the regular expression used to identify script closing tags, which inadequately excludes the '<' character, allowing for exploitation.

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

7.1.2

This is the first release that contains the fix.

npm install serialize-javascript@7.1.2

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

Workaround

If you cannot upgrade to version 7.1.2, consider avoiding the serialization of functions that may contain attacker-influenced source text. Alternatively, you can use version 7.1.0 or earlier, which is unaffected by this issue.

Conclusion

The CVE-2026-97711 vulnerability in serialize-javascript poses a significant risk due to its potential for XSS attacks through improperly serialized function values. Users are strongly advised to upgrade to version 7.1.2 or later to mitigate this risk. For those unable to upgrade, alternative strategies should be employed to avoid serialization of unsafe content.

See every vulnerability recorded for serialize-javascript →

Share this vulnerability

FAQ

The vulnerability allows attackers to inject malicious scripts into web pages, potentially leading to data theft, session hijacking, or other malicious actions.

It occurs due to improper escaping of the </script> tag in serialized function bodies, allowing for XSS attacks.

Versions 7.1.1 is affected. Versions 7.1.2 and later contain the necessary fixes.

If upgrading is not an option, avoid serializing functions with potentially unsafe content or use version 7.1.0 or earlier.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software by analyzing your package-lock.json file.

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

7.1.2

This is the first release that contains the fix.

npm install serialize-javascript@7.1.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