Quick answers
- Is CVE-2026-59893 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2026-59893 being exploited in the wild.
- How severe is CVE-2026-59893?
- High severity, with a CVSS score of 7.5, published 17 August 2026.
- Which products and versions are affected?
- sqlparse (PyPI) <= 0.5.6.dev0, ECOSYSTEM:introduced=0,fixed=0.6.0.
- Is there a fix for CVE-2026-59893?
- Yes. sqlparse (PyPI): upgrade to 0.6.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2026-59893 attacked?
- It is attacked over the network, in a software library.
- Am I affected by CVE-2026-59893?
- Check whether you run sqlparse (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- sqlparse (PyPI): upgrade to 0.6.0 or later
pip install "sqlparse>=0.6.0"
Technical details
The vulnerability is a Regular Expression Denial of Service (ReDoS) in the dollar-quoted SQL literal pattern at sqlparse/keywords.py:33. The regex uses a backreference (`\1`) to match closing delimiters: `(r'((?<![\w\"\$])\$(?:[_A-ZÀ-Ü]\w*)?\$)[\s\S]*?\1', tokens.Literal)`. When processing SQL with many unique, unmatched opening dollar-quote sequences (e.g., `$a0$x $a1$x $a2$x ...`), the regex engine exhausts the remaining input at each position before backtracking, resulting in O(n²) time complexity. The same issue affects multiline comment patterns (`/*` and `/*+`). The lexer applies all regex patterns at every input character position without timeout or length limits, making the flaw exploitable via any public API (`sqlparse.parse()`, `sqlparse.format()`, `sqlparse.split()`) that accepts user-controlled SQL. Empirical testing confirms 3.3× slowdown when input doubles (n=1000 → n=2000, 0.397s → 1.314s). A patch replacing the backreference approach with deterministic O(n) delimiter matching is available in version 0.6.0.
Affected products
- andialbrecht sqlparse <= 0.5.6.dev0
Identifiers
- CVE-2026-59893
- GHSA-prg7-hcfm-mfcr
- PYSEC-2026-3698
Timeline
- 2026-08-13: disclosed: GitHub Security Advisory published
- 2026-08-17: patched: Fix released in sqlparse 0.6.0