---
id: CVE-2026-59894
title: sqlparse is a non-validating SQL parser module for Python
summary: >-
  sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0,
  sqlparse/filters/output.py fails to escape existing backslashes before quotes
  in sqlparse.format output_format='python' and output_format='php' and the
  correspond…
severity: medium
cwe:
  - CWE-94
vendor: sqlparse
product: sqlparse
affected:
  - sqlparse < 0.6.0
patched:
  - sqlparse 0.6.0
published: '2026-08-17'
updated: '2026-09-18'
sourceUpdated: '2026-09-18T20:09:01.757'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-59894'
references:
  - url: >-
      https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-3496-9g83-7v6x
    label: security-advisories@github.com
  - url: >-
      https://github.com/andialbrecht/sqlparse/commit/53ff44b53e27cff78259acc1af015506fea60f63
  - url: 'https://github.com/andialbrecht/sqlparse'
  - url: 'https://github.com/advisories/GHSA-3496-9g83-7v6x'
tags:
  - nvd
  - osv
  - pip
  - ghsa
epss: 0.00184
epssPercentile: 0.07014
aliases:
  - GHSA-3496-9g83-7v6x
  - PYSEC-2026-3696
ecosystem: pip
ingestedAt: '2026-08-17T17:58:11.065Z'
---

## Overview

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, sqlparse/filters/output.py fails to escape existing backslashes before quotes in sqlparse.format output_format='python' and output_format='php' and the corresponding sqlformat -l modes, allowing crafted SQL to terminate the generated string and inject Python or PHP code when a downstream consumer executes or imports the generated source. This issue is fixed in version 0.6.0.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.

## Package advisory (CVE-2026-59894)

Affected packages:

- `sqlparse < 0.6.0`

Patched in:

- `sqlparse 0.6.0`

Source: https://osv.dev/vulnerability/GHSA-3496-9g83-7v6x
