Junglewise Threat Intelligence

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

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

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

Executive brief

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.

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

Timeline

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

References

Related threats