CVE-2021-23406: Pac resolver Code Injection Vulnerability

HIGH
Advisory Identifier: GHSA-9j49-mfvp-vmhm
CVSS 8.1
CWE-94
Published
Advisory Summary

CVE-2021-23406 is a HIGH (CVSS 8.1) code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Pac resolver libraries in the npm ecosystem. The issue involves code injection in pac-resolver. Remediation is available by upgrading affected packages to version 5.0.0, 3.0.1.

CVE-2021-23406 at a Glance

CVE Identifier CVE-2021-23406
GHSA Identifier GHSA-9j49-mfvp-vmhm
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Pac resolver
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2021-23406

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

pac-resolver fixed: 5.0.0
npm install pac-resolver@5.0.0
degenerator fixed: 3.0.1
npm install degenerator@3.0.1
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 pac-resolver

How to Check if You Are Affected

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

npm ls pac-resolver

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

Note: The npm ls pac-resolver 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Pac resolver, 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 pac-resolver before 5.0.0. This can occur when used with untrusted input, due to unsafe PAC file handling. **NOTE:** The fix for this vulnerability is applied in the node-degenerator library, a dependency written by the same maintainer.

CVE-2021-23406 Affected Pac resolver Versions

2 component(s)
Fixed Versions:
5.0.03.0.1
Product / Package Ecosystem Affected Versions Fixed Version
pac-resolver
npm
< 5.0.0
5.0.0
degenerator
npm
< 3.0.1
3.0.1

References

Frequently Asked Questions

What is CVE-2021-23406?
CVE-2021-23406 is a security vulnerability in Pac resolver involving Code Injection in pac-resolver under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Pac resolver versions are affected?
Affected versions include releases prior to 5.0.0, 3.0.1 across affected packages: pac-resolver, degenerator.
What version fixes CVE-2021-23406?
Upgrading to 5.0.0, 3.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pac-resolver affected?
Yes, pac-resolver is affected in releases prior to 5.0.0. Upgrade your dependency to 5.0.0 or later.
Is degenerator affected?
Yes, degenerator is affected in releases prior to 3.0.1. Upgrade your dependency to 3.0.1 or later.
What is the CVSS score of CVE-2021-23406?
CVE-2021-23406 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-23406?
CVE-2021-23406 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2021-23406?
Run the dependency tree command: 'npm ls pac-resolver'. 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-9j49-mfvp-vmhm",
  "modified" : "2021-08-25T19:28:31Z",
  "published" : "2021-09-02T17:10:06Z",
  "aliases" : [ "CVE-2021-23406" ],
  "summary" : "Code Injection in pac-resolver",
  "details" : "This affects the package pac-resolver before 5.0.0. This can occur when used with untrusted input, due to unsafe PAC file handling. **NOTE:** The fix for this vulnerability is applied in the node-degenerator library, a dependency written by the same maintainer.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "pac-resolver"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.0.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "degenerator"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23406"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/TooTallNate/node-degenerator/commit/9d25bb67d957bc2e5425fea7bf7a58b3fc64ff9e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/TooTallNate/node-degenerator/commit/ccc3445354135398b6eb1a04c7d27c13b833f2d5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/TooTallNate"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/TooTallNate/node-pac-resolver/releases/tag/5.0.0"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1568506"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-PACRESOLVER-1564857"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-08-25T19:28:31Z",
    "nvd_published_at" : "2021-08-24T08:15:00Z"
  }
}