Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. @hypequery/clickhouse
  4. ›
  5. CVE-2026-54658

CVE-2026-54658: @hypequery/clickhouse has SQL Injection in parameter escaping that allows arbitrary SQL execution

July 28, 2026 (updated August 4, 2026)

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.

References

  • github.com/advisories/GHSA-6wcc-39rp-hh9p
  • github.com/hypequery/hypequery/blob/main/packages/clickhouse/CHANGELOG.md
  • github.com/hypequery/hypequery/commit/2879161a810fed2c2222f785816ff05510976960
  • github.com/hypequery/hypequery/commit/2dc1df7bae
  • github.com/hypequery/hypequery/commit/4dfa9d77d70a08b970e722268b75ca7d13db0bdf
  • github.com/hypequery/hypequery/pull/349
  • github.com/hypequery/hypequery/releases/tag/@hypequery/clickhouse@2.0.2
  • github.com/hypequery/hypequery/releases/tag/@hypequery/clickhouse@2.5.1
  • github.com/hypequery/hypequery/security/advisories/GHSA-6wcc-39rp-hh9p
  • nvd.nist.gov/vuln/detail/CVE-2026-54658

Code Behaviors & Features

Detect and mitigate CVE-2026-54658 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.5.1

Fixed versions

  • 2.5.1

Solution

Upgrade to version 2.5.1 or above.

Impact 9.8 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

Source file

npm/@hypequery/clickhouse/CVE-2026-54658.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 08 Aug 2026 00:17:30 +0000.