CVE-2021-4299: String kit String-kit Inefficient Regular Expression Complexity Vulnerability

HIGH
Advisory Identifier: GHSA-pfrm-4rjw-g9q5
CVSS 7.5
CWE-1333
Published
Advisory Summary

CVE-2021-4299 is a HIGH (CVSS 7.5) string-kit inefficient regular expression complexity vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting String kit libraries in the npm ecosystem. The issue involves string-kit inefficient regular expression complexity vulnerability. Remediation is available by upgrading affected packages to version 0.12.8.

CVE-2021-4299 at a Glance

CVE Identifier CVE-2021-4299
GHSA Identifier GHSA-pfrm-4rjw-g9q5
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product String kit
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:N/A:H).

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 High (A:H)

How to Fix CVE-2021-4299

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

string-kit fixed: 0.12.8
npm install string-kit@0.12.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 string-kit

How to Check if You Are Affected

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

npm ls string-kit

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

Note: The npm ls string-kit 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-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In String kit, 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

A vulnerability classified as problematic was found in cronvel string-kit up to 0.12.7. This vulnerability affects the function naturalSort of the file lib/naturalSort.js. The manipulation leads to inefficient regular expression complexity. The attack can be initiated remotely. Upgrading to version 0.12.8 can address this issue. The name of the patch is 9cac4c298ee92c1695b0695951f1488884a7ca73. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-217180.

CVE-2021-4299 Affected String kit Versions

1 component(s)
Fixed Versions:
0.12.8
Product / Package Ecosystem Affected Versions Fixed Version
string-kit
npm
< 0.12.8
0.12.8

References

Frequently Asked Questions

What is CVE-2021-4299?
CVE-2021-4299 is a security vulnerability in String kit involving string-kit Inefficient Regular Expression Complexity vulnerability under CWE-1333: Inefficient Regular Expression Complexity.
Which String kit versions are affected?
Affected versions include releases prior to 0.12.8 across affected packages: string-kit.
What version fixes CVE-2021-4299?
Upgrading to 0.12.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is string-kit affected?
Yes, string-kit is affected in releases prior to 0.12.8. Upgrade your dependency to 0.12.8 or later.
What is the CVSS score of CVE-2021-4299?
CVE-2021-4299 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:N/A:H.
What CWE is associated with CVE-2021-4299?
CVE-2021-4299 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check npm dependencies for CVE-2021-4299?
Run the dependency tree command: 'npm ls string-kit'. 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-pfrm-4rjw-g9q5",
  "modified" : "2023-01-10T16:13:19Z",
  "published" : "2023-01-02T09:31:57Z",
  "aliases" : [ "CVE-2021-4299" ],
  "summary" : "string-kit Inefficient Regular Expression Complexity vulnerability",
  "details" : "A vulnerability classified as problematic was found in cronvel string-kit up to 0.12.7. This vulnerability affects the function naturalSort of the file lib/naturalSort.js. The manipulation leads to inefficient regular expression complexity. The attack can be initiated remotely. Upgrading to version 0.12.8 can address this issue. The name of the patch is 9cac4c298ee92c1695b0695951f1488884a7ca73. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-217180.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "string-kit"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.12.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-4299"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cronvel/string-kit/commit/9cac4c298ee92c1695b0695951f1488884a7ca73"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cronvel/string-kit"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cronvel/string-kit/releases/tag/v0.12.8"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?ctiid.217180"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?id.217180"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-01-04T14:27:35Z",
    "nvd_published_at" : "2023-01-02T08:15:00Z"
  }
}