CVE-2021-21414: @prisma/sdk Command Injection Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-pxcc-hj8w-fmm7
CVSS 7.7
CWE-78
Published
Advisory Summary

CVE-2021-21414 is a HIGH (CVSS 7.7) command injection vulnerability vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting @prisma/sdk libraries in the npm ecosystem. The issue involves command injection vulnerability in @prisma/sdk in getpackedpackage function. Remediation is available by upgrading affected packages to version 2.20.0.

CVE-2021-21414 at a Glance

CVE Identifier CVE-2021-21414
GHSA Identifier GHSA-pxcc-hj8w-fmm7
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product @prisma/sdk
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.7

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

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

How to Fix CVE-2021-21414

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

@prisma/sdk fixed: 2.20.0
npm install @prisma/sdk@2.20.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 @prisma/sdk

How to Check if You Are Affected

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

npm ls @prisma/sdk

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

Note: The npm ls @prisma/sdk 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 @prisma/sdk, 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

### Impact As of today, we are not aware of any Prisma users or external consumers of the `@prisma/sdk` package who are affected by this security vulnerability. This issue may lead to remote code execution if a client of the library calls the vulnerable method with untrusted input. It only affects the `getPackedPackage` function and this function is not advertised and only used for tests & building our CLI, no malicious code was found after checking our codebase. ### Patches Fixed in - @prisma/sdk@2.20.0 (latest channel) - @prisma/sdk@2.20.0-dev.29 (dev channel) Pull Request closing this vulnerability [https://github.com/prisma/prisma/pull/6245](https://github.com/prisma/prisma/pull/6245) ### Acknowledgements This issue was discovered and reported by GitHub Engineer [@erik-krogh (Erik Krogh Kristensen)](https://github.com/erik-krogh). ### For more information If you have any questions or comments about this advisory: - Create a discussion in [the Prisma repository](https://github.com/prisma/prisma/discussions) - Email us at security@prisma.io

CVE-2021-21414 Affected @prisma/sdk Versions

1 component(s)
Fixed Versions:
2.20.0
Product / Package Ecosystem Affected Versions Fixed Version
@prisma/sdk
npm
< 2.20.0
2.20.0

References

Frequently Asked Questions

What is CVE-2021-21414?
CVE-2021-21414 is a security vulnerability in @prisma/sdk involving Command injection vulnerability in @prisma/sdk in getPackedPackage function under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which @prisma/sdk versions are affected?
Affected versions include releases prior to 2.20.0 across affected packages: @prisma/sdk.
What version fixes CVE-2021-21414?
Upgrading to 2.20.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @prisma/sdk affected?
Yes, @prisma/sdk is affected in releases prior to 2.20.0. Upgrade your dependency to 2.20.0 or later.
What is the CVSS score of CVE-2021-21414?
CVE-2021-21414 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2021-21414?
CVE-2021-21414 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-2021-21414?
Run the dependency tree command: 'npm ls @prisma/sdk'. 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-pxcc-hj8w-fmm7",
  "modified" : "2021-03-31T18:00:32Z",
  "published" : "2021-04-06T17:25:12Z",
  "aliases" : [ "CVE-2021-21414" ],
  "summary" : "Command injection vulnerability in @prisma/sdk in getPackedPackage function",
  "details" : "### Impact\n\nAs of today, we are not aware of any Prisma users or external consumers of the `@prisma/sdk` package who are affected by this security vulnerability.\n\nThis issue may lead to remote code execution if a client of the library calls the vulnerable method with untrusted input.\n\nIt only affects the `getPackedPackage` function and this function is not advertised and only used for tests & building our CLI, no malicious code was found after checking our codebase.\n\n### Patches\n\nFixed in \n- @prisma/sdk@2.20.0 (latest channel)\n- @prisma/sdk@2.20.0-dev.29 (dev channel)\n\nPull Request closing this vulnerability [https://github.com/prisma/prisma/pull/6245](https://github.com/prisma/prisma/pull/6245)\n\n### Acknowledgements\n\nThis issue was discovered and reported by GitHub Engineer [@erik-krogh (Erik Krogh Kristensen)](https://github.com/erik-krogh).\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n- Create a discussion in [the Prisma repository](https://github.com/prisma/prisma/discussions)\n- Email us at security@prisma.io",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@prisma/sdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.20.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/prisma/prisma/security/advisories/GHSA-pxcc-hj8w-fmm7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21414"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/prisma/prisma/pull/6245"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210618-0003"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-31T18:00:32Z",
    "nvd_published_at" : "2021-04-29T01:15:00Z"
  }
}