CVE-2026-77421: JLine: ReDoS in Nano Editor Regex Search Mode

Published Sep 23, 2026
·
Updated

Summary

When regex search mode is enabled in the JLine3 nano editor, the user-supplied search term is compiled directly as a Java regular expression with no timeout or backtracking bound. A crafted pattern such as (a+)+b can hang the editor session thread at high CPU, causing a denial of service for that session.

Details

In builtins/src/main/java/org/jline/builtins/Nano.java, the search implementation uses Pattern.LITERAL only when regex mode is disabled. When regex mode is enabled, the search term is compiled as a raw Java regex:

java Pattern pat = Pattern.compile( searchTerm, (searchCaseSensitive ? 0 : Pattern.CASEINSENSITIVE | Pattern.UNICODECASE) | (searchRegexp ? 0 : Pattern.LITERAL));

This regex is then applied to buffer content. Because Java's regex engine is backtracking-based, nested-quantifier patterns can take exponential time on non-matching input.

Affected source location: - builtins/src/main/java/org/jline/builtins/Nano.java - doSearch(String text)

PoC

1. Create a file containing a long run of a characters and open it in the JLine3 nano editor. 2. Enable regex search mode with the editor's regex toggle. 3. Start a search and enter the pattern (a+)+b.

Expected result: - The editor stops responding. - The session thread consumes high CPU.

Reproduction environment: - JLine3 on x8664 Linux - OpenJDK 25.0.2

Impact

This is a denial-of-service vulnerability caused by catastrophic regex backtracking. Applications embedding org.jline:jline-builtins and exposing the nano editor are impacted. In local use, the user can hang their own session. In remote multi-user deployments, an attacker can occupy a server worker thread indefinitely.

Suggested Fix

The preferred fix for the current git head is to use a linear-time regex engine for regex search mode while preserving literal matching behavior when regex mode is off.

Suggested patch:

diff diff --git a/builtins/pom.xml b/builtins/pom.xml --- a/builtins/pom.xml +++ b/builtins/pom.xml @@ <dependency> + <groupId>com.google.re2j</groupId> + <artifactId>re2j</artifactId> + <version>1.8</version> + </dependency> + <dependency> <groupId>org.jline</groupId> <artifactId>jline-reader</artifactId> </dependency>

diff --git a/builtins/src/main/java/org/jline/builtins/Nano.java b/builtins/src/main/java/org/jline/builtins/Nano.java --- a/builtins/src/main/java/org/jline/builtins/Nano.java +++ b/builtins/src/main/java/org/jline/builtins/Nano.java @@ -import java.util.regex.Pattern; +import com.google.re2j.Pattern;

If a dependency change is not acceptable, a fallback mitigation is to reject dangerous regex constructs or execute regex matching with a strict timeout, but that is weaker than replacing the backtracking engine.

Credits

This issue was identified by Michał Majchrowicz and Marcin Wyczechowski, members of the AFINE Team.

Other sources

JLine is a Java library for handling console input. From 3.0.0 until 3.30.15 and 4.3.1, the JLine built-in nano editor's regex search mode passes a user-controlled search term from doSearch(String text) in builtins/src/main/java/org/jline/builtins/Nano.java to Java's backtracking regular expression engine without a timeout or backtracking bound. A nested-quantifier expression evaluated against non-matching buffer content can consume excessive CPU and indefinitely block the editor session thread, and remote multi-user deployments can lose a worker thread for each affected session. This issue is fixed in versions 3.30.15 and 4.3.1.

MITRE

Affected Software

2 affected componentsFixes available
maven/org.jline:jline-builtins>=3.0.0<3.30.15
3.30.15
maven/org.jline:jline-builtins>=4.0.0<4.3.1
4.3.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade maven/org.jline:jline-builtins to a version that resolves this vulnerability.

    Fixed in 3.30.15
  2. Upgrade

    Upgrade maven/org.jline:jline-builtins to a version that resolves this vulnerability.

    Fixed in 4.3.1
  3. Upgrade

    Upgrade org.jline/jline-builtins to a version that resolves this vulnerability.

    Fixed in 3.30.15
  4. Upgrade

    Upgrade com.google.re2j/re2j to a version that resolves this vulnerability.

    Fixed in 1.8
  5. Compensating control

    If replacing the regex engine is not acceptable, reject dangerous nested-quantifier regex constructs or enforce a strict timeout on regex matching in the nano editor search implementation.

Event History

Sep 23, 2026
CVE Published
via MITRE·06:07 PM
Data Sourced
via MITRE·06:07 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·06:12 PM
Data Sourced
via GitHub·06:12 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

When is an editor session exposed to this issue?

The issue is exposed only when regex search mode is enabled in the JLine3 nano editor. With regex mode disabled, the search term is compiled using Pattern.LITERAL rather than treated as a regular expression.

2

What is required to trigger the denial of service?

A user needs to enter a crafted Java regular expression, such as a nested-quantifier pattern, and search buffer content that causes the expression not to match efficiently. The resulting backtracking can consume high CPU and hang the editor session thread.

3

What can be done if an update is not immediately available?

Keep regex search mode disabled and use literal searches. This prevents search input from being compiled as a raw Java regular expression.

4

How might an affected session appear?

An affected editor session may become unresponsive while using high CPU after a regex search is run. The described impact is denial of service for that editor session.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203