PT-2026-76720 · Pypi · Sqlparse

CVE-2026-59894

·

Published

2026-08-17

·

Updated

2026-09-01

CVSS v4.0

6.2

Medium

VectorAV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L
Name of the Vulnerable Software and Affected Versions sqlparse versions prior to 0.6.0
Description The sqlparse/filters/output.py module fails to escape existing backslashes before quotes when using output format='python' or output format='php' in the sqlparse.format() function and the corresponding sqlformat -l modes. This allows crafted SQL to neutralize the quote escaping mechanism, terminate the intended language string, and inject Python or PHP code into the generated snippet. Code execution occurs if a downstream consumer executes or imports the generated source. The issue is specifically tied to the Python output filter, which uses single-quoted strings, and the PHP output filter, which uses double-quoted strings.
Recommendations Update sqlparse to version 0.6.0. As a temporary workaround, avoid using the output format='python' and output format='php' parameters in the sqlparse.format() function and the sqlformat -l options.

Exploit

Fix

Code Injection

Found an issue in the description? Have something to add? Feel free to write us 👾

Weakness Enumeration

Related Identifiers

CVE-2026-59894
ECHO-29A6-7992-DF6D
GHSA-3496-9G83-7V6X
OPENSUSE-SU-2026:11557-1
OPENSUSE-SU-2026:21690-1
PYSEC-2026-3696
SUSE-SU-2026:3762-1
SUSE-SU-2026:3906-1
SUSE-SU-2026:3907-1
SUSE-SU-2026:3910-1

Affected Products

Sqlparse