CVE-2021-23362: Hosted git info Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-43f8-2h32-f4cj
CVSS 5.3
CWE-400
Published
Advisory Summary

CVE-2021-23362 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Hosted git info libraries in the npm ecosystem. The issue involves regular expression denial of service in hosted-git-info. Remediation is available by upgrading affected packages to version 2.8.9, 3.0.8.

CVE-2021-23362 at a Glance

CVE Identifier CVE-2021-23362
GHSA Identifier GHSA-43f8-2h32-f4cj
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Hosted git info
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-23362

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

hosted-git-info fixed: 2.8.9
npm install hosted-git-info@2.8.9
hosted-git-info fixed: 3.0.8
npm install hosted-git-info@3.0.8
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 hosted-git-info

How to Check if You Are Affected

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

npm ls hosted-git-info

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

Note: The npm ls hosted-git-info 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Hosted git info, 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

The npm package `hosted-git-info` before 3.0.8 are vulnerable to Regular Expression Denial of Service (ReDoS) via regular expression shortcutMatch in the fromUrl function in index.js. The affected regular expression exhibits polynomial worst-case time complexity

CVE-2021-23362 Affected Hosted git info Versions

2 component(s)
Fixed Versions:
2.8.93.0.8
Product / Package Ecosystem Affected Versions Fixed Version
hosted-git-info
npm
< 2.8.9
2.8.9
hosted-git-info
npm
≥ 3.0.0
< 3.0.8
3.0.8

References

Frequently Asked Questions

What is CVE-2021-23362?
CVE-2021-23362 is a security vulnerability in Hosted git info involving Regular Expression Denial of Service in hosted-git-info under CWE-400: Uncontrolled Resource Consumption.
Which Hosted git info versions are affected?
Affected versions include releases prior to 2.8.9, 3.0.8 across affected packages: hosted-git-info.
What version fixes CVE-2021-23362?
Upgrading to 2.8.9, 3.0.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is hosted-git-info affected?
Yes, hosted-git-info is affected in releases prior to 2.8.9, 3.0.8. Upgrade your dependency to 2.8.9, 3.0.8 or later.
What is the CVSS score of CVE-2021-23362?
CVE-2021-23362 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-23362?
CVE-2021-23362 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2021-23362?
Run the dependency tree command: 'npm ls hosted-git-info'. 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-43f8-2h32-f4cj",
  "modified" : "2022-03-18T20:25:44Z",
  "published" : "2021-05-06T16:10:39Z",
  "aliases" : [ "CVE-2021-23362" ],
  "summary" : "Regular Expression Denial of Service in hosted-git-info",
  "details" : "The npm package `hosted-git-info` before 3.0.8 are vulnerable to Regular Expression Denial of Service (ReDoS) via regular expression shortcutMatch in the fromUrl function in index.js. The affected regular expression exhibits polynomial worst-case time complexity",
  "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" : "hosted-git-info"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.8.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "hosted-git-info"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23362"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/hosted-git-info/pull/76"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/hosted-git-info/commit/29adfe5ef789784c861b2cdeb15051ec2ba651a7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/hosted-git-info/commit/8d4b3697d79bcd89cdb36d1db165e3696c783a01"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/hosted-git-info/commit/bede0dc38e1785e732bf0a48ba6f81a4a908eba3"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/npm/hosted-git-info"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/hosted-git-info/commits/v2"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1088356"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-HOSTEDGITINFO-1088355"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-24T21:06:22Z",
    "nvd_published_at" : "2021-03-23T17:15:00Z"
  }
}