CVE-2026-59894
MediumCVSS 6.2Exploitation Probability (EPSS)
Low risk3th percentile - higher than 3% of all known CVEs
Summary
sqlparse before 0.6.0 has a vulnerability in sqlparse/filters/output.py that fails to escape existing backslashes before quotes in output_format='python' and output_format='php' and the corresponding sqlformat -l modes, allowing crafted SQL to terminate the generated string and inject Python or PHP code when a downstream consumer executes or imports the generated source.
Risk Assessment
The risk includes remote code execution in the environment that processes the generated code, potentially leading to full application compromise.
Recommendation
It is recommended to upgrade to version 0.6.0 or later, which includes the fix.
Other vulnerabilities in sqlparse
See all- CVE-2026-84305Medium
A vulnerability in sqlparse (a SQL parser module for Python) before version 0.6.0 causes excessive CPU consumption when formatting queries with parenthesized tuple lists, potentially leading to request delays and reduced throughput.
- CVE-2026-71491High
sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, group_comments in sqlparse/engine/grouping.py repeatedly rescans comment-only statements before the MAX_GROUPING_TOKENS guard, causing quadratic CPU consumption through sqlparse.parse() and sqlparse.format(sql, strip_comments=True). This issue is fixed in version 0.6.0.
- CVE-2026-59893High
sqlparse before version 0.6.0 has a performance issue: SQL_REGEX in sqlparse/keywords.py and the per-position loop in sqlparse/lexer.py repeatedly scan unmatched dollar-quoted literal and multiline-comment delimiters, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split(). This issue is fixed in version 0.6.0.
- CVE-2026-54284High
sqlparse before version 0.6.0 has a performance issue: TokenList construction and string conversion in sqlparse/sql.py repeatedly flatten nested token subtrees constructed by group_parenthesis and group_case, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split() before depth and token limits terminate processing. This issue is fixed in version 0.6.0.
Original NVD description (English source)
sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, sqlparse/filters/output.py fails to escape existing backslashes before quotes in sqlparse.format output_format='python' and output_format='php' and the corresponding sqlformat -l modes, allowing crafted SQL to terminate the generated string and inject Python or PHP code when a downstream consumer executes or imports the generated source. This issue is fixed in version 0.6.0.
Vulnerability data from NVD (NIST) · CISA KEV · EPSS

