Every CVE Search/ Get API key

CVE-2026-77422

JLine: ReDoS in Built-in grep Command Amplified by Automatic `.*` Wrapping

7.5 HighFix available

JLine is a Java library for handling console input. From 3.0.0 until 3.30.15 and 4.3.1, the JLine built-in grep command in builtins/src/main/java/org/jline/builtins/PosixCommands.java accepts a user-controlled regular expression in grep(...) and, unless line-regexp mode is used, automatically adds a dot-star prefix and suffix before compiling it with Java's backtracking regular expression engine. The wrapping expands the backtracking search space, so a short nested-quantifier expression evaluated against non-matching input can consume excessive CPU and indefinitely block a command worker, including in remotely exposed shell sessions. This issue is fixed in versions 3.30.15 and 4.3.1.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
High

Exploit likelihood

0.60%Up 0.1 points since Sep 24, 2026
90%50%10%1%

What each source reports

CVE List Score used 7.5

JLine: ReDoS in Built-in grep Command Amplified by Automatic `.*` Wrapping

JLine is a Java library for handling console input. From 3.0.0 until 3.30.15 and 4.3.1, the JLine built-in grep command in builtins/src/main/java/org/jline/builtins/PosixCommands.java accepts a user-controlled regular expression in grep(...) and, unless line-regexp mode is used, automatically adds a dot-star prefix and suffix before compiling it with Java's backtracking regular expression engine. The wrapping expands the backtracking search space, so a short nested-quantifier expression evaluated against non-matching input can consume excessive CPU and indefinitely block a command worker, including in remotely exposed shell sessions. This issue is fixed in versions 3.30.15 and 4.3.1.

Record
CVE-2026-77422
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-1333
Updated
2026-11-02
EUVDEUVD-2026-85527 7.5

JLine is a Java library for handling console input. From 3.0.0 until 3.30.15 and 4.3.1, the JLine built-in grep command in builtins/src/main/java/org/jline/builtins/PosixCommands.java accepts a user-controlled regular expression in grep(...) and, unless line-regexp mode is used, automatically adds a dot-star prefix and suffix before compiling it with Java's backtracking regular expression engine. The wrapping expands the backtracking search space, so a short nested-quantifier expression evaluated against non-matching input can consume excessive CPU and indefinitely block a command worker, including in remotely exposed shell sessions. This issue is fixed in versions 3.30.15 and 4.3.1.

Record
EUVD-2026-85527
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-r2xf-8xr9-62gw 7.5

JLine: ReDoS in Built-in grep Command Amplified by Automatic `.*` Wrapping

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:

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:
printf 'aaaaaaaaaaaaaaaaaaaaaaa\n' > /tmp/testfile.txt
  1. Run JLine3's built-in grep against that file:
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 searches as .*...*
  • use Matcher.find() for substring semantics
  • compile user patterns with 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/PosixCommands.java b/builtins/src/main/java/org/jline/builtins/PosixCommands.java
--- a/builtins/src/main/java/org/jline/builtins/PosixCommands.java
+++ b/builtins/src/main/java/org/jline/builtins/PosixCommands.java
@@
-import java.util.regex.Pattern;
+import com.google.re2j.Pattern;
@@
         if (opt.isSet("line-regexp")) {
             regexp = "^" + regexp + "$";
-        } else {
-            regexp = ".*" + regexp + ".*";
         }
@@
-        boolean m = p.matcher(line).matches();
+        boolean m = opt.isSet("line-regexp")
+                ? p.matcher(line).matches()
+                : p.matcher(line).find();

Credits

This issue was identified by Michał Majchrowicz and Marcin Wyczechowski, members of the AFINE Team.

Record
GHSA-r2xf-8xr9-62gw
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-1333
Updated
2026-11-02
NVD 7.5

JLine is a Java library for handling console input. From 3.0.0 until 3.30.15 and 4.3.1, the JLine built-in grep command in builtins/src/main/java/org/jline/builtins/PosixCommands.java accepts a user-controlled regular expression in grep(...) and, unless line-regexp mode is used, automatically adds a dot-star prefix and suffix before compiling it with Java's backtracking regular expression engine. The wrapping expands the backtracking search space, so a short nested-quantifier expression evaluated against non-matching input can consume excessive CPU and indefinitely block a command worker, including in remotely exposed shell sessions. This issue is fixed in versions 3.30.15 and 4.3.1.

Record
CVE-2026-77422
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-1333
Updated
2026-11-02
OSV 7.5

JLine: ReDoS in Built-in grep Command Amplified by Automatic `.*` Wrapping

JLine is a Java library for handling console input. From 3.0.0 until 3.30.15 and 4.3.1, the JLine built-in grep command in builtins/src/main/java/org/jline/builtins/PosixCommands.java accepts a user-controlled regular expression in grep(...) and, unless line-regexp mode is used, automatically adds a dot-star prefix and suffix before compiling it with Java's backtracking regular expression engine. The wrapping expands the backtracking search space, so a short nested-quantifier expression evaluated against non-matching input can consume excessive CPU and indefinitely block a command worker, including in remotely exposed shell sessions. This issue is fixed in versions 3.30.15 and 4.3.1.

Record
CVE-2026-77422
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-1333
Updated
2026-11-02
OSVDEBIAN-CVE-2026-77422 7.5

JLine is a Java library for handling console input. From 3.0.0 until 3.30.15 and 4.3.1, the JLine built-in grep command in builtins/src/main/java/org/jline/builtins/PosixCommands.java accepts a user-controlled regular expression in grep(...) and, unless line-regexp mode is used, automatically adds a dot-star prefix and suffix before compiling it with Java's backtracking regular expression engine. The wrapping expands the backtracking search space, so a short nested-quantifier expression evaluated against non-matching input can consume excessive CPU and indefinitely block a command worker, including in remotely exposed shell sessions. This issue is fixed in versions 3.30.15 and 4.3.1.

Record
DEBIAN-CVE-2026-77422
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVGHSA-r2xf-8xr9-62gw 7.5

JLine: ReDoS in Built-in grep Command Amplified by Automatic `.*` Wrapping

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:

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:
printf 'aaaaaaaaaaaaaaaaaaaaaaa\n' > /tmp/testfile.txt
  1. Run JLine3's built-in grep against that file:
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 searches as .*...*
  • use Matcher.find() for substring semantics
  • compile user patterns with 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/PosixCommands.java b/builtins/src/main/java/org/jline/builtins/PosixCommands.java
--- a/builtins/src/main/java/org/jline/builtins/PosixCommands.java
+++ b/builtins/src/main/java/org/jline/builtins/PosixCommands.java
@@
-import java.util.regex.Pattern;
+import com.google.re2j.Pattern;
@@
         if (opt.isSet("line-regexp")) {
             regexp = "^" + regexp + "$";
-        } else {
-            regexp = ".*" + regexp + ".*";
         }
@@
-        boolean m = p.matcher(line).matches();
+        boolean m = opt.isSet("line-regexp")
+                ? p.matcher(line).matches()
+                : p.matcher(line).find();

Credits

This issue was identified by Michał Majchrowicz and Marcin Wyczechowski, members of the AFINE Team.

Record
GHSA-r2xf-8xr9-62gw
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-1333
Updated
2026-11-02
OSVUBUNTU-CVE-2026-77422 7.5

JLine is a Java library for handling console input. From 3.0.0 until 3.30.15 and 4.3.1, the JLine built-in grep command in builtins/src/main/java/org/jline/builtins/PosixCommands.java accepts a user-controlled regular expression in grep(...) and, unless line-regexp mode is used, automatically adds a dot-star prefix and suffix before compiling it with Java's backtracking regular expression engine. The wrapping expands the backtracking search space, so a short nested-quantifier expression evaluated against non-matching input can consume excessive CPU and indefinitely block a command worker, including in remotely exposed shell sessions. This issue is fixed in versions 3.30.15 and 4.3.1.

Record
UBUNTU-CVE-2026-77422
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVROOT-APP-MAVEN-CVE-2026-77422 No score

CVE-2026-77422 in org.jline:jline-builtins - Patched by Root

Root has patched CVE-2026-77422 in the org.jline:jline-builtins package for Root:Maven. Multiple fixed versions available.

Record
ROOT-APP-MAVEN-CVE-2026-77422
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
org.jline:jline-builtins
Maven
4.0.0 up to 4.3.1
4.3.1
org.jline:jline-builtins
Maven
3.0.0 up to 3.30.15
3.30.15
jline3
Debian:12
All versions, plus listed versions
3.3.1-33.3.1-43.3.1-5
None known
jline3
Debian:13
All versions, plus listed versions
3.3.1-43.3.1-5
None known
jline3
Debian:14
All versions, plus listed versions
3.3.1-43.3.1-5
None known
org.jline:jline-builtins
Maven
4.0.0 up to 4.3.1, plus listed versions
4.0.104.0.114.0.124.0.134.0.14
Show 17 moreShow less
4.0.154.0.164.0.24.0.34.0.44.0.54.0.64.0.74.0.84.0.94.1.04.1.14.1.24.1.34.2.04.2.14.3.0
4.3.1
org.jline:jline-builtins
Maven
3.0.0 up to 3.30.15, plus listed versions
3.10.03.11.03.12.03.12.13.13.0
Show 45 moreShow less
3.13.13.13.23.13.33.14.03.14.13.15.03.16.03.17.03.17.13.18.03.19.03.2.03.20.03.21.03.22.03.23.03.24.03.24.13.25.03.25.13.26.03.26.13.26.23.26.33.27.03.27.13.28.03.29.03.3.03.3.13.30.03.30.13.30.103.30.113.30.123.30.133.30.143.30.23.30.33.30.43.30.53.30.63.30.73.30.83.30.9
3.30.15
org.jline:jline-builtins
Root:Maven
before 3.25.1-aikido.3
3.25.1-aikido.33.25.1-aikido.4
io.root.org.jline:jline-builtins
Root:Maven
before 3.25.1-root.io.3
3.25.1-root.io.33.25.1-root.io.4
jline
Ubuntu:14.04:LTS
All versions, plus listed versions
1.0-2
None known
Show 19 moreShow less
Affected packages
PackageAffectedFixed
jline2
Ubuntu:14.04:LTS
All versions, plus listed versions
2.11-12.11-2
None known
jline
Ubuntu:16.04:LTS
All versions, plus listed versions
1.0-2
None known
jline2
Ubuntu:16.04:LTS
All versions, plus listed versions
2.11-4
None known
jline
Ubuntu:18.04:LTS
All versions, plus listed versions
1.0-2
None known
jline2
Ubuntu:18.04:LTS
All versions, plus listed versions
2.11-42.12.1-12.14.6-1
None known
jline
Ubuntu:20.04:LTS
All versions, plus listed versions
1.0-2
None known
jline2
Ubuntu:20.04:LTS
All versions, plus listed versions
2.14.6-3
None known
jline
Ubuntu:22.04:LTS
All versions, plus listed versions
1.0-3
None known
jline2
Ubuntu:22.04:LTS
All versions, plus listed versions
2.14.6-4
None known
jline3
Ubuntu:22.04:LTS
All versions, plus listed versions
3.3.1-2
None known
jline
Ubuntu:24.04:LTS
All versions, plus listed versions
1.0-3
None known
jline2
Ubuntu:24.04:LTS
All versions, plus listed versions
2.14.6-5
None known
jline3
Ubuntu:24.04:LTS
All versions, plus listed versions
3.3.1-33.3.1-3ubuntu1
None known
jline
Ubuntu:26.10
All versions, plus listed versions
1.0-3build1
None known
jline2
Ubuntu:26.10
All versions, plus listed versions
2.14.6-6
None known
jline3
Ubuntu:26.10
All versions, plus listed versions
3.3.1-4build13.3.1-5
None known
jline
Ubuntu:26.04:LTS
All versions, plus listed versions
1.0-31.0-3build1
None known
jline2
Ubuntu:26.04:LTS
All versions, plus listed versions
2.14.6-6
None known
jline3
Ubuntu:26.04:LTS
All versions, plus listed versions
3.3.1-43.3.1-4build1
None known

History

History
RecordedChangedSources
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2026-77422 is a high vulnerability (CVSS 7.5) in Jline Jline3, published September 23, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.60%, the 48th percentile. Fixed in org.jline:jline-builtins 4.3.1.

References

Show 8 moreShow less
This page doesn't list everything

Left out here: 13 versions. The JSON record has them.

MoveEnter Open