CVE-2016-10538: Cli Arbitrary File Write Vulnerability

LOW
Advisory Identifier: GHSA-6cpc-mj5c-m9rq
CWE-22
Published
Advisory Summary

CVE-2016-10538 is a LOW arbitrary file write vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Cli libraries in the npm ecosystem. The issue involves arbitrary file write in cli. Remediation is available by upgrading affected packages to version 1.0.0.

CVE-2016-10538 at a Glance

CVE Identifier CVE-2016-10538
GHSA Identifier GHSA-6cpc-mj5c-m9rq
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Cli
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2016-10538

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

cli fixed: 1.0.0
npm install cli@1.0.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 cli

How to Check if You Are Affected

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

npm ls cli

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

Note: The npm ls cli 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Cli, 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

Affected versions of `cli` use predictable temporary file names. If an attacker can create a symbolic link at the location of one of these temporarly file names, the attacker can arbitrarily write to any file that the user which owns the `cli` process has permission to write to. ## Proof of Concept By creating Symbolic Links at the following locations, the target of the link can be written to. ``` lock_file = '/tmp/' + cli.app + '.pid', log_file = '/tmp/' + cli.app + '.log'; ``` ## Recommendation Update to version 1.0.0 or later.

CVE-2016-10538 Affected Cli Versions

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

References

Frequently Asked Questions

What is CVE-2016-10538?
CVE-2016-10538 is a security vulnerability in Cli involving Arbitrary File Write in cli under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Cli versions are affected?
Affected versions include releases prior to 1.0.0 across affected packages: cli.
What version fixes CVE-2016-10538?
Upgrading to 1.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cli affected?
Yes, cli is affected in releases prior to 1.0.0. Upgrade your dependency to 1.0.0 or later.
What CWE is associated with CVE-2016-10538?
CVE-2016-10538 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for CVE-2016-10538?
Run the dependency tree command: 'npm ls cli'. 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-6cpc-mj5c-m9rq",
  "modified" : "2020-08-31T18:10:40Z",
  "published" : "2019-02-18T23:40:03Z",
  "aliases" : [ "CVE-2016-10538" ],
  "summary" : "Arbitrary File Write in cli",
  "details" : "Affected versions of `cli` use predictable temporary file names. If an attacker can create a symbolic link at the location of one of these temporarly file names, the attacker can arbitrarily write to any file that the user which owns the `cli` process has permission to write to.\n\n\n## Proof of Concept\n\nBy creating Symbolic Links at the following locations, the target of the link can be written to.\n```\nlock_file = '/tmp/' + cli.app + '.pid',\nlog_file = '/tmp/' + cli.app + '.log';\n```\n\n\n## Recommendation\n\nUpdate to version 1.0.0 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-10538"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-js-libs/cli/issues/81"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809252"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-6cpc-mj5c-m9rq"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/95"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:18:53Z",
    "nvd_published_at" : null
  }
}