Intel

AIKIDO-2026-576438

sqlparse is vulnerable to Code Injection

Code InjectionCVE-2026-59894 Published 5 days ago

62

Medium Risk

This Affects:

PYTHONsqlparse
0.0.1 - 0.5.5
Fixed in 0.6.0
Are you affected? Scan for Free

TL;DR

The Python and PHP output modes in sqlparse generate source-code snippets from caller-supplied SQL and escape quote characters without escaping backslashes. A backslash placed immediately before a quote causes the generated escape to apply to the backslash, letting the quote terminate the generated string and inject code into the snippet. If a workflow executes or imports the generated Python or PHP code, it runs in that process. The fix escapes backslashes before escaping quotes in the generated output.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you convert untrusted SQL using the Python or PHP output format.

Background info

sqlparse is vulnerable to Code Injection in versions 0.0.1 - 0.5.5.

How to fix this

Upgrade the sqlparse library to the patch version.