Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessReach application search input
-
DeliverySubmit crafted pattern argument
-
ExploitClose string literal via injection
-
ExecutionAppend SQL bypassing tenant filter
-
ImpactRead 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
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
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.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
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
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.
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.
EUVD-2026-141624
GHSA-j8qq-4g86-g64h
NVD
CVE.org
EPSS
Exploit-DB