CVE-2026-54658: Critical SQL Injection in Hypequery
TL;DR -
@hypequery/clickhousebefore 2.0.2 is vulnerable to SQL injection. - Apps passing untrusted input into Hypequery query parameters are at risk. - Upgrade to 2.0.2 immediately and review ClickHouse query activity.
Vulnerability at a Glance
| Field | Value |
|---|---|
| CVE ID | CVE-2026-54658 |
| CVSS score | 9.8 (Critical) |
| Attack vector | Unknown from provided source data; NVD score is confirmed, vector string was not provided |
| Privileges required | Unknown from provided source data |
| Patch available | Yes, fixed in @hypequery/clickhouse 2.0.2 |
This CVE affects the Hypequery ClickHouse package, published as @hypequery/clickhouse, which is part of the Hypequery TypeScript semantic layer for ClickHouse. The NVD description states that versions prior to 2.0.2 are vulnerable because the escapeValue() function did not properly escape backslashes before single quotes during parameter substitution.
For defenders, the practical takeaway is simple even where some scoring metadata is missing: this is a critical SQL injection flaw in a query construction path. If your application allows attacker-controlled data to flow into Hypequery-backed ClickHouse queries, you should treat exposure as high risk until the package is upgraded and usage paths are reviewed.
What Is This Vulnerability?
At its core, CVE-2026-54658 is an improper escaping bug that enables SQL injection. According to the NVD description, the flaw exists in escapeValue() in packages/clickhouse/src/core/utils.ts. The vulnerable logic failed to escape backslashes before single quotes when substituting parameters into SQL strings.
That failure matters because a value ending with a trailing backslash can alter how the generated SQL parser interprets the closing quote. Instead of remaining safely inside a string literal, the malformed escaping can let attacker-controlled input break out of quoting and inject additional SQL. This is not simply a malformed query issue; the stated impact is arbitrary SQL injection.
From a secure coding perspective, this is the classic danger of building SQL through string interpolation and escaping rather than through robust parameter binding semantics. Even if a helper appears to sanitize dangerous characters, edge cases like slash-quote interactions can still produce exploitable output. For defenders, this means reviewing any code that assumes Hypequery parameter substitution was a safe boundary prior to version 2.0.2.
A second important point is scope. The vulnerable component is not ClickHouse itself, but the application-side library responsible for constructing ClickHouse queries. That means exposure depends on how your application uses Hypequery. Internal-only analytics services may still be vulnerable if they accept user-supplied filters, search terms, dimensions, or raw parameter values from dashboards, APIs, or tenant-controlled inputs.
Technical Notes
The upstream description identifies the vulnerable path as:
packages/clickhouse/src/core/utils.ts
escapeValue()
The issue, as described by NVD, is:
Backslashes before single quotes were not escaped correctly during parameter substitution.
A trailing backslash in attacker-controlled input could escape the closing quote and permit SQL injection.
A conceptual unsafe pattern in application code would look like this:
import { query } from "@hypequery/clickhouse";
// Example only: do not treat this as vendor code
const userInput = req.query.name;
await query(`
SELECT *
FROM events
WHERE user_name = ${userInput}
`);
Even if the library attempted to escape the value, incorrect handling of \ before ' can still produce injectable SQL in affected versions.
Who Is Affected?
The affected product is Hypequery ClickHouse package: @hypequery/clickhouse. Based on the provided NVD-backed data, the vulnerable range is all versions prior to 2.0.2. The fixed release is explicitly stated as 2.0.2.
That means organizations should assume exposure if they have any deployment, service, or build dependency using @hypequery/clickhouse < 2.0.2. The NVD text does not enumerate individual version numbers one by one, so the most accurate phrasing is the one from the source: prior to 2.0.2. If your lockfile, package manifest, container image, or deployed artifact resolves to 2.0.1 or older, it falls into the affected range.
The risk is highest for applications that pass untrusted or tenant-controlled input into Hypequery query parameters. Examples include embedded analytics, reporting endpoints, customer-facing search/filter interfaces, internal BI tools with user-defined filters, and APIs where field values are inserted into generated ClickHouse queries.
If your application uses Hypequery but all query parameters are strictly application-generated and never influenced by external input, practical exploitability may be lower. However, many systems unintentionally allow user-controlled values into filters and dimensions, so defenders should verify real data flows rather than assume safety based on design intent.
Technical Notes
Use package inventory commands to identify affected versions:
npm ls @hypequery/clickhouse
yarn why @hypequery/clickhouse
pnpm why @hypequery/clickhouse
Check lockfiles directly:
grep -R "@hypequery/clickhouse" package-lock.json yarn.lock pnpm-lock.yaml
A vulnerable result would be any resolved version below 2.0.2.
CVSS Score Breakdown
The confirmed severity from the provided research is CVSS v3.x base score 9.8, rated Critical. That alone signals a very serious issue. In practice, a score this high usually indicates a remotely reachable flaw with severe impact and low barriers to exploitation, but that broader interpretation should be treated carefully here because the CVSS vector string was not provided in the source data.
Because the vector string is missing, it would be inaccurate to claim specific values for attack complexity, privileges required, user interaction, or scope. The right practitioner approach is to separate what is known from what is inferred. What is known: NVD lists a 9.8 base score and the issue enables arbitrary SQL injection. What remains unknown from the available data: the exact formal vector components used to derive that score.
For defenders, absence of vector detail should not delay action. A critical SQL injection in a query-building library deserves immediate triage regardless of whether the scoring metadata is fully published. Assume high operational risk where untrusted data reaches the vulnerable code path, and prioritize patching accordingly.
A useful working assumption is this: if your app exposes externally supplied input to ClickHouse query generation and runs with broad database permissions, the business impact can be substantial even without confirmed in-the-wild exploitation. In analytics environments, that could mean unauthorized reads, unexpected data manipulation where permissions allow it, or abuse of query execution to disrupt service.
Exploitation Status
Based on the supplied primary-source research, there is no confirmed evidence of active exploitation in the wild at this time. The CVE is not listed in CISA KEV, which means there is no CISA-confirmed record here of widespread or government-tracked exploitation. That is helpful context, but it should not be mistaken for proof that no one is exploiting it.
There is also no confirmed standalone public PoC in the provided source set. The available public references include the upstream changelog, the fixing commit, the release entry for version 2.0.2, and the GitHub Security Advisory. Those references may give researchers enough information to understand or reproduce the flaw, but that is different from confirming that a public exploit repository exists.
Defenders should therefore state the status precisely: patch available, public fix references available, no confirmed public PoC from the provided sources, and no confirmed in-the-wild exploitation from the provided sources. In the absence of stronger telemetry, organizations should assume exploit development is feasible because the vulnerability class is well understood and the patch diff may reveal enough implementation detail for reproduction.
That assumption matters operationally. Once a fix commit exists publicly, many attackers can diff the vulnerable and fixed code paths and build test cases quickly. Even without a branded PoC, the window between disclosure and practical exploitability can be short for injection flaws.
How to Detect It
Detection should focus on two areas: vulnerable package presence and signs of abnormal ClickHouse query activity. First, identify whether @hypequery/clickhouse versions earlier than 2.0.2 are present anywhere in your build or runtime environment. That is your exposure baseline.
Second, inspect application and database logs for unexpected quote-breaking patterns, trailing backslashes in parameter values, and sudden changes in query shape. Because the root cause involves malformed escaping around backslashes and single quotes, suspicious payloads may include combinations such as \\', trailing \, or user input that appears to terminate a string unexpectedly. There is no single guaranteed indicator, but anomalies in generated SQL are often visible in application debug logs, reverse proxy logs, or ClickHouse query logs if enabled.
If your environment logs normalized or final SQL statements, look for requests where a user-controlled field is followed by a quote escape anomaly, appended conditions, or extra SQL tokens. Pay particular attention to analytics endpoints that accept freeform filters, report builders, and API parameters with unexpectedly high error rates or query failures around the disclosure window.
Technical Notes
Search application logs for suspicious input patterns related to trailing backslashes and broken quoting:
grep -R -E "\\'$|\\$|'.*(OR|UNION|SELECT|INSERT|DROP|--)" /var/log/app/*.log
Example Sigma-like detection idea for web or API logs capturing suspicious parameter values:
title: Possible Hypequery ClickHouse SQL Injection Attempt
logsource:
category: webserver
detection:
selection:
cs-uri-query|contains:
- "%5C"
- "\\"
- "%27"
- "'"
condition: selection
falsepositives:
- Escaped user input in benign searches
level: medium
If ClickHouse query logging is enabled, look for unusual SQL fragments in executed statements:
SELECT
event_time,
user,
query
FROM system.query_log
WHERE query ILIKE '%--%'
OR query ILIKE '% union %'
OR query ILIKE '% or %=%'
OR query ILIKE '%\\''%
ORDER BY event_time DESC
LIMIT 100;
Inventory vulnerable package versions in CI or on hosts:
npm ls @hypequery/clickhouse 2>/dev/null | grep -E '@hypequery/clickhouse@'
Mitigation and Patching
The primary mitigation is to upgrade @hypequery/clickhouse to version 2.0.2 or later. The fixed version identified in the source material is 2.0.2, and the affected range is prior to 2.0.2. If you are on any earlier release, move off it as a priority.
After upgrading, validate that your lockfile and deployed artifacts actually resolved to the fixed version. In JavaScript and TypeScript environments, partial upgrades are common: package.json may be updated while a container image, CI cache, or monorepo workspace still ships an older lockfile resolution. Confirm at build time and in production where possible.
If you cannot patch immediately, reduce exposure by preventing untrusted input from reaching vulnerable query substitution paths. Practical workarounds include strict allowlisting for filter values, rejecting input containing trailing backslashes or dangerous metacharacter patterns, and temporarily disabling user-controlled reporting features that generate ClickHouse queries through Hypequery. These are stopgaps, not substitutes for upgrading.
You should also review the permissions of the ClickHouse account used by the affected application. Least privilege can reduce impact if exploitation occurs. For example, read-only analytics accounts are still serious exposure, but they are generally preferable to accounts with broad administrative or write capabilities.
Technical Notes
Upgrade directly with your package manager:
npm install @hypequery/clickhouse@2.0.2
yarn add @hypequery/clickhouse@2.0.2
pnpm add @hypequery/clickhouse@2.0.2
Then verify the installed version:
npm ls @hypequery/clickhouse
If you need a temporary input validation workaround in application code, an example defensive check could be:
function rejectDangerousInput(value: string) {
if (value.endsWith("\\") || /['";]/.test(value)) {
throw new Error("Rejected potentially unsafe query parameter");
}
return value;
}
This is only an interim control. It may break legitimate inputs and should not be treated as a full fix.
For CI enforcement, fail builds that resolve vulnerable versions:
node -e "const p=require('./package-lock.json'); const s=JSON.stringify(p); if(s.includes('@hypequery/clickhouse') && !s.includes('2.0.2')) { process.exit(1) }"
References
The primary authoritative reference is the NVD CVE record, which provides the vulnerability description, affected product, and fixed version. That description specifically states that escapeValue() failed to escape backslashes before single quotes during parameter substitution and that the issue is fixed in 2.0.2.
Upstream project references also matter because they point defenders to the remediation milestone and implementation change. The changelog, release entry, fix commit, and GitHub Security Advisory all support the conclusion that @hypequery/clickhouse version 2.0.2 is the corrective release. The CISA KEV lookup was negative in the supplied research, so there is no KEV confirmation of exploitation at the time of writing.
- NVD CVE record for CVE-2026-54658
- Hypequery project site: https://hypequery.com
- Changelog: https://github.com/hypequery/hypequery/blob/main/packages/clickhouse/CHANGELOG.md#202
- Fix commit: https://github.com/hypequery/hypequery/commit/4dfa9d77d70a08b970e722268b75ca7d13db0bdf
- Release: https://github.com/hypequery/hypequery/releases/tag/@hypequery/clickhouse@2.0.2
- GitHub Security Advisory: https://github.com/hypequery/hypequery/security/advisories/GHSA-6wcc-39rp-hh9p
In operational terms, this is a straightforward call: if you run @hypequery/clickhouse before 2.0.2, upgrade now, verify deployment state, and review any path where outside input can influence ClickHouse queries. Even without confirmed exploitation, the vulnerability class and public fix information make rapid remediation the prudent choice.
For further reading on related topics, check our articles on digital forensics on Linux and risk management in cybersecurity.
This article may contain affiliate links. We earn a commission on qualifying purchases at no extra cost to you.