---
id: "CVE-2026-112307"
kind: "vulnerability"
aliases: ["CVE-2026-112307"]
title: "sqlparse: SQL text injects PHP code through unescaped dollar signs"
severity: "high"
cvss: 8.4
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["package", "python", "sqlparse"]
not_affected_if: ["default-config"]
published_at: "2026-10-19T16:17:06+00:00"
first_seen_at: "2026-10-23T21:57:18+00:00"
updated_at: "2026-10-25T03:01:56+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-112307", "first_seen_at": "2026-10-23T21:57:18+00:00"}]
---

# sqlparse: SQL text injects PHP code through unescaped dollar signs

sqlparse through 0.6.0 has an output filter that places unescaped dollar-sign sequences from SQL input into double-quoted PHP strings. An attacker who supplies crafted SQL text can get arbitrary PHP code to run when the generated snippet executes.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check whether the installed sqlparse version is `0.6.0` or earlier, for example with `pip show sqlparse`.
- Check whether the application uses the OutputPHPFilter output path to generate PHP code from SQL.

## Fix

- Upgrade sqlparse to a version later than `0.6.0`; the fixed version is unknown from the sources.
- Until patched, do not pass untrusted SQL text through the PHP output filter.

## Timeline

- 2026-10-23T21:57:18+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-112307

## From the sources

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.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
