CVE-2020-7660: serialize-javascript insecure serialization RCE

CVE-2020-7660 · Severity: low · CVSS 3.1 · Published 2020-08-11

serialize-javascript is a Node.js library used to serialize JavaScript objects for transmission or storage. A flaw in how it handles regex and function placeholders allows an attacker who can control object properties to inject arbitrary code, leading to remote code execution. An attacker must guess a 4-billion-value identifier space, making this a realistic network-based attack.

Technologies: serialize-javascript (npm). Vendors: npm.

Quick answers

Is CVE-2020-7660 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2020-7660 being exploited in the wild.
How severe is CVE-2020-7660?
Low severity, with a CVSS score of 3.1, published 11 August 2020.
Which products and versions are affected?
serialize-javascript (npm) SEMVER:introduced=0,fixed=3.1.0.
Is there a fix for CVE-2020-7660?
Yes. serialize-javascript (npm): upgrade to 3.1.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2020-7660 attacked?
It is attacked over the network.
Am I affected by CVE-2020-7660?
Check whether you run serialize-javascript (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • serialize-javascript (npm): upgrade to 3.1.0 or later
    npm install serialize-javascript@3.1.0

Technical details

The vulnerability is an insecure serialization issue in serialize-javascript prior to version 3.1.0, classified as CWE-502. The root cause is in the "deleteFunctions" function within index.js, which fails to properly escape regex and function placeholders within string literals. An attacker can craft a malicious object (e.g., {"foo": /1"/, "bar": "a\"@__R-<UID>-0__@"}) such that the serialization output breaks out of the intended string context, allowing arbitrary code injection. The attack requires the attacker to control both object property values and guess a UID with ~4 billion possible values, making it feasible in network scenarios. The attack vector is network-based with no authentication or user interaction required. The vulnerability is fixed in version 3.1.0 via commit f21a6fb, which prevents regex and function placeholder replacement within string literals.

Affected products

  • Yahoo serialize-javascript prior to 3.1.0

Identifiers

  • CVE-2020-7660
  • GHSA-hxcc-f52p-wc94

Timeline

  • 2020-08-11: disclosed
  • 2020-08-11: patched: Fixed in version 3.1.0

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.