GHSA-6jrj-vc65-c983: Unzip stream Unzip-stream Allows Arbitrary File Write Vulnerability

HIGH
CVSS 7.5
CWE-22
Published
Advisory Summary

GHSA-6jrj-vc65-c983 is a HIGH (CVSS 7.5) unzip-stream allows arbitrary file write vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Unzip stream libraries in the npm ecosystem. The issue involves unzip-stream allows arbitrary file write via artifact extraction. Remediation is available by upgrading affected packages to version 0.3.2.

GHSA-6jrj-vc65-c983 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-6jrj-vc65-c983
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Unzip stream
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:N/I:H/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 None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-6jrj-vc65-c983

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

unzip-stream fixed: 0.3.2
npm install unzip-stream@0.3.2
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 unzip-stream

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-6jrj-vc65-c983, inspect your project dependencies using npm:

npm ls unzip-stream

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

Note: The npm ls unzip-stream 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 Unzip stream, 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 When using the `Extract()` method of unzip-stream, malicious zip files were able to write to paths they shouldn't be allowed to. ### Patches Fixed in 0.3.2 ### References - https://snyk.io/research/zip-slip-vulnerability - https://github.com/mhr3/unzip-stream/compare/v0.3.1...v0.3.2 ### Credits Justin Taft from Google

GHSA-6jrj-vc65-c983 Affected Unzip stream Versions

1 component(s)
Fixed Versions:
0.3.2
Product / Package Ecosystem Affected Versions Fixed Version
unzip-stream
npm
< 0.3.2
0.3.2

References

Frequently Asked Questions

What is GHSA-6jrj-vc65-c983?
GHSA-6jrj-vc65-c983 is a security vulnerability in Unzip stream involving unzip-stream allows Arbitrary File Write via artifact extraction under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Unzip stream versions are affected?
Affected versions include releases prior to 0.3.2 across affected packages: unzip-stream.
What version fixes GHSA-6jrj-vc65-c983?
Upgrading to 0.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is unzip-stream affected?
Yes, unzip-stream is affected in releases prior to 0.3.2. Upgrade your dependency to 0.3.2 or later.
What is the CVSS score of GHSA-6jrj-vc65-c983?
GHSA-6jrj-vc65-c983 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:N/I:H/A:N.
What CWE is associated with GHSA-6jrj-vc65-c983?
GHSA-6jrj-vc65-c983 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 GHSA-6jrj-vc65-c983?
Run the dependency tree command: 'npm ls unzip-stream'. 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-6jrj-vc65-c983",
  "modified" : "2024-08-26T15:17:40Z",
  "published" : "2024-08-26T15:17:40Z",
  "aliases" : [ ],
  "summary" : "unzip-stream allows Arbitrary File Write via artifact extraction",
  "details" : "### Impact\n\nWhen using the `Extract()` method of unzip-stream, malicious zip files were able to write to paths they shouldn't be allowed to.\n\n### Patches\n\nFixed in 0.3.2\n\n### References\n\n- https://snyk.io/research/zip-slip-vulnerability\n- https://github.com/mhr3/unzip-stream/compare/v0.3.1...v0.3.2\n\n### Credits\n\nJustin Taft from Google",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "unzip-stream"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mhr3/unzip-stream/security/advisories/GHSA-6jrj-vc65-c983"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mhr3/unzip-stream/commit/ab67989719abb4dcc774d02de266151905b8d45a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mhr3/unzip-stream"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mhr3/unzip-stream/compare/v0.3.1...v0.3.2"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/research/zip-slip-vulnerability"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-08-26T15:17:40Z",
    "nvd_published_at" : null
  }
}