CVE-2021-23413: Jszip Jszip Vulnerable To Prototype Pollution Vulnerability

MODERATE
Advisory Identifier: GHSA-jg8v-48h5-wgxg
CVSS 5.3
CWE-1321
Published
Advisory Summary

CVE-2021-23413 is a MODERATE (CVSS 5.3) jszip vulnerable to prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Jszip libraries in the npm ecosystem. The issue involves jszip vulnerable to prototype pollution. Remediation is available by upgrading affected packages to version 3.7.0, 2.7.0.

CVE-2021-23413 at a Glance

CVE Identifier CVE-2021-23413
GHSA Identifier GHSA-jg8v-48h5-wgxg
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Jszip
Package Ecosystem npm
Published Date
Last Updated

Security Impact

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

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 None (I:N)
Availability Low (A:L)

How to Fix CVE-2021-23413

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

jszip fixed: 3.7.0
npm install jszip@3.7.0
jszip fixed: 2.7.0
npm install jszip@2.7.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 jszip

How to Check if You Are Affected

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

npm ls jszip

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

Note: The npm ls jszip 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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Jszip, 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

This affects the package jszip before 3.7.0. Crafting a new zip file with filenames set to Object prototype values (e.g `__proto__`, `toString`, etc) results in a returned object with a modified prototype instance.

CVE-2021-23413 Affected Jszip Versions

2 component(s)
Fixed Versions:
3.7.02.7.0
Product / Package Ecosystem Affected Versions Fixed Version
jszip
npm
≥ 3.0.0
< 3.7.0
3.7.0
jszip
npm
< 2.7.0
2.7.0

References

Frequently Asked Questions

What is CVE-2021-23413?
CVE-2021-23413 is a security vulnerability in Jszip involving jszip Vulnerable to Prototype Pollution under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Jszip versions are affected?
Affected versions include releases prior to 3.7.0, 2.7.0 across affected packages: jszip.
What version fixes CVE-2021-23413?
Upgrading to 3.7.0, 2.7.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jszip affected?
Yes, jszip is affected in releases prior to 3.7.0, 2.7.0. Upgrade your dependency to 3.7.0, 2.7.0 or later.
What is the CVSS score of CVE-2021-23413?
CVE-2021-23413 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2021-23413?
CVE-2021-23413 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2021-23413?
Run the dependency tree command: 'npm ls jszip'. 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-jg8v-48h5-wgxg",
  "modified" : "2023-09-12T19:23:56Z",
  "published" : "2021-08-10T16:02:18Z",
  "aliases" : [ "CVE-2021-23413" ],
  "summary" : "jszip Vulnerable to Prototype Pollution",
  "details" : "This affects the package jszip before 3.7.0. Crafting a new zip file with filenames set to Object prototype values (e.g `__proto__`, `toString`, etc) results in a returned object with a modified prototype instance.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jszip"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.7.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jszip"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.7.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23413"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Stuk/jszip/pull/766"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Stuk/jszip/commit/22357494f424178cb416cdb7d93b26dd4f824b36"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Stuk/jszip"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Stuk/jszip/blob/master/lib/object.js%23L88"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARS-1251499"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1251498"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-JSZIP-1251497"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-08-02T22:15:49Z",
    "nvd_published_at" : "2021-07-25T13:15:00Z"
  }
}