CVE-2026-54658 — @hypequery/clickhouse has SQL Injection in...
@hypequery/clickhouse has SQL Injection in parameter escaping that allows arbitrary SQL execution
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.82%). Schedule for your next planned update.
Does your project use an affected @hypequery/clickhouse version?
Paste your package-lock.json to check it for CVE-2026-54658 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
A SQL injection vulnerability exists in the escapeValue() function used for parameter substitution. escapeValue() dispatches on the type of the parameter value, and two of its branches failed to escape safely. An attacker who can control a parameter value can terminate the enclosing string literal and have the rest of the value parsed as SQL.
Vector 1 - string parameters. Fixed in 2.0.2. The string branch escaped ' as '' but left \\ untouched. ClickHouse honours C-style backslash escapes as well as SQL-standard quote doubling, so a value ending in an odd number of backslashes escapes the closing quote and the next parameter lands outside the literal:
where('a', 'eq', 'x\\') -> WHERE a = 'x\\' AND b = ' OR 1=1 --'
Vector 2 - object and array parameters. Fixed in 2.5.1, NOT in 2.0.2. The final branch of the same function rendered non-scalar values as `'${JSON.stringify(value)}'` with no escaping at all. JSON has no reason to escape the apostrophe, so any nested string containing ' terminates the literal:
where('meta', 'eq', { k: \"x' OR 1=1 -- \" })
-> WHERE meta = '{\"k\":\"x' OR 1=1 -- \"}'
The 2.0.2 patch changed only the string branch and did not address this. Vector 2 remained exploitable in 2.0.2, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.2.0, 2.3.0, 2.4.0 and 2.5.0 - every release this advisory previously reported as patched.
Who is impacted. Any application on a version below 2.5.1 that passes user-controlled input as a query parameter. Both vectors are reachable through the documented public API: .where(column, operator, value), the in operator, and adapter.render() / rawQuery().
Schema type declarations do not mitigate vector 2. createQueryBuilder().table() builds its state with an empty column map, so the filter validator has no declared type to check against and returns without validating. Even where a schema is supplied, only String, Int32, Int64, Float64 and Date columns are type-checked - Map, Array, Bool, UUID, DateTime, UInt*, Enum and Nullable columns are not - and any column name containing a . skips validation entirely.
Patches
Upgrade to 2.5.1 or later. Both vectors are closed there.
- Vector 1 - fixed in 2.0.2 by
2dc1df7bae(the referenced4dfa9d77is the same change on the pull-request branch). Escapes backslashes before escaping single quotes. - Vector 2 - fixed in 2.5.1 by
2879161a81, which routes the serialised JSON back throughescapeValue()so nested quotes are doubled. The same commit also rejects non-finite numbers and invalidDatevalues instead of emitting them into the query.
For anyone auditing the history: the vector-2 fix is bundled inside 2879161a81, whose commit message is "parenthesize logical groups in WHERE to preserve AND/OR precedence (#349)". Commit 4a1d4e38aa (#350), whose message does describe the escaping fix, changes only a bigint branch - the escaping fix is already present in its parent.
Workarounds
Upgrading is the only complete fix.
For vector 2 only, applications on 2.0.2–2.5.0 that cannot upgrade can serialise non-scalar parameters themselves and pass the resulting string. That routes the value through the string branch, which is correctly escaped from 2.0.2 onward:
.where('meta', 'eq', JSON.stringify(value)) // safe on >= 2.0.2
There is no workaround for vector 1 other than upgrading to 2.0.2 or later.
Do not substitute application-level input validation or sanitisation for either fix. Correct escaping depends on the literal context the library constructs, so the library has to own it.
Advisory Timeline
- First published July 28, 2026 (121 days ago).
- Last revised August 4, 2026 — 7 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
npm install @hypequery/clickhouse@2.5.1
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: npm (1).
| Package | Fixed In |
|---|---|
| @hypequery/clickhouse npm · Affected: All versions | 2.5.1 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-89SQL InjectionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/hypequery/hypequery/security/advisories/GHSA-6wcc-39rp-hh9pWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-54658ADVISORY
- https://github.com/hypequery/hypequery/pull/349WEB
- https://github.com/hypequery/hypequery/commit/2879161a810fed2c2222f785816ff05510976960WEB
- https://github.com/hypequery/hypequery/commit/2dc1df7baeWEB
- https://github.com/hypequery/hypequery/commit/4dfa9d77d70a08b970e722268b75ca7d13db0bdfWEB
- https://github.com/hypequery/hypequeryPACKAGE
- https://github.com/hypequery/hypequery/blob/main/packages/clickhouse/CHANGELOG.md#202WEB
- https://github.com/hypequery/hypequery/releases/tag/@hypequery/clickhouse@2.0.2WEB
- https://github.com/hypequery/hypequery/releases/tag/@hypequery/clickhouse@2.5.1WEB
Frequently Asked Questions
- What is CVE-2026-54658?
- @hypequery/clickhouse has SQL Injection in parameter escaping that allows arbitrary SQL execution. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2026-54658?
- CVE-2026-54658 affects @hypequery/clickhouse. It has a 0.8% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-54658 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This is an above-median EPSS score — 54.1% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2026-76807CRITICAL
Todoist MCP Server: Browser DNS rebinding lets websites write and delete Todoist data through local MCP server
- CVE-2026-114516CRITICAL
Etherpad: Pre-auth arbitrary file read