GHSA-5q95-hrpc-m3w3

Suggest an improvement
Source
https://github.com/advisories/GHSA-5q95-hrpc-m3w3
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-5q95-hrpc-m3w3/GHSA-5q95-hrpc-m3w3.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-5q95-hrpc-m3w3
Aliases
  • CVE-2026-77420
Published
2026-09-23T18:12:05Z
Modified
2026-09-23T18:15:03Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
JLine: ReDoS via `HISTORY_IGNORE` Configuration Variable
Details

Summary

The JLine3 HISTORY_IGNORE variable is converted into a Java regular expression with only partial escaping. As a result, regex metacharacters other than * and : are passed through to the regex engine. A crafted value such as (a+)+b can cause catastrophic backtracking each time a command line is added to history, hanging the reader thread at high CPU.

Details

In reader/src/main/java/org/jline/reader/impl/history/DefaultHistory.java, matchPatterns() converts HISTORY_IGNORE into a regex:

for (int i = 0; i < patterns.length(); i++) {
    char ch = patterns.charAt(i);
    if (ch == '\\') {
        ch = patterns.charAt(++i);
        sb.append(ch);
    } else if (ch == ':') {
        sb.append('|');
    } else if (ch == '*') {
        sb.append('.').append('*');
    } else {
        sb.append(ch);
    }
}
return line.matches(sb.toString());

This logic translates wildcard syntax but does not escape regex metacharacters such as (, ), +, ?, {, }, [, and ]. Those characters therefore reach the Java regex engine unchanged.

Affected source location:

  • reader/src/main/java/org/jline/reader/impl/history/DefaultHistory.java
  • matchPatterns(String patterns, String line)

PoC

  1. Configure HISTORY_IGNORE to a malicious pattern, for example:
set history-ignore "(a+)+b"
  1. At the JLine prompt, enter a long non-matching line:
aaaaaaaaaaaaaaaaaaaaaaaaaaax
  1. Press Enter.

Expected result:

  • The prompt does not return.
  • The reader 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. Applications embedding org.jline:jline-reader are impacted if they allow HISTORY_IGNORE to be configured through user configuration or application settings. The issue is lower severity than the interactive editor findings because the attacker must control configuration, but it can still reliably hang a reader session.

Suggested Fix

The safest fix for the current git head is to stop treating arbitrary HISTORY_IGNORE content as a regex. Instead, escape all characters by default and translate only the intended JLine wildcard syntax (*) and separator syntax (:).

Suggested patch:

diff --git a/reader/src/main/java/org/jline/reader/impl/history/DefaultHistory.java b/reader/src/main/java/org/jline/reader/impl/history/DefaultHistory.java
--- a/reader/src/main/java/org/jline/reader/impl/history/DefaultHistory.java
+++ b/reader/src/main/java/org/jline/reader/impl/history/DefaultHistory.java
@@
         StringBuilder sb = new StringBuilder();
         for (int i = 0; i < patterns.length(); i++) {
             char ch = patterns.charAt(i);
             if (ch == '\\') {
                 ch = patterns.charAt(++i);
-                sb.append(ch);
+                sb.append(Pattern.quote(Character.toString(ch)));
             } else if (ch == ':') {
                 sb.append('|');
             } else if (ch == '*') {
                 sb.append('.').append('*');
             } else {
-                sb.append(ch);
+                sb.append(Pattern.quote(Character.toString(ch)));
             }
         }
         return line.matches(sb.toString());

Credits

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

Database specific
{
    "cwe_ids":  [
        "CWE-1333"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-09-23T18:12:05Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

Maven / org.jline:jline-reader

Package

Name
org.jline:jline-reader
View open source insights on deps.dev
Purl
pkg:maven/org.jline/jline-reader

Affected ranges

Type
ECOSYSTEM
Events
Introduced
4.0.0
Fixed
4.3.1

Affected versions

4.*
4.0.0
4.0.2
4.0.3
4.0.4
4.0.5
4.0.6
4.0.7
4.0.8
4.0.9
4.0.10
4.0.11
4.0.12
4.0.13
4.0.14
4.0.15
4.0.16
4.1.0
4.1.1
4.1.2
4.1.3
4.2.0
4.2.1
4.3.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-5q95-hrpc-m3w3/GHSA-5q95-hrpc-m3w3.json"

Maven / org.jline:jline-reader

Package

Name
org.jline:jline-reader
View open source insights on deps.dev
Purl
pkg:maven/org.jline/jline-reader

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.0.0
Fixed
3.30.15

Affected versions

3.*
3.2.0
3.3.0
3.3.1
3.4.0
3.5.0
3.5.1
3.5.2
3.6.0
3.6.1
3.6.2
3.7.0
3.7.1
3.8.0
3.8.1
3.8.2
3.9.0
3.10.0
3.11.0
3.12.0
3.12.1
3.13.0
3.13.1
3.13.2
3.13.3
3.14.0
3.14.1
3.15.0
3.16.0
3.17.0
3.17.1
3.18.0
3.19.0
3.20.0
3.21.0
3.22.0
3.23.0
3.24.0
3.24.1
3.25.0
3.25.1
3.26.0
3.26.1
3.26.2
3.26.3
3.27.0
3.27.1
3.28.0
3.29.0
3.30.0
3.30.1
3.30.2
3.30.3
3.30.4
3.30.5
3.30.6
3.30.7
3.30.8
3.30.9
3.30.10
3.30.11
3.30.12
3.30.13
3.30.14

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-5q95-hrpc-m3w3/GHSA-5q95-hrpc-m3w3.json"