highCVSS 7.5Vulnerability

CVE-2026-77422

### Summary The JLine3 built-in `grep` command wraps the user-supplied regular expression with `.*` before compiling it with Java's backtracking regex engine. This amplifies catastrophic backtracking and allows a short pattern such as `(a+)+b` to hang the command thread on non-matching input. In environments that expose the JLine shell to remote users, this is a denial-of-service issue. ### Details In `builtins/src/main/java/org/jline/builtins/PosixCommands.java`, the grep implementation rewrites the user pattern before compilation: ```java String regex = args.remove(0); String regexp = regex; if (opt.isSet("word-regexp")) { regexp = "\\b" + regexp + "\\b"; } if (opt.isSet("line-regexp")) { regexp = "^" + regexp + "$"; } else { regexp = ".*" + regexp + ".*"; } ``` The transformed pattern is compiled with `Pattern.compile(...)` and then used to test each input line. For a payload such as `(a+)+b`, the automatic `.*` prefix and suffix increase the backtracking search space substantially. Affected source location: - `builtins/src/main/java/org/jline/builtins/PosixCommands.java` - `grep(...)` ### PoC 1. Create a file containing a long run of `a` characters: ```sh printf 'aaaaaaaaaaaaaaaaaaaaaaa\n' > /tmp/testfile.txt ``` 2. Run JLine3's built-in `grep` against that file: ```sh grep '(a+)+b' /tmp/testfile.txt ``` Expected result: - The command stops responding. - The executing thread consumes high CPU. 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 built-in `grep` command is impacted. In remote shell deployments, an attacker can occupy a worker thread indefinitely and repeat the attack across multiple sessions to reduce service availability for other users. ### Suggested Fix The preferred fix for the current git head is: - stop rewriting non-line-regexp searc

Properties

ghsa_id
GHSA-r2xf-8xr9-62gw
summary
JLine: ReDoS in Built-in grep Command Amplified by Automatic `.*` Wrapping
severity
high
cvss_score
7.5
cve_id
CVE-2026-77422
cvss_vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
signal_observed_at
2026-09-23T22:45:22+00:00
is_ghsa_only
false
ghsa_published
2026-09-23T18:12:35Z
source_url
https://github.com/advisories/GHSA-r2xf-8xr9-62gw
ghsa_updated
2026-09-23T18:12:36Z

Related Entities (4)

AFFECTS (1)

[Software]maven/org.jline:jline-builtins

HAS_WEAKNESS (1)

[Weakness]Inefficient Regular Expression Complexity

REPORTED_BY (1)

[Source]GitHub Advisory Database

VULNERABLE_TO (1)

[Software]maven/org.jline:jline-builtins

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-77422 (CVSS 7.5) — Ninja Signal Threat Intelligence | Ninja Signal