CVE-2019-16772 regular expressions Cross-Site Scripting (XSS) vulnerability in serialize-to-js
An attacker can inject malicious scripts via serialized regular expressions in serialize-to-js when used in non-Node.js environments.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2019-16772?
CVE-2019-16772 is a low-severity cross-site scripting vulnerability in commenthol serialize-to-js, published on 6 Dec 2019. Any signed-in user can exploit it over the network, with no action from the victim.
Official 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.
Weakness: CWE-79
Which versions are affected by CVE-2019-16772?
2 open source packages ship an affected version, including serialize-to-js. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
serialize-to-js npm | All versions | 3.0.1 |
serialize-to-js npm | All versions | 3.0.1 |
Products include Serialize-to-Js Project Serialize-to-Js.
How do I fix CVE-2019-16772?
Upgrade serialize-to-js to 3.0.1 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2019-16772 being exploited?
There is no known exploitation of CVE-2019-16772 in the wild and no public exploit code.
Other vulnerabilities in commenthol serialize-to-js
Sources
Also known as GHSA-3fjq-93xj-3f3f.