VYPR
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.

PackageAffected versionsPatched versions
@eslint/plugin-kitnpm
< 0.2.30.2.3

Patches

2
071be842f0bd

Merge commit from fork

https://github.com/eslint/rewriteNicholas C. ZakasNov 13, 2024via ghsa
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", () => {
    

Vulnerability 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

News mentions

0

No linked articles in our index yet.