Home/Research/Post

GHSA-2v9w-34q6-wpqx: jline3 leads to ReDoS in Built-in Less Viewer Search

  • Severity: HIGH
  • CVE: CVE-2026-77423
  • Ecosystems: maven, maven
  • Packages: org.jline:jline-builtins, org.jline:jline-builtins

### 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…

Source: GitHub Security Advisories · 2026-11-23