Skip to main content

sqlparse CVE-2026-112307

| EUVDEUVD-2026-104399 HIGH
Code Injection (CWE-94)
2026-10-19 VulnCheck GHSA-457h-p88w-wq8p
8.4
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Supply SQL containing ${expr} payload
  2. Exploit
    OutputPHPFilter embeds it unescaped in double-quoted string
  3. Execution
    Generated PHP snippet executed downstream
  4. Impact
    Arbitrary PHP code runs in app context

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that the consuming application (1) calls sqlparse with output_format='php' (the OutputPHPFilter), a non-default and rarely used formatting mode; (2) passes attacker-influenced SQL text through that formatter; and (3) actually executes, includes, or eval()s the resulting PHP snippet. The injectable sink is a double-quoted PHP string, triggered specifically by unescaped '$' characters forming ${expr} or {${expr}} interpolation sequences. Limiting factors: the PHP output format is niche, no exploitation occurs unless the generated code is run as PHP (a pure parse-and-display pipeline is unaffected), and only versions through 0.6.0 are affected (fixed by PR #930).

Impact

Signals conflict sharply between nominal severity and realistic exploitability. The CVSS 4.0 base score of 8.4 (High) is driven by dual high impact (VC:H/VI:H) from arbitrary PHP code execution, but the same vector constrains real-world risk: AV:L means the flaw is not remotely reachable on its own, and UI:P reflects that exploitation only lands once the PHP snippet sqlparse generates is actually executed downstream. No EPSS score is provided in the input, so exploitation probability cannot be quantified - this is a data gap, not a low score. The CVE is NOT in CISA KEV and no public exploit code is referenced, so this is best treated as no public exploit identified at time of analysis; do not read the VulnCheck advisory as evidence of in-the-wild use. Practical risk is well below what 8.4 suggests because exploitation depends on a rare, non-default usage pattern (output_format='php') combined with an application that subsequently evaluates the generated code; absent that chain the bug is inert. Bottom line: a genuine code-injection defect worth patching, but a low-urgency, narrow-surface issue rather than a mass-exploitation priority.

Exploit ScenarioDerived

An application uses sqlparse's PHP output formatter (output_format='php') to turn user-submitted SQL into a PHP code snippet, then runs or includes that snippet. An attacker submits SQL text containing a ${expr} sequence, which OutputPHPFilter places unescaped inside a double-quoted PHP string, so when the generated snippet executes the embedded PHP expression is evaluated as code. No public proof-of-concept is referenced, though the vendor patch and regression tests publicly demonstrate the exact payload shapes.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 19, 2026

PHP code injection in sqlparse through 0.6.0 can turn crafted SQL text into executable PHP when an application uses the non-default output_format='php' formatter and later runs the generated snippet. The flaw is CWE-94: OutputPHPFilter fails to escape literal dollar signs inside double-quoted PHP strings, so ${expr} or {${expr}} sequences can be interpreted as PHP interpolation. Although the nominal severity is high, exploitation requires a niche formatter plus execution of the generated PHP, and no public exploit was identified at time of analysis.

RemediationAI

Apply the upstream fix in PR #930 (https://github.com/andialbrecht/sqlparse/pull/930), which escapes literal dollar signs in PHP output, or upgrade to a vendor release that contains it; the available data does not confirm a tagged patched version, so patch status is best described as upstream fix available (PR/commit) with a released patched version not independently confirmed. If upgrading is not possible, avoid calling sqlparse.format(..., output_format='php') on untrusted SQL and never include, eval, or otherwise execute the generated PHP. As a compensating control, pre-escape '$' before formatting or post-process the generated snippet, accepting that this may alter displayed SQL and break intended PHP output; disabling the PHP output mode entirely avoids the sink but removes that feature. See the VulnCheck advisory at https://www.vulncheck.com/advisories/sqlparse-through-0.6.0-php-code-injection-via-output-format-php for vendor guidance.

Affected VersionsENISA

sqlparse 0 ≤0.6.0

Affected Packages

euvd sqlparse no fix

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

sqlparse is a Python SQL parser and formatter, not a PHP library; its optional OutputPHPFilter converts parsed SQL into PHP source by embedding token values in double-quoted PHP strings. The vulnerable implementation escaped backslashes and double quotes but not dollar signs. Because PHP double-quoted strings interpolate variables and support complex ${...} syntax, attacker-influenced SQL containing ${expr} or {${expr}} can escape the intended string-data context and inject PHP expressions. This is CWE-94 (Improper Control of Generation of Code), and the CPE cpe:2.3:a:andialbrecht:sqlparse:*:*:*:*:*:*:*:* identifies the sqlparse package. The upstream fix in PR #930 adds .replace('$', '\\$') to the output escaping chain so literal dollar signs are preserved rather than interpreted by PHP.

Know when Sqlparse gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 8.4 HIGH
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N
vuln.today AI 7.8 HIGH

Injected PHP only runs when the generated snippet is executed locally (AV:L, UI:R); no privileges are needed to supply the SQL (PR:N); arbitrary PHP code yields full C/I/A impact.

3.1 AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Red Hat 7.3 HIGH

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
Low
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

sqlparse through 0.6.0 contains a PHP code injection vulnerability that allows attackers to inject PHP expressions by supplying SQL text containing unescaped dollar signs. Attackers can embed ${expr} or {${expr}} sequences that OutputPHPFilter places in double-quoted strings, executing arbitrary PHP code when the generated snippet runs.

Executive ViewAI

Why It Matters

sqlparse through 0.6.0 has a high-severity code injection flaw in its non-default PHP output formatter that can cause crafted SQL to become executable PHP when an application later runs the generated snippet. Only applications using that formatter and executing generated PHP are exposed, but those that do could face arbitrary code execution, making inventory and remediation important. No public exploit identified at time of analysis, so leadership should focus on confirming exposure and applying the vendor update.

Business Impact: Medium
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.1%
Top 97% exploitable
Prevalence
High
widely-used Python SQL-parsing library, common transitive dependency across tooling
Data Quality
4 sources
Confidence: Medium
EUVD NVD CVE.org EPSS Vulnrichment Vendor GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact
Medium
Technical Impact
Total

Priority Score

42
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +42
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy