CVE-2026-77421

CVE-2026-77421 is a medium-severity inefficient regular expression (ReDoS) vulnerability in org.jline:jline-builtins (maven), affecting versions >= 4.0.0, < 4.3.1. It is fixed in 4.3.1, 3.30.15.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

JLine: ReDoS in Nano Editor Regex Search Mode

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:

Pattern pat = Pattern.compile(
        searchTerm,
        (searchCaseSensitive ? 0 : Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)
                | (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 x86_64 Linux
  • OpenJDK 25.0.2

Credits

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

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.

A regular expression with worst-case exponential or polynomial matching time is applied to untrusted input, causing excessive CPU use. Typical impact: denial of service when input is crafted to trigger backtracking.

CVE-2026-77421 has a CVSS score of 6.5 (Medium). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.3.1, 3.30.15); upgrading removes the vulnerable code path.

Affected versions

org.jline:jline-builtins (>= 4.0.0, < 4.3.1) org.jline:jline-builtins (>= 3.0.0, < 3.30.15)

Security releases

org.jline:jline-builtins → 4.3.1 (maven) org.jline:jline-builtins → 3.30.15 (maven)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

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

Frequently Asked Questions

  1. What is CVE-2026-77421? CVE-2026-77421 is a medium-severity inefficient regular expression (ReDoS) vulnerability in org.jline:jline-builtins (maven), affecting versions >= 4.0.0, < 4.3.1. It is fixed in 4.3.1, 3.30.15. A regular expression with worst-case exponential or polynomial matching time is applied to untrusted input, causing excessive CPU use.
  2. How severe is CVE-2026-77421? CVE-2026-77421 has a CVSS score of 6.5 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of org.jline:jline-builtins are affected by CVE-2026-77421? org.jline:jline-builtins (maven) versions >= 4.0.0, < 4.3.1 is affected.
  4. Is there a fix for CVE-2026-77421? Yes. CVE-2026-77421 is fixed in 4.3.1, 3.30.15. Upgrade to this version or later.
  5. Is CVE-2026-77421 exploitable, and should I be worried? Whether CVE-2026-77421 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-77421 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-77421?
    • Upgrade org.jline:jline-builtins to 4.3.1 or later
    • Upgrade org.jline:jline-builtins to 3.30.15 or later

Other vulnerabilities in org.jline:jline-builtins

Stop the waste.
Protect your environment with Kodem.