HIGH · CVSS 3.1 7.5 EPSS 0.7% · 49th percentile CWE-1333

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

Published 2026-11-23 · Updated 2026-11-23 · Also known as GHSA-2v9w-34q6-wpqx

Summary

The JLine3 built-in less pager is vulnerable to Regular Expression Denial of Service (ReDoS) due to the use of an unconstrained Java regex engine on user-supplied search strings. Developers embedding the jline-builtins library should update to the provided fixed versions to mitigate potential thread exhaustion.

Who is affected

Applications utilizing org.jline:jline-builtins that expose the less viewer are susceptible to resource exhaustion if user input is provided as a malicious regex pattern. This vulnerability is particularly critical in multi-user environments like Telnet or SSH services, where an attacker can trigger catastrophic backtracking to hang a thread and potentially deplete the application's session worker pool.

Exploitability

The vulnerability has a high CVSS base score of 7.5, reflecting its potential to cause a complete denial of service via simple network-based interaction without prior authentication or user intervention. The EPSS score is 0.005, indicating a low current probability of widespread exploitation, and the issue is not currently listed in the CISA Known Exploited Vulnerabilities catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-23. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
Maven org.jline:jline-builtins >= 0, < 3.30.15 3.30.15 -
Maven org.jline:jline-builtins >= 4.0.0, < 4.3.1 4.3.1 -

CVSS 3.1 vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Attack vectorNetwork
Attack complexityLow
Privileges requiredNone
User interactionNone
ScopeUnchanged
ConfidentialityNone
IntegrityNone
AvailabilityHigh

FAQ

What specifically triggers the ReDoS condition?

The vulnerability is triggered by providing complex, nested regex patterns (e.g., (a+)+b) into the less viewer's search or display-filter functions, which triggers exponential backtracking in the Java standard regex engine.

Is this vulnerability limited to local usage?

No. While it can hang a local session, it is significantly more dangerous in network-exposed deployments like Telnet or SSH, where an attacker can exploit the vulnerability to exhaust server worker threads.

Is there active exploitation of this vulnerability currently?

No. CISA Known Exploited Vulnerabilities status is currently 'no'.

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

References

Source records: GHSA-2v9w-34q6-wpqx (OSV.dev) · EPSS by FIRST, 2026-11-26.