CVE-2021-4299: String kit String-kit Inefficient Regular Expression Complexity Vulnerability
HIGHCVE-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
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).
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.
npm install string-kit@0.12.8
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
CVE-2021-4299 Affected String kit Versions
1 component(s)| 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?
Which String kit versions are affected?
What version fixes CVE-2021-4299?
Is string-kit affected?
What is the CVSS score of CVE-2021-4299?
What CWE is associated with CVE-2021-4299?
How can I check npm dependencies for CVE-2021-4299?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}