Skip to main content

PyPika CVE-2026-142206

| EUVDEUVD-2026-141624 HIGH
SQL Injection (CWE-89)
2026-12-02 VulnCheck GHSA-j8qq-4g86-g64h
8.7
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

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

  1. Access
    Reach application search input
  2. Delivery
    Submit crafted pattern argument
  3. Exploit
    Close string literal via injection
  4. Execution
    Append SQL bypassing tenant filter
  5. Impact
    Read other tenants' tables

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Persistence

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 use PyPika's ClickHouse search functions (Match, Like, NotLike, MultiSearchAny, MultiMatchAny) or ToFixedString, and that an attacker control the pattern or value argument passed to them, because those arguments are not escaped before being embedded in the SQL string literal. LIMITING FACTORS: the application must actually import and use the ClickHouse module (not PyPika's generic query building), must expose these specific pattern/value parameters to untrusted input, and must lack its own input sanitization - so this is not an unconditional flaw against every PyPika deployment. Where those conditions hold, no authentication or user interaction is needed (PR:N/UI:N) and the impact is reading beyond intended scope, e.g. bypassing tenant filters.

Impact

The input CVSS 4.0 base score is 8.7 (High) with vector AV:N/AC:L/AT:N/PR:N/UI:N and VC:H, indicating a network-reachable, low-complexity, no-privilege, no-interaction confidentiality breach - classic SQL injection (CWE-89). However, the real-world risk is gated by a condition the base vector does not capture: the flaw only matters when a consuming application actually uses PyPika's ClickHouse search_string functions (Match, Like, NotLike, MultiSearchAny, MultiMatchAny) or ToFixedString AND passes attacker-controllable values into them unescaped. The PR:N rating reflects the end-attacker's position (untrusted search input), which is reasonable, but the AV:N/AC:L profile describes the injectable code path, not a guarantee that every PyPika deployment is exposed. No EPSS score, no CISA KEV listing, and no confirmed working exploit were provided - the references are source-code line pointers and a VulnCheck advisory, not a weaponized PoC. The vuln.today decision label is 'this_week', consistent with a prioritized-but-not-emergency posture: treat as a real priority for any team using PyPika's ClickHouse module with user-facing search, and lower priority for those who do not. Impact is confidentiality-only per the vector (VC:H, VI:N/VA:N); tenant-isolation bypass and cross-table reads are the stated consequences, not data modification.

Exploit ScenarioDerived

A multi-tenant analytics application builds ClickHouse queries with PyPika, passing a user-supplied search term into a Match or Like pattern that is not escaped. An attacker submits a crafted pattern containing a quote character to close the string literal and append their own SQL, bypassing the tenant filter to read rows from other tenants or unrelated tables. No public working exploit was identified in the provided data, though the vulnerable source lines are publicly referenced.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
No patch listed yet 0.6% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – Dec 02, 2026

SQL injection in PyPika through 0.51.1 lets remote, unauthenticated attackers break out of SQL string literals by supplying crafted pattern or value arguments to the ClickHouse search helpers (Match, Like, NotLike, MultiSearchAny, MultiMatchAny) and ToFixedString, which are embedded without escaping. The flaw only bites applications that actually import PyPika's ClickHouse module and pass untrusted input into those specific arguments, in which case an attacker can defeat tenant filters and read data from other tables (CWE-89, confidentiality-only impact). No public exploit code was identified at time of analysis and the issue is not in CISA KEV, but the vendor-priority signal places remediation within this week.

RemediationAI

No vendor-released patch or fixed version was identified at time of analysis - all references point to the vulnerable v0.51.1 source and a third-party advisory, with no upgrade target named, so treat this as unpatched and plan for an upstream release before relying on a version bump. Because the injection occurs when unescaped patterns are embedded into string literals, the effective compensating control is to stop passing untrusted data into the pattern argument of Match, Like, NotLike, MultiSearchAny and MultiMatchAny and into the value argument of ToFixedString: either keep those helpers on hardcoded or fully validated patterns only, or escape/validate input at the application layer before it reaches PyPika, rejecting values that contain single-quote characters - the trade-off is that legitimate patterns containing quotes will be refused or must be escaped in a way the caller controls, and application-level escaping must mirror ClickHouse's literal rules or the bypass returns. Where these helpers are not essential, build the equivalent predicates through a parameterized path or a query interface that binds values rather than interpolating them, accepting a rewrite of the affected call sites. Note that the CVSS vector is network-reachable with no privileges (AV:N/AC:L/PR:N/UI:N) and the impact is read-only (VC:H/VI:N/VA:N), so priority should go to multi-tenant deployments where a bypassed filter exposes other tenants' rows; consult the VulnCheck advisory at https://www.vulncheck.com/advisories/pypika-through-0.51.1-sql-injection-via-clickhouse-search-and-tofixedstring-functions and the referenced source lines when auditing call sites.

Affected VersionsENISA

PyPika 0 ≤0.51.1

Affected Packages

euvd pypika 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

PyPika is a Python SQL query builder that constructs SQL strings programmatically rather than using bound parameters. Its ClickHouse dialect adds helper builders for search-style predicates and type conversion; per the referenced source (pypika/clickhouse/search_string.py lines 20-33 and 64-78, and pypika/clickhouse/type_conversion.py lines 24-30 in the v0.51.1 tree), the pattern argument to Match, Like, NotLike, MultiSearchAny and MultiMatchAny and the value passed to ToFixedString are interpolated into a quoted SQL string literal without escaping embedded quote characters. That is the classic CWE-89 root cause: data and SQL syntax share the same channel, so an attacker who controls the pattern can close the literal and append arbitrary SQL fragments. The CPE cpe:2.3:a:kayak:pypika:*:*:*:*:*:*:*:* indicates the CPE has no version bound recorded, while the description and reference links bound the issue to releases through 0.51.1. The trigger path beyond 'control the pattern/value argument' is not described in the available sources, and the affected surface is limited to the ClickHouse module rather than PyPika's generic query building, where arguments are not routed through these helpers.

Know when Pypika 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.7 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
vuln.today AI 7.5 HIGH

Attacker-controlled search patterns reach the injectable path with no auth or interaction (AV:N/AC:L/PR:N/UI:N); impact is unauthorized data reads only, so C:H and I/A:N.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

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

DescriptionCVE.org

PyPika through 0.51.1 contains an sql injection vulnerability that allows attackers to inject SQL through unescaped pattern arguments in ClickHouse search functions and ToFixedString. Attackers controlling Match, Like, NotLike, MultiSearchAny, MultiMatchAny patterns or ToFixedString values can close string literals to bypass tenant filters or read other tables.

Executive ViewAI

Why It Matters

A high-severity SQL injection flaw in PyPika (through version 0.51.1) affects applications that use its ClickHouse helpers with untrusted input, allowing unauthenticated attackers to bypass tenant filters and read data across tables. This threatens confidentiality of multi-tenant data, making remediation a priority this week.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: strictly validate and sanitize all inputs passed to the affected PyPika ClickHouse helpers; avoid using these helpers with untrusted data; implement a custom escaping function as a temporary fix; deploy web application firewall rules to detect SQL injection attempts targeting ClickHouse queries.

Threat Intelligence Overview

EPSS Score
0.6%
Top 48% exploitable
Prevalence
Medium
popular Python SQL query builder; ClickHouse search module is a narrower subset
Data Quality
5 sources
Confidence: Medium

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.6%
Patch available No
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· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

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

Attack Technique

SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.

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