CVE-2020-7712: Json Trentm/json Vulnerable To Command Injection Vulnerability

HIGH
Advisory Identifier: GHSA-3c6g-pvg8-gqw2
CVSS 7.2
CWE-78
Published
Advisory Summary

CVE-2020-7712 is a HIGH (CVSS 7.2) trentm/json vulnerable to command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Json libraries in the npm ecosystem. The issue involves trentm/json vulnerable to command injection. Remediation is available by upgrading affected packages to version 10.0.0.

CVE-2020-7712 at a Glance

CVE Identifier CVE-2020-7712
GHSA Identifier GHSA-3c6g-pvg8-gqw2
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Json
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.2

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
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-7712

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

json fixed: 10.0.0
npm install json@10.0.0
org.webjars.npm:json fixed: Latest secure release
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>json</artifactId>
    <version>Latest secure release</version>
</dependency>
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 json

How to Check if You Are Affected

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

npm ls json

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

Note: The npm ls json 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Json, 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

This affects the package json before 10.0.0. It is possible to inject arbritary commands using the parseLookup function.

CVE-2020-7712 Affected Json Versions

2 component(s)
Fixed Versions:
10.0.0
Product / Package Ecosystem Affected Versions Fixed Version
json
npm
< 10.0.0
10.0.0
org.webjars.npm:json
Maven
≤ 9.0.6

References

NVD — CVE-2020-7712 NVD
https://nvd.nist.gov/vuln/detail/CVE-2020-7712
Json Source Repository REPOSITORY
https://github.com/trentm/json/issues/144
Json Source Repository REPOSITORY
https://github.com/trentm/json/pull/145
Security Fix Commit FIX COMMIT
https://github.com/trentm/json/commit/cc4798169f9e0f181f8aa61905b88479badcd483
Json Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html
Json Security Information SECURITY
https://www.oracle.com/security-alerts/cpujan2022.html
Json Security Information SECURITY
https://www.oracle.com//security-alerts/cpujul2021.html
snyk.io/vuln/snyk-js-json-5... WEB
https://snyk.io/vuln/SNYK-JS-JSON-597481
snyk.io/vuln/snyk-java-orgw... WEB
https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-608931
lists.apache.org/thread.html/ree3abc... WEB
https://lists.apache.org/thread.html/ree3abcd33c06ee95ab59faa1751198a1186d8941ddc2c2562c12966c@%3Cissues.zookeeper.apache.org%3E
lists.apache.org/thread.html/rec8bb4... WEB
https://lists.apache.org/thread.html/rec8bb4d637b04575da41cfae49118e108e95d43bfac39b7b698ee4db@%3Cissues.zookeeper.apache.org%3E
lists.apache.org/thread.html/rd9b9cc... WEB
https://lists.apache.org/thread.html/rd9b9cc843f5cf5b532bdad9e87a817967efcf52b917e8c43b6df4cc7@%3Cissues.zookeeper.apache.org%3E
lists.apache.org/thread.html/rba7ea4... WEB
https://lists.apache.org/thread.html/rba7ea4d75d6a8e5b935991d960d9b893fd30e576c4d3b531084ebd7d@%3Cissues.flink.apache.org%3E
lists.apache.org/thread.html/rb89bd8... WEB
https://lists.apache.org/thread.html/rb89bd82dffec49f83b49e9ad625b1b63a408b3c7d1a60d6f049142a0@%3Cissues.flink.apache.org%3E
lists.apache.org/thread.html/rb2b981... WEB
https://lists.apache.org/thread.html/rb2b981912446a74e14fe6076c4b7c7d8502727ea0718e6a65a9b1be5@%3Cissues.zookeeper.apache.org%3E
lists.apache.org/thread.html/rb023d5... WEB
https://lists.apache.org/thread.html/rb023d54a46da1ac0d8969097f5fecc79636b07d3b80db7b818a5c55c@%3Cissues.zookeeper.apache.org%3E
lists.apache.org/thread.html/ra890c2... WEB
https://lists.apache.org/thread.html/ra890c24b3d90be36daf48ae76b263acb297003db24c1122f8e4aaef2@%3Cissues.flink.apache.org%3E
lists.apache.org/thread.html/r9c6d28... WEB
https://lists.apache.org/thread.html/r9c6d28e5b9a9b3481b7d1f90f1c2f75cd1a5ade91038426e0fb095da@%3Cdev.flink.apache.org%3E
lists.apache.org/thread.html/r977a90... WEB
https://lists.apache.org/thread.html/r977a907ecbedf87ae5ba47d4c77639efb120f74d4d1b3de14a4ef4da@%3Cissues.flink.apache.org%3E
lists.apache.org/thread.html/r8d2e17... WEB
https://lists.apache.org/thread.html/r8d2e174230f6d26e16c007546e804c343f1f68956f526daaafa4aaae@%3Cdev.zookeeper.apache.org%3E
lists.apache.org/thread.html/r5f17bf... WEB
https://lists.apache.org/thread.html/r5f17bfca1d6e7f4b33ae978725b2fd62a9f1b3111696eafa9add802d@%3Cissues.zookeeper.apache.org%3E
lists.apache.org/thread.html/r3b04f4... WEB
https://lists.apache.org/thread.html/r3b04f4e99a19613f88ae088aa18cd271231a3c79dfff8f5efa8cda61@%3Cissues.zookeeper.apache.org%3E
lists.apache.org/thread.html/r37c0e1... WEB
https://lists.apache.org/thread.html/r37c0e1807da7ff2bdd028bbe296465a6bbb99e2320dbe661d5d8b33b@%3Cissues.zookeeper.apache.org%3E
Json Source Repository REPOSITORY
https://github.com/trentm/json

Frequently Asked Questions

What is CVE-2020-7712?
CVE-2020-7712 is a security vulnerability in Json involving trentm/json vulnerable to command injection under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Json versions are affected?
Affected versions include releases prior to 10.0.0 across affected packages: json, org.webjars.npm:json.
What version fixes CVE-2020-7712?
Upgrading to 10.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is json affected?
Yes, json is affected in releases prior to 10.0.0, Latest secure release. Upgrade your dependency to 10.0.0, Latest secure release or later.
What is the CVSS score of CVE-2020-7712?
CVE-2020-7712 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2020-7712?
CVE-2020-7712 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2020-7712?
Run the dependency tree command: 'npm ls json'. 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-3c6g-pvg8-gqw2",
  "modified" : "2023-09-11T20:29:18Z",
  "published" : "2021-05-06T18:11:21Z",
  "aliases" : [ "CVE-2020-7712" ],
  "summary" : "trentm/json vulnerable to command injection",
  "details" : "This affects the package json before 10.0.0. It is possible to inject arbritary commands using the parseLookup function.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "json"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "10.0.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.webjars.npm:json"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "9.0.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7712"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/trentm/json/issues/144"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/trentm/json/pull/145"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/trentm/json/commit/cc4798169f9e0f181f8aa61905b88479badcd483"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujan2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com//security-alerts/cpujul2021.html"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-JSON-597481"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-608931"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/ree3abcd33c06ee95ab59faa1751198a1186d8941ddc2c2562c12966c@%3Cissues.zookeeper.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rec8bb4d637b04575da41cfae49118e108e95d43bfac39b7b698ee4db@%3Cissues.zookeeper.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rd9b9cc843f5cf5b532bdad9e87a817967efcf52b917e8c43b6df4cc7@%3Cissues.zookeeper.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rba7ea4d75d6a8e5b935991d960d9b893fd30e576c4d3b531084ebd7d@%3Cissues.flink.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rb89bd82dffec49f83b49e9ad625b1b63a408b3c7d1a60d6f049142a0@%3Cissues.flink.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rb2b981912446a74e14fe6076c4b7c7d8502727ea0718e6a65a9b1be5@%3Cissues.zookeeper.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rb023d54a46da1ac0d8969097f5fecc79636b07d3b80db7b818a5c55c@%3Cissues.zookeeper.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/ra890c24b3d90be36daf48ae76b263acb297003db24c1122f8e4aaef2@%3Cissues.flink.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r9c6d28e5b9a9b3481b7d1f90f1c2f75cd1a5ade91038426e0fb095da@%3Cdev.flink.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r977a907ecbedf87ae5ba47d4c77639efb120f74d4d1b3de14a4ef4da@%3Cissues.flink.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r8d2e174230f6d26e16c007546e804c343f1f68956f526daaafa4aaae@%3Cdev.zookeeper.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r5f17bfca1d6e7f4b33ae978725b2fd62a9f1b3111696eafa9add802d@%3Cissues.zookeeper.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r3b04f4e99a19613f88ae088aa18cd271231a3c79dfff8f5efa8cda61@%3Cissues.zookeeper.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r37c0e1807da7ff2bdd028bbe296465a6bbb99e2320dbe661d5d8b33b@%3Cissues.zookeeper.apache.org%3E"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/trentm/json"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-05T19:43:27Z",
    "nvd_published_at" : "2020-08-30T08:15:00Z"
  }
}