CVE-2020-7660: Serialize javascript Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-hxcc-f52p-wc94
CVSS 8.1
CWE-502
Published
Advisory Summary

CVE-2020-7660 is a HIGH (CVSS 8.1) remote code execution vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Serialize javascript libraries in the npm ecosystem. The issue involves insecure serialization leading to rce in serialize-javascript. Remediation is available by upgrading affected packages to version 3.1.0.

CVE-2020-7660 at a Glance

CVE Identifier CVE-2020-7660
GHSA Identifier GHSA-hxcc-f52p-wc94
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Serialize javascript
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2020-7660

To remediate this vulnerability, upgrade all affected Serialize javascript dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

serialize-javascript fixed: 3.1.0
npm install serialize-javascript@3.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls serialize-javascript

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2020-7660, inspect your project dependencies using npm:

npm ls serialize-javascript

Analyze the terminal output to locate any version of Serialize javascript in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.0), your application is affected.

Note: The npm ls serialize-javascript command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Serialize javascript, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

serialize-javascript prior to 3.1.0 allows remote attackers to inject arbitrary code via the function "deleteFunctions" within "index.js". An object such as `{"foo": /1"/, "bar": "a\"@__R-<UID>-0__@"}` was serialized as `{"foo": /1"/, "bar": "a\/1"/}`, which allows an attacker to escape the `bar` key. This requires the attacker to control the values of both `foo` and `bar` and guess the value of `<UID>`. The UID has a keyspace of approximately 4 billion making it a realistic network attack.

CVE-2020-7660 Affected Serialize javascript Versions

1 component(s)
Fixed Versions:
3.1.0
Product / Package Ecosystem Affected Versions Fixed Version
serialize-javascript
npm
< 3.1.0
3.1.0

References

Frequently Asked Questions

What is CVE-2020-7660?
CVE-2020-7660 is a security vulnerability in Serialize javascript involving Insecure serialization leading to RCE in serialize-javascript under CWE-502: Deserialization of Untrusted Data.
Which Serialize javascript versions are affected?
Affected versions include releases prior to 3.1.0 across affected packages: serialize-javascript.
What version fixes CVE-2020-7660?
Upgrading to 3.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is serialize-javascript affected?
Yes, serialize-javascript is affected in releases prior to 3.1.0. Upgrade your dependency to 3.1.0 or later.
What is the CVSS score of CVE-2020-7660?
CVE-2020-7660 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2020-7660?
CVE-2020-7660 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check npm dependencies for CVE-2020-7660?
Run the dependency tree command: 'npm ls serialize-javascript'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hxcc-f52p-wc94",
  "modified" : "2021-09-23T18:50:59Z",
  "published" : "2020-08-11T17:21:13Z",
  "aliases" : [ "CVE-2020-7660" ],
  "summary" : "Insecure serialization leading to RCE in serialize-javascript",
  "details" : "serialize-javascript prior to 3.1.0 allows remote attackers to inject arbitrary code via the function \"deleteFunctions\" within \"index.js\". \n\nAn object such as `{\"foo\": /1\"/, \"bar\": \"a\\\"@__R-<UID>-0__@\"}` was serialized as `{\"foo\": /1\"/, \"bar\": \"a\\/1\"/}`, which allows an attacker to escape the `bar` key. This requires the attacker to control the values of both `foo` and `bar` and guess the value of `<UID>`. The UID has a keyspace of approximately 4 billion making it a realistic network attack.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "serialize-javascript"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7660"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yahoo/serialize-javascript/commit/f21a6fb3ace2353413761e79717b2d210ba6ccbd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/yahoo/serialize-javascript"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-11T14:14:51Z",
    "nvd_published_at" : null
  }
}