CVE-2022-29244: Npm Packing Does Not Respect Root-level Vulnerability

HIGH
Advisory Identifier: GHSA-hj9c-8jmm-8c52
CVSS 7.5
CWE-200
Published
Advisory Summary

CVE-2022-29244 is a HIGH (CVSS 7.5) packing does not respect root-level vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Npm libraries in the npm ecosystem. The issue involves packing does not respect root-level ignore files in workspaces. Remediation is available by upgrading affected packages to version 8.11.0.

CVE-2022-29244 at a Glance

CVE Identifier CVE-2022-29244
GHSA Identifier GHSA-hj9c-8jmm-8c52
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Npm
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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:N/S:U/C:H/I:N/A:N).

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

How to Fix CVE-2022-29244

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: 8.11.0
npm install npm@8.11.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 npm

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-29244, 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 8.11.0), 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

### Impact `npm pack` ignores root-level `.gitignore` & `.npmignore` file exclusion directives when run in a workspace or with a workspace flag (ie. `--workspaces`, `--workspace=<name>`). Anyone who has run `npm pack` or `npm publish` with workspaces, as of [v7.9.0](https://github.com/npm/cli/releases/tag/v7.9.0) & [v7.13.0](https://github.com/npm/cli/releases/tag/v7.13.0) respectively, may be affected and have published files into the npm registry they did not intend to include. ### Patch - Upgrade to the latest, patched version of `npm` ([`v8.11.0`](https://github.com/npm/cli/releases/tag/v8.11.0) or greater), run: `npm i -g npm@latest` - Node.js versions [`v16.15.1`](https://github.com/nodejs/node/releases/tag/v16.15.1), [`v17.19.1`](https://github.com/nodejs/node/releases/tag/v17.9.1) & [`v18.3.0`](https://github.com/nodejs/node/releases/tag/v18.3.0) include the patched `v8.11.0` version of `npm` #### Steps to take to see if you're impacted 1. Run `npm publish --dry-run` or `npm pack` with an `npm` version `>=7.9.0` & `<8.11.0` inside the project's root directory using a workspace flag like: `--workspaces` or `--workspace=<name>` (ex. `npm pack --workspace=foo`) 2. Check the output in your terminal which will list the package contents (note: `tar -tvf <package-on-disk>` also works) 3. If you find that there are files included you did not expect, you should: 3.1. Create & publish a new release excluding those files (ref. ["Keeping files out of your Package"](https://docs.npmjs.com/cli/v8/using-npm/developers#keeping-files-out-of-your-package)) 3.2. Deprecate the old package (ex. `npm deprecate <pkg>[@<version>] <message>`) 3.3. Revoke or rotate any sensitive information (ex. passwords, tokens, secrets etc.) which might have been exposed ### References - [CVE-2022-29244](https://nvd.nist.gov/vuln/detail/CVE-2022-29244) - [`npm-packlist`](https://github.com/npm/npm-packlist) - [`libnpmpack`](https://github.com/npm/cli/tree/latest/workspaces/libnpmpack) - [`libnpmpublish`](https://github.com/npm/cli/tree/latest/workspaces/libnpmpublish)

CVE-2022-29244 Affected Npm Versions

1 component(s)
Fixed Versions:
8.11.0
Product / Package Ecosystem Affected Versions Fixed Version
npm
npm
≥ 7.9.0
< 8.11.0
8.11.0

References

Frequently Asked Questions

What is CVE-2022-29244?
CVE-2022-29244 is a security vulnerability in Npm involving Packing does not respect root-level ignore files in workspaces under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Npm versions are affected?
Affected versions include releases prior to 8.11.0 across affected packages: npm.
What version fixes CVE-2022-29244?
Upgrading to 8.11.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is npm affected?
Yes, npm is affected in releases prior to 8.11.0. Upgrade your dependency to 8.11.0 or later.
What is the CVSS score of CVE-2022-29244?
CVE-2022-29244 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2022-29244?
CVE-2022-29244 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-2022-29244?
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-hj9c-8jmm-8c52",
  "modified" : "2022-06-29T21:50:23Z",
  "published" : "2022-06-02T15:37:27Z",
  "aliases" : [ "CVE-2022-29244" ],
  "summary" : "Packing does not respect root-level ignore files in workspaces",
  "details" : "### Impact\n`npm pack` ignores root-level `.gitignore` & `.npmignore` file exclusion directives when run in a workspace or with a workspace flag (ie. `--workspaces`, `--workspace=<name>`). Anyone who has run `npm pack` or `npm publish` with workspaces, as of [v7.9.0](https://github.com/npm/cli/releases/tag/v7.9.0) & [v7.13.0](https://github.com/npm/cli/releases/tag/v7.13.0) respectively, may be affected and have published files into the npm registry they did not intend to include.\n\n### Patch\n- Upgrade to the latest, patched version of `npm` ([`v8.11.0`](https://github.com/npm/cli/releases/tag/v8.11.0) or greater), run: `npm i -g npm@latest`\n- Node.js versions [`v16.15.1`](https://github.com/nodejs/node/releases/tag/v16.15.1), [`v17.19.1`](https://github.com/nodejs/node/releases/tag/v17.9.1) & [`v18.3.0`](https://github.com/nodejs/node/releases/tag/v18.3.0) include the patched `v8.11.0` version of `npm`\n\n#### Steps to take to see if you're impacted\n1. Run `npm publish --dry-run` or `npm pack` with an `npm` version `>=7.9.0` & `<8.11.0` inside the project's root directory using a workspace flag like: `--workspaces` or `--workspace=<name>` (ex. `npm pack --workspace=foo`)\n2. Check the output in your terminal which will list the package contents (note: `tar -tvf <package-on-disk>` also works)\n3. If you find that there are files included you did not expect, you should:\n  3.1. Create & publish a new release excluding those files (ref. [\"Keeping files out of your Package\"](https://docs.npmjs.com/cli/v8/using-npm/developers#keeping-files-out-of-your-package))\n  3.2. Deprecate the old package (ex. `npm deprecate <pkg>[@<version>] <message>`)\n  3.3. Revoke or rotate any sensitive information (ex. passwords, tokens, secrets etc.) which might have been exposed\n### References\n- [CVE-2022-29244](https://nvd.nist.gov/vuln/detail/CVE-2022-29244)\n- [`npm-packlist`](https://github.com/npm/npm-packlist)\n- [`libnpmpack`](https://github.com/npm/cli/tree/latest/workspaces/libnpmpack)\n- [`libnpmpublish`](https://github.com/npm/cli/tree/latest/workspaces/libnpmpublish)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "npm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.9.0"
      }, {
        "fixed" : "8.11.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/npm/cli/security/advisories/GHSA-hj9c-8jmm-8c52"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-29244"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/node/pull/43210"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/node/releases/tag/v16.15.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/node/releases/tag/v17.9.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/node/releases/tag/v18.3.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/cli"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/cli/releases/tag/v8.11.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/cli/tree/latest/workspaces/libnpmpack"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/cli/tree/latest/workspaces/libnpmpublish"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/npm-packlist"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220722-0007"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-02T15:37:27Z",
    "nvd_published_at" : "2022-06-13T14:15:00Z"
  }
}