# CVE-2026-77423: jline3 leads to ReDoS in Built-in Less Viewer Search

- **Severity:** HIGH 7.5
- **CVSS:** 7.5 (v3.1, GitHub) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.70% (percentile 49, 2026-11-29)
- **CWE:** CWE-1333
- **Aliases:** GHSA-2v9w-34q6-wpqx
- **Published:** 2026-11-23T21:02:03.000Z
- **Modified:** 2026-11-23T21:02:06.000Z

## Who should check

- Projects that depend on Maven package org.jline:jline-builtins (\< 3.30.15)

## Description

\#\#\# Summary

The JLine3 built-in \`less\` pager compiles user-supplied search patterns directly as
Java regular expressions with no sanitization, timeout, or backtracking bound. A
malicious pattern such as \`(a+)+b\` can trigger catastrophic backtracking and hang the
session thread at 100% CPU. In deployments that expose \`less\` over Telnet or SSH,
this becomes a denial-of-service issue for the affected session and can be used to
exhaust a bounded session pool.

\#\#\# Details

\`Less.getPattern()\` in \`builtins/src/main/java/org/jline/builtins/Less.java\` compiles
the user-controlled search string directly with \`Pattern.compile()\`:

\`\`\`java
private Pattern getPattern(boolean doDisplayPattern) {
    Pattern compiled = null;
    String \_pattern = doDisplayPattern ? displayPattern : pattern;
    if (\_pattern != null) {
        boolean insensitive =
                ignoreCaseAlways \|\| ignoreCaseCond && \_pattern.toLowerCase().equals(\_pattern);
        compiled = Pattern.compile(
                "(" + \_pattern + ")", insensitive ? Pattern.CASE\_INSENSITIVE \| Pattern.UNICODE\_CASE : 0);
    }
    return compiled;
}
\`\`\`

The resulting pattern is then applied repeatedly against file content with
\`compiled.matcher(line).find()\` in the \`less\` search path. Because Java's
\`java.util.regex\` engine is backtracking-based and has no built-in timeout, patterns
with nested quantifiers can take exponential time on non-matching input.

Affected source locations:
- \`builtins/src/main/java/org/jline/builtins/Less.java\`
- \`getPattern(boolean doDisplayPattern)\`
- search callers using \`compiled.matcher(line).find()\`

\#\#\# PoC

1. Create a file with a long run of \`a\` characters:

\`\`\`sh
printf 'aaaaaaaaaaaaaaaaaaaaaaaaa\\n' \> /tmp/testfile.txt
\`\`\`

2. Open the file with the JLine3 \`less\` viewer.
3. Press \`/\` to enter search mode.
4. Enter the pattern \`(a+)+b\` and press Enter.

Expected result:
- The \`less\` session stops responding.
- The session thread consumes high CPU.

Variation:
- The same behavior can be triggered through the display-filter path using \`&\` because
  that path also compiles user input as a raw Java regex.

Reproduction environment:
- JLine3 on x86\_64 Linux
- OpenJDK 25.0.2

\#\#\# Impact

This is a denial-of-service vulnerability caused by catastrophic regex backtracking.
Any application embedding \`org.jline:jline-builtins\` and exposing the \`less\` viewer
is impacted. In local use, the affected user can hang their own session. In multi-user
Telnet or SSH deployments, one attacker can occupy one session thread indefinitely and
multiple attackers or sessions can exhaust the server's available worker pool.

\#\#\# Suggested Fix

The preferred fix for the current git head is to move user-controlled regex matching
to a linear-time engine such as RE2/J.

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/Less.java b/builtins/src/main/java/org/jline/builtins/Less.java
--- a/builtins/src/main/java/org/jline/builtins/Less.java
+++ b/builtins/src/main/java/org/jline/builtins/Less.java
@@
-import java.util.regex.Pattern;
+import com.google.re2j.Pattern;
@@
         if (\_pattern != null) {
             boolean insensitive =
                     ignoreCaseAlways \|\| ignoreCaseCond && \_pattern.toLowerCase().equals(\_pattern);
             compiled = Pattern.compile(
                     "(" + \_pattern + ")",
                     insensitive ? Pattern.CASE\_INSENSITIVE \| Pattern.UNICODE\_CASE : 0);
         }
\`\`\`

If introducing RE2/J is not acceptable, a weaker fallback is to perform regex matching
in a worker with a strict timeout and reject patterns that exceed the time budget.

\#\#\# Credits

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

## Affected and fixed versions

- Maven `org.jline:jline-builtins`: affected \< 3.30.15; fixed 3.30.15, 4.3.1 (ghsa)

## Technologies

Maven packages

## Mitigation

- Upgrade org.jline:jline-builtins to one of 3.30.15, 4.3.1 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-77423. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-77423.md
Affected: org.jline:jline-builtins < 3.30.15
Fixed in: 3.30.15, 4.3.1

Steps:
1. Search this machine and project for org.jline:jline-builtins (Maven): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-77423 being exploited?

There is no confirmed exploitation: CVE-2026-77423 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.70% chance of exploitation in the next 30 days (as of 2026-11-29).

### How serious is CVE-2026-77423?

High: CVSS 7.5 (v3.1, scored by GitHub). Remote, no login needed.

### Which versions are affected by CVE-2026-77423?

org.jline:jline-builtins \< 3.30.15.

### Is there a fix for CVE-2026-77423?

Yes. Fixed in 3.30.15, 4.3.1. Upgrade org.jline:jline-builtins to one of 3.30.15, 4.3.1 (or later in the same release line).

### How do I check if I'm affected by CVE-2026-77423?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/jline/jline3/security/advisories/GHSA-2v9w-34q6-wpqx>
- patch: <https://github.com/jline/jline3/pull/2012>
- patch: <https://github.com/jline/jline3/pull/2018>
- patch: <https://github.com/jline/jline3/commit/1d5fc3099e77938b971e197211cad2d4fbb17541>
- patch: <https://github.com/jline/jline3/commit/341ee69ccc57b7733c1b40d6993219b64b3206ae>
- other: <https://nvd.nist.gov/vuln/detail/CVE-2026-77423>
- other: <https://github.com/jline/jline3/releases/tag/4.3.1>
- other: <https://github.com/jline/jline3/releases/tag/jline-3.30.15>
- other: <https://github.com/advisories/GHSA-2v9w-34q6-wpqx>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- GitHub Advisory Database: CC-BY 4.0 <https://github.com/advisories/GHSA-2v9w-34q6-wpqx> (license: <https://creativecommons.org/licenses/by/4.0/>)
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-77423> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-77423>
