CVE-2020-15123: Codecov Command Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-xp63-6vf5-xf3v
CVSS 9.3
CWE-78
Published
Advisory Summary

CVE-2020-15123 is a MODERATE (CVSS 9.3) command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Codecov libraries in the npm ecosystem. The issue involves command injection in codecov (npm package). Remediation is available by upgrading affected packages to version 3.7.1.

CVE-2020-15123 at a Glance

CVE Identifier CVE-2020-15123
GHSA Identifier GHSA-xp63-6vf5-xf3v
Severity MODERATE
CVSS v3.1 Base Score 9.3
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Codecov
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.3

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

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

How to Fix CVE-2020-15123

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

codecov fixed: 3.7.1
npm install codecov@3.7.1
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 codecov

How to Check if You Are Affected

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

npm ls codecov

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

Note: The npm ls codecov 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 Codecov, 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 The `upload` method has a command injection vulnerability. Clients of the `codecov-node` library are unlikely to be aware of this, so they might unwittingly write code that contains a vulnerability. A similar CVE was issued: [CVE-2020-7597](https://github.com/advisories/GHSA-5q88-cjfq-g2mh), but the fix was incomplete. It only blocked `&`, and command injection is still possible using backticks instead to bypass the sanitizer. We have written a [CodeQL](https://codeql.com) query, which automatically detects this vulnerability. You can see the results of the query on the `codecov-node` project [here](https://lgtm.com/query/7714424068617023832/). ### Patches This has been patched in version 3.7.1 ### Workarounds None, however, the attack surface is low in this case. Particularly in the standard use of codecov, where the module is used directly in a build pipeline, not built against as a library in another application that may supply malicious input and perform command injection. ### References * [CVE-2020-7597](https://github.com/advisories/GHSA-5q88-cjfq-g2mh) ### For more information If you have any questions or comments about this advisory: * Contact us via our [Security Email](mailto:security@codecov.io)

CVE-2020-15123 Affected Codecov Versions

1 component(s)
Fixed Versions:
3.7.1
Product / Package Ecosystem Affected Versions Fixed Version
codecov
npm
< 3.7.1
3.7.1

References

Frequently Asked Questions

What is CVE-2020-15123?
CVE-2020-15123 is a security vulnerability in Codecov involving Command injection in codecov (npm package) under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Codecov versions are affected?
Affected versions include releases prior to 3.7.1 across affected packages: codecov.
What version fixes CVE-2020-15123?
Upgrading to 3.7.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is codecov affected?
Yes, codecov is affected in releases prior to 3.7.1. Upgrade your dependency to 3.7.1 or later.
What is the CVSS score of CVE-2020-15123?
CVE-2020-15123 has a CVSS v3.1 base score of 9.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2020-15123?
CVE-2020-15123 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-15123?
Run the dependency tree command: 'npm ls codecov'. 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-xp63-6vf5-xf3v",
  "modified" : "2021-01-07T23:47:13Z",
  "published" : "2020-07-20T17:20:20Z",
  "aliases" : [ "CVE-2020-15123" ],
  "summary" : "Command injection in codecov (npm package)",
  "details" : "### Impact\n\nThe `upload` method has a command injection vulnerability. Clients of the `codecov-node` library are unlikely to be aware of this, so they might unwittingly write code that contains a vulnerability.\n\nA similar CVE was issued: [CVE-2020-7597](https://github.com/advisories/GHSA-5q88-cjfq-g2mh), but the fix was incomplete. It only blocked `&`, and command injection is still possible using backticks instead to bypass the sanitizer.\n\nWe have written a [CodeQL](https://codeql.com) query, which automatically detects this vulnerability. You can see the results of the query on the `codecov-node` project [here](https://lgtm.com/query/7714424068617023832/).\n\n\n### Patches\nThis has been patched in version 3.7.1\n\n### Workarounds\n\nNone, however, the attack surface is low in this case. Particularly in the standard use of codecov, where the module is used directly in a build pipeline, not built against as a library in another application that may supply malicious input and perform command injection. \n\n### References\n*  [CVE-2020-7597](https://github.com/advisories/GHSA-5q88-cjfq-g2mh)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Contact us via our [Security Email](mailto:security@codecov.io)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "codecov"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.7.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/codecov/codecov-node/security/advisories/GHSA-xp63-6vf5-xf3v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15123"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/codecov/codecov-node/pull/180"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/codecov/codecov-node/commit/c0711c656686e902af2cd92d6aecc8074de4d83d"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-5q88-cjfq-g2mh"
  }, {
    "type" : "WEB",
    "url" : "https://lgtm.com/query/7714424068617023832"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-07-20T17:19:56Z",
    "nvd_published_at" : null
  }
}