GHSA-2V9W-34Q6-WPQX
Vulnerability from github – Published: 2026-11-23 21:02 – Updated: 2026-11-23 21:02Summary
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.java
- getPattern(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 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 --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": [
{
"package": {
"ecosystem": "Maven",
"name": "org.jline:jline-builtins"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "3.30.15"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.jline:jline-builtins"
},
"ranges": [
{
"events": [
{
"introduced": "4.0.0"
},
{
"fixed": "4.3.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-77423"
],
"database_specific": {
"cwe_ids": [
"CWE-1333"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-23T21:02:03Z",
"nvd_published_at": "2026-09-23T19:19:16Z",
"severity": "HIGH"
},
"details": "### Summary\n\nThe JLine3 built-in `less` pager compiles user-supplied search patterns directly as\nJava regular expressions with no sanitization, timeout, or backtracking bound. A\nmalicious pattern such as `(a+)+b` can trigger catastrophic backtracking and hang the\nsession thread at 100% CPU. In deployments that expose `less` over Telnet or SSH,\nthis becomes a denial-of-service issue for the affected session and can be used to\nexhaust a bounded session pool.\n\n### Details\n\n`Less.getPattern()` in `builtins/src/main/java/org/jline/builtins/Less.java` compiles\nthe user-controlled search string directly with `Pattern.compile()`:\n\n```java\nprivate Pattern getPattern(boolean doDisplayPattern) {\n Pattern compiled = null;\n String _pattern = doDisplayPattern ? displayPattern : pattern;\n if (_pattern != null) {\n boolean insensitive =\n ignoreCaseAlways || ignoreCaseCond \u0026\u0026 _pattern.toLowerCase().equals(_pattern);\n compiled = Pattern.compile(\n \"(\" + _pattern + \")\", insensitive ? Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE : 0);\n }\n return compiled;\n}\n```\n\nThe resulting pattern is then applied repeatedly against file content with\n`compiled.matcher(line).find()` in the `less` search path. Because Java\u0027s\n`java.util.regex` engine is backtracking-based and has no built-in timeout, patterns\nwith nested quantifiers can take exponential time on non-matching input.\n\nAffected source locations:\n- `builtins/src/main/java/org/jline/builtins/Less.java`\n- `getPattern(boolean doDisplayPattern)`\n- search callers using `compiled.matcher(line).find()`\n\n### PoC\n\n1. Create a file with a long run of `a` characters:\n\n```sh\nprintf \u0027aaaaaaaaaaaaaaaaaaaaaaaaa\\n\u0027 \u003e /tmp/testfile.txt\n```\n\n2. Open the file with the JLine3 `less` viewer.\n3. Press `/` to enter search mode.\n4. Enter the pattern `(a+)+b` and press Enter.\n\nExpected result:\n- The `less` session stops responding.\n- The session thread consumes high CPU.\n\nVariation:\n- The same behavior can be triggered through the display-filter path using `\u0026` because\n that path also compiles user input as a raw Java regex.\n\nReproduction environment:\n- JLine3 on x86_64 Linux\n- OpenJDK 25.0.2\n\n### Impact\n\nThis is a denial-of-service vulnerability caused by catastrophic regex backtracking.\nAny application embedding `org.jline:jline-builtins` and exposing the `less` viewer\nis impacted. In local use, the affected user can hang their own session. In multi-user\nTelnet or SSH deployments, one attacker can occupy one session thread indefinitely and\nmultiple attackers or sessions can exhaust the server\u0027s available worker pool.\n\n### Suggested Fix\n\nThe preferred fix for the current git head is to move user-controlled regex matching\nto a linear-time engine such as RE2/J.\n\nSuggested patch:\n\n```diff\ndiff --git a/builtins/pom.xml b/builtins/pom.xml\n--- a/builtins/pom.xml\n+++ b/builtins/pom.xml\n@@\n \u003cdependency\u003e\n+ \u003cgroupId\u003ecom.google.re2j\u003c/groupId\u003e\n+ \u003cartifactId\u003ere2j\u003c/artifactId\u003e\n+ \u003cversion\u003e1.8\u003c/version\u003e\n+ \u003c/dependency\u003e\n+ \u003cdependency\u003e\n \u003cgroupId\u003eorg.jline\u003c/groupId\u003e\n \u003cartifactId\u003ejline-reader\u003c/artifactId\u003e\n \u003c/dependency\u003e\n\ndiff --git a/builtins/src/main/java/org/jline/builtins/Less.java b/builtins/src/main/java/org/jline/builtins/Less.java\n--- a/builtins/src/main/java/org/jline/builtins/Less.java\n+++ b/builtins/src/main/java/org/jline/builtins/Less.java\n@@\n-import java.util.regex.Pattern;\n+import com.google.re2j.Pattern;\n@@\n if (_pattern != null) {\n boolean insensitive =\n ignoreCaseAlways || ignoreCaseCond \u0026\u0026 _pattern.toLowerCase().equals(_pattern);\n compiled = Pattern.compile(\n \"(\" + _pattern + \")\",\n insensitive ? Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE : 0);\n }\n```\n\nIf introducing RE2/J is not acceptable, a weaker fallback is to perform regex matching\nin a worker with a strict timeout and reject patterns that exceed the time budget.\n\n### Credits\n\nThis issue was identified by Micha\u0142 Majchrowicz and Marcin Wyczechowski, members of the AFINE Team.",
"id": "GHSA-2v9w-34q6-wpqx",
"modified": "2026-11-23T21:02:03Z",
"published": "2026-11-23T21:02:03Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/jline/jline3/security/advisories/GHSA-2v9w-34q6-wpqx"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-77423"
},
{
"type": "WEB",
"url": "https://github.com/jline/jline3/pull/2012"
},
{
"type": "WEB",
"url": "https://github.com/jline/jline3/pull/2018"
},
{
"type": "WEB",
"url": "https://github.com/jline/jline3/commit/1d5fc3099e77938b971e197211cad2d4fbb17541"
},
{
"type": "WEB",
"url": "https://github.com/jline/jline3/commit/341ee69ccc57b7733c1b40d6993219b64b3206ae"
},
{
"type": "PACKAGE",
"url": "https://github.com/jline/jline3"
},
{
"type": "WEB",
"url": "https://github.com/jline/jline3/releases/tag/4.3.1"
},
{
"type": "WEB",
"url": "https://github.com/jline/jline3/releases/tag/jline-3.30.15"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "jline3 leads to ReDoS in Built-in Less Viewer Search"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.