High severity7.5NVD Advisory· Published Nov 19, 2024· Updated Apr 15, 2026
CVE-2024-21539
CVE-2024-21539
Description
Versions of the package @eslint/plugin-kit before 0.2.3 are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper input sanitization. An attacker can increase the CPU usage and crash the program by exploiting this vulnerability.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
@eslint/plugin-kitnpm | < 0.2.3 | 0.2.3 |
Patches
2071be842f0bdMerge commit from fork
2 files changed · +52 −1
packages/plugin-kit/src/config-comment-parser.js+3 −1 modified@@ -99,7 +99,9 @@ export class ConfigCommentParser { const items = /** @type {StringConfig} */ ({}); // Collapse whitespace around `:` and `,` to make parsing easier - const trimmedString = string.replace(/\s*([:,])\s*/gu, "$1"); + const trimmedString = string + .trim() + .replace(/(?<!\s)\s*([:,])\s*/gu, "$1"); trimmedString.split(/\s|,+/u).forEach(name => { if (!name) {
packages/plugin-kit/tests/config-comment-parser.test.js+49 −0 modified@@ -74,6 +74,55 @@ describe("ConfigCommentParser", () => { b: null, }); }); + + it("should return an empty object for an empty string", () => { + const code = ""; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, {}); + }); + + it("should parse string config with one item, no value, and leading whitespace", () => { + const code = `${" ".repeat(100000)}a`; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, { + a: null, + }); + }); + + it("should parse string config with one item, no value, and trailing whitespace", () => { + const code = `a${" ".repeat(100000)}`; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, { + a: null, + }); + }); + + it("should parse string config with two items, no values, and whitespace in the middle", () => { + const code = `a${" ".repeat(100000)}b`; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, { + a: null, + b: null, + }); + }); + + it("should parse string config with multiple items with values separated by commas and lots of whitespace", () => { + const whitespace = " ".repeat(100000); + const code = `a: 1${whitespace},${whitespace}b: 2${whitespace},${whitespace}c: 3${whitespace},${whitespace}d: 4`; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, { + a: "1", + b: "2", + c: "3", + d: "4", + }); + }); + }); describe("parseListConfig", () => {
a957ee351c27Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-7q7g-4xm8-89cqghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2024-21539ghsaADVISORY
- github.com/eslint/rewrite/commit/071be842f0bd58de4863cdf2ab86d60f49912abfnvdWEB
- github.com/eslint/rewrite/security/advisories/GHSA-7q7g-4xm8-89cqghsaWEB
- security.snyk.io/vuln/SNYK-JS-ESLINTPLUGINKIT-8340627nvdWEB
News mentions
0No linked articles in our index yet.