Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-59894: CWE-94: Improper Control of Generation of Code ('Code Injection') in andialbrecht sqlparse

0
Medium
VulnerabilityCVE-2026-59894cvecve-2026-59894cwe-94
Published: 08/17/2026 (08/17/2026, 17:14:22 UTC)
Source: CVE Database V5
Vendor/Project: andialbrecht
Product: sqlparse

Description

A code injection vulnerability exists in the sqlparse Python module prior to version 0.6.0. The issue arises because the module fails to properly escape backslashes before quotes when formatting SQL with output_format set to 'python' or 'php'. This flaw allows crafted SQL input to terminate the generated string and inject arbitrary Python or PHP code if the generated source is executed or imported downstream. The vulnerability is fixed in sqlparse version 0.6.0.

CVSS v4.0

Score 6.2medium

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vuln. Confidentiality
None
Vuln. Integrity
None
Vuln. Availability
None
Subsq. Confidentiality
High
Subsq. Integrity
High
Subsq. Availability
Low
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L

Affected software

sqlparse
pkg:pypi/sqlparse
Affected versions
<0.6.0

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/17/2026, 17:43:39 UTC

Technical Analysis

The sqlparse module for Python, versions before 0.6.0, contains a CWE-94 improper control of code generation vulnerability. Specifically, in sqlparse/filters/output.py, the code does not escape existing backslashes before quotes when formatting SQL output with output_format='python' or 'php'. This allows an attacker to craft SQL input that can break out of the generated string context and inject arbitrary code in Python or PHP, which may be executed if the generated source code is run or imported. The vulnerability is addressed in version 0.6.0 of sqlparse.

Potential Impact

If exploited, this vulnerability could allow an attacker to execute arbitrary Python or PHP code in the context of the application that processes the generated source code. This could lead to unauthorized code execution, potentially compromising the system or application using sqlparse. The CVSS 4.0 base score is 6.2 (medium severity), reflecting local attack vector, low complexity, no privileges required, user interaction needed, and high scope and impact on confidentiality and integrity.

Mitigation Recommendations

Upgrade sqlparse to version 0.6.0 or later, where this code injection vulnerability has been fixed. No other mitigation is indicated or required according to the available data.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-07-07T16:40:07.983Z
Cvss Version
4.0
State
PUBLISHED
Remediation Level
null

Threat ID: 6a834478bf8831d5394445bd

Added to database: 08/17/2026, 17:27:20 UTC

Last enriched: 08/17/2026, 17:43:39 UTC

Last updated: 08/17/2026, 18:01:29 UTC

Views: 3

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses