
Loading

Loading
We use strictly necessary cookies to run this site, and analytics cookies to understand how it's used. See our Privacy Policy for details.
A GitHub-reviewed security advisory, not necessarily under active exploitation the way our CISA KEV advisories are, but a real, disclosed vulnerability in an open-source dependency.
Affected packages
Vulnerable: < 3.30.15
Patched in 3.30.15
Vulnerable: >= 4.0.0, < 4.3.1
Patched in 4.3.1
Details
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.
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)compiled.matcher(line).find()a characters:printf 'aaaaaaaaaaaaaaaaaaaaaaaaa\n' > /tmp/testfile.txt
less viewer./ to enter search mode.(a+)+b and press Enter.Expected result:
less session stops responding.Variation:
& because
that path also compiles user input as a raw Java regex.Reproduction environment:
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.
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.
This issue was identified by Michał Majchrowicz and Marcin Wyczechowski, members of the AFINE Team.
EPSS, exploit probability
Low0.46%
estimated chance of real-world exploitation in the next 30 days, higher than 40.8% of every CVE FIRST.org scores
Refreshed 11/23/2026, via FIRST.org's EPSS model, not CVSS, this measures likelihood of exploitation, not how severe it would be.
More maven advisories
Talk to us about this
Find out whether this dependency (or others like it) is actually reachable in your codebase.
Get help patching, or building dependency-scanning into your pipeline going forward.
A secure code review or supply chain review finds this before an advisory does.