Description
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.
Published: 2026-10-19
Score: 8.4 High
EPSS: < 1% Very Low
KEV: No
Impact: Remote Code Execution
Action: Immediate Patch
AI Analysis

Impact

sqlparse up to version 0.6.0 contains a code injection flaw (CWE‑94) that permits an attacker to embed PHP expressions inside SQL text. The vulnerability is tied to the OutputPHPFilter handling of unescaped dollar signs, allowing constructs such as ${expr} or {${expr}} to be inserted into double‑quoted strings. When the generated PHP snippet is executed, the arbitrary PHP code runs with the permissions of the web server, compromising confidentiality, integrity, and availability of the affected application.

Affected Systems

The affected product is sqlparse from andialbrecht, versions 0.6.0 and earlier. The vulnerability manifests when the output_format option is set to 'php', which is commonly used when generating PHP code from SQL strings. No other vendors are listed as impacted.

Risk and Exploitability

The CVSS score of 8.4 indicates high severity. The EPSS score is not available, and the vulnerability is not listed in the CISA KEV catalog. Attackers need only supply malicious SQL text to the vulnerable component; no additional privileges are required beyond normal usage. The tool’s design allows the untrusted text to be processed, so the attack vector is local to the application’s input handling, but the execution occurs in the PHP runtime environment, making this a critical risk.

Generated by OpenCVE AI on October 19, 2026 at 17:05 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to sqlparse version 0.6.1 or newer, which removes the code injection path.
  • If upgrading is not feasible, stop using output_format='php' for any SQL that originates from untrusted sources or enforce a whitelist of allowed characters, stripping any ${} or {${}} patterns before processing.
  • As an additional precaution, configure the PHP environment to disable short tags and strictly enforce safe_mode or enable open_basedir restrictions to limit the impact of potential injected code.

Generated by OpenCVE AI on October 19, 2026 at 17:05 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 20 Oct 2026 00:30:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Important


Mon, 19 Oct 2026 17:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Mon, 19 Oct 2026 15:45:00 +0000

Type Values Removed Values Added
Description 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.
Title sqlparse through 0.6.0 PHP Code Injection via output_format='php'
First Time appeared Sqlparse Project
Sqlparse Project sqlparse
Weaknesses CWE-94
CPEs cpe:2.3:a:sqlparse_project:sqlparse:*:*:*:*:*:*:*:*
Vendors & Products Sqlparse Project
Sqlparse Project sqlparse
References
Metrics cvssV3_1

{'score': 7.3, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L'}

cvssV4_0

{'score': 8.4, 'vector': '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'}


Subscriptions

Sqlparse Project Sqlparse
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-10-19T16:41:10.929Z

Reserved: 2026-10-19T14:14:28.728Z

Link: CVE-2026-112307

cve-icon Vulnrichment

Updated: 2026-10-19T16:41:01.827Z

cve-icon NVD

Status : Deferred

Published: 2026-10-19T16:17:06.727

Modified: 2026-10-19T17:17:15.780

Link: CVE-2026-112307

cve-icon Redhat

Severity : Important

Publid Date: 2026-10-19T15:28:57Z

Links: CVE-2026-112307 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-10-19T21:45:04Z

Weaknesses
  • CWE-94

    Improper Control of Generation of Code ('Code Injection')