CVE-2026-77423: jline3 leads to ReDoS in Built-in Less Viewer Search
The built-in less pager in org.jline:jline-builtins compiles search patterns as raw Java regular expressions. A pattern such as (a+)+b makes the session thread spin at 100% CPU. Versions before 3.30.15, and 4.0.0 up to before 4.3.1, are affected. Upgrade to 3.30.15 or 4.3.1.
Published Nov 23, 2026 · Analysis Nov 23, 2026
What an attacker can do
Less.getPattern() in the builtins module passes the user's search string to Pattern.compile() with no sanitising, no timeout and no bound on backtracking. The compiled pattern is then run against each line with matcher(line).find(). Java's regex engine backtracks, so nested quantifiers take exponential time on input that does not match. The display-filter path, opened with the & key, compiles input the same way.
The reporters reproduced it with a file of repeated a characters: press / in the viewer, enter (a+)+b, and the session hangs.
A local user only hangs their own session. The risk is in applications that embed jline-builtins and give remote users the less viewer over Telnet or SSH, such as a custom admin shell. One attacker can pin a session thread forever, and several sessions can use up the server's worker pool. The flaw affects availability only. It does not expose data or run code.
Who is affected
org.jline:jline-builtins before 3.30.15 on the 3.x line, and 4.0.0 up to but not including 4.3.1. Only applications that expose the less viewer to users are exposed, and the risk is real mainly when those users are remote. Check your dependency tree:
mvn dependency:tree -Dincludes=org.jline:jline-builtinsFor Gradle, run gradle dependencies and search for jline-builtins. Check shaded jars too.
org.jline:jline-builtins
- Ecosystem
- Maven
- Affected
- < 3.30.15
- Fixed in
- 3.30.15
- Check
mvn dependency:tree -Dincludes=org.jline:jline-builtins
org.jline:jline-builtins
- Ecosystem
- Maven
- Affected
- >= 4.0.0, < 4.3.1
- Fixed in
- 4.3.1
- Check
mvn dependency:tree -Dincludes=org.jline:jline-builtins
How to fix it
Upgrade org.jline:jline-builtins to 3.30.15 on the 3.x line, or to 4.3.1 on the 4.x line. The 3.30.15 release notes say it guards regex matching against catastrophic backtracking with a SafeRegex utility that enforces a wall-clock deadline, and it covers eight places across the terminal, reader and builtins modules. The sources give no workaround. If you cannot upgrade yet, do not expose the less viewer to untrusted remote sessions.
How to tell if you were hit
Look for Java threads stuck inside java.util.regex frames called from org.jline.builtins.Less in thread dumps, and for sessions with one CPU core pinned and no output. In logs, a Telnet or SSH session that stops responding after a search or filter command is the sign. Repeated hangs that grow with the number of connections point to attempts to exhaust the session pool. The sources list no other indicators.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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():
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.javagetPattern(boolean doDisplayPattern)- search callers using
compiled.matcher(line).find()
PoC
- Create a file with a long run of
acharacters:
printf 'aaaaaaaaaaaaaaaaaaaaaaaaa\n' > /tmp/testfile.txt- Open the file with the JLine3
lessviewer. - Press
/to enter search mode. - Enter the pattern
(a+)+band press Enter.
Expected result:
- The
lesssession 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 --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.
Credited to sectroyer.
Questions
- Does CVE-2026-77423 allow code execution?
No. It is a regular expression denial of service, rated for availability impact only. A crafted search pattern hangs the session thread but does not read data or run commands.
- Which jline-builtins versions fix it?
3.30.15 for the 3.x line and 4.3.1 for the 4.x line. Versions below 3.30.15, and 4.0.0 through 4.3.0, are affected.
- Am I affected if I only use JLine for line editing?
The reported flaw is in the less viewer in jline-builtins. If your application does not include that module or does not expose less to users, this path is not reachable. Release notes say other regex spots were also hardened.
References
Read for this analysis:
- https://github.com/jline/jline3/security/advisories/GHSA-2v9w-34q6-wpqx
- https://github.com/jline/jline3/releases/tag/jline-3.30.15
- https://nvd.nist.gov/vuln/detail/CVE-2026-77423
- https://github.com/jline/jline3/pull/2012
- https://github.com/jline/jline3/pull/2018
- https://github.com/jline/jline3/commit/1d5fc3099e77938b971e197211cad2d4fbb17541
- https://github.com/jline/jline3/commit/341ee69ccc57b7733c1b40d6993219b64b3206ae
- https://github.com/jline/jline3/releases/tag/4.3.1
- https://github.com/advisories/GHSA-2v9w-34q6-wpqx
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
