CVE-2016-3956: Npm Npm Token Leak Vulnerability

HIGH
Advisory Identifier: GHSA-m5h6-hr3q-22h5
CWE-200
Published
Advisory Summary

CVE-2016-3956 is a HIGH npm token leak vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Npm libraries in the npm ecosystem. The issue involves npm token leak in npm. Remediation is available by upgrading affected packages to version 2.15.1, 3.8.3.

CVE-2016-3956 at a Glance

CVE Identifier CVE-2016-3956
GHSA Identifier GHSA-m5h6-hr3q-22h5
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Npm
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2016-3956

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

npm fixed: 2.15.1
npm install npm@2.15.1
npm fixed: 3.8.3
npm install npm@3.8.3
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 npm

How to Check if You Are Affected

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

npm ls npm

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

Note: The npm ls npm 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-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Npm, 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 the `npm` package include the bearer token of the logged in user in every request made by the CLI, even if the request is not directed towards the user's active registry. An attacker could create an HTTP server to collect tokens, and by various means including but not limited to install scripts, cause the npm CLI to make a request to that server, which would compromise the user's token. This compromised token could be used to do anything that the user could do, including publishing new packages. ## Recommendation 1. Update npm with `npm install npm@latest -g` 2. [Revoke your Tokens](https://www.npmjs.com/settings/tokens) 3. Enable [Two-Factor Authentication](https://docs.npmjs.com/getting-started/using-two-factor-authentication)

CVE-2016-3956 Affected Npm Versions

2 component(s)
Fixed Versions:
2.15.13.8.3
Product / Package Ecosystem Affected Versions Fixed Version
npm
npm
< 2.15.1
2.15.1
npm
npm
≥ 3.0.0
< 3.8.3
3.8.3

References

Frequently Asked Questions

What is CVE-2016-3956?
CVE-2016-3956 is a security vulnerability in Npm involving npm Token Leak in npm under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Npm versions are affected?
Affected versions include releases prior to 2.15.1, 3.8.3 across affected packages: npm.
What version fixes CVE-2016-3956?
Upgrading to 2.15.1, 3.8.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is npm affected?
Yes, npm is affected in releases prior to 2.15.1, 3.8.3. Upgrade your dependency to 2.15.1, 3.8.3 or later.
What CWE is associated with CVE-2016-3956?
CVE-2016-3956 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for CVE-2016-3956?
Run the dependency tree command: 'npm ls npm'. 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-m5h6-hr3q-22h5",
  "modified" : "2020-08-31T18:10:47Z",
  "published" : "2018-07-31T22:58:35Z",
  "aliases" : [ "CVE-2016-3956" ],
  "summary" : "npm Token Leak in npm",
  "details" : "Affected versions of the `npm` package include the bearer token of the logged in user in every request made by the CLI, even if the request is not directed towards the user's active registry. \n\nAn attacker could create an HTTP server to collect tokens, and by various means including but not limited to install scripts, cause the npm CLI to make a request to that server, which would compromise the user's token.\n\nThis compromised token could be used to do anything that the user could do, including publishing new packages.\n\n\n\n\n## Recommendation\n\n1. Update npm with `npm install npm@latest -g`\n2. [Revoke your Tokens](https://www.npmjs.com/settings/tokens)\n3. Enable [Two-Factor Authentication](https://docs.npmjs.com/getting-started/using-two-factor-authentication)",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "npm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.15.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.15.0"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "npm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.8.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.8.2"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-3956"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/npm/issues/8380"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/npm/commit/f67ecad59e99a03e5aad8e93cd1a086ae087cb29"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/npm/commit/fea8cc92cee02c720b58f95f14d315507ccad401"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-m5h6-hr3q-22h5"
  }, {
    "type" : "WEB",
    "url" : "https://nodejs.org/en/blog/vulnerability/npm-tokens-leak-march-2016"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/98"
  }, {
    "type" : "WEB",
    "url" : "http://blog.npmjs.org/post/142036323955/fixing-a-bearer-token-vulnerability"
  }, {
    "type" : "WEB",
    "url" : "http://www-01.ibm.com/support/docview.wss?uid=swg21980827"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:45:00Z",
    "nvd_published_at" : "2016-07-02T14:59:00Z"
  }
}