Jul 29, 2026·5 min read·120 visits
Improper escaping of trailing backslash characters in @hypequery/clickhouse parameter substitution allows attackers to escape string literal boundaries and inject arbitrary SQL commands into ClickHouse queries.
A critical SQL injection vulnerability was identified in @hypequery/clickhouse prior to version 2.0.2. The escapeValue utility function in packages/clickhouse/src/core/utils.ts fails to escape literal backslash characters before replacing single quotes. This allows remote, unauthenticated attackers to supply input parameters ending in a backslash, neutralizing the closing quote character inside ClickHouse databases and enabling arbitrary SQL execution.
The node package @hypequery/clickhouse serves as an analytical query builder and semantic layer, translating structured object queries into ClickHouse-compatible SQL statements. Because ClickHouse often operates behind server-side APIs or is queried directly via HTTP, developer libraries typically rely on client-side parameter substitution to construct the final query string. This client-side execution path makes the query engine highly dependent on secure string-escaping utilities.
The core of this security mechanism resides in the escapeValue function within packages/clickhouse/src/core/utils.ts. This utility parses individual parameters and wraps strings in single quotes while escaping internal quotation marks. If an input value breaks these quotation boundaries, the parser shifts out of the string literal context and evaluates subsequent text as executable SQL structure.
In versions of @hypequery/clickhouse before 2.0.2, the library failed to sanitize literal backslash (\) characters during string preparation. Because ClickHouse supports C-style backslash escape sequences, an input ending with a backslash neutralizes the closing quote added by the library. This allows an attacker to construct queries that absorb application logic as a string literal, executing adjacent parameter values as raw SQL instructions.
The root cause of CVE-2026-54658 stems from a dialect mismatch between SQL-92 string-escaping conventions and ClickHouse's implementation of escape characters. Under standard SQL-92 specifications, a single quote within a string literal is escaped by doubling it (''), and backslashes have no syntactic function. However, the ClickHouse SQL parser supports C-style escapes, interpreting a backslash immediately preceding a single quote (\') as a literal single quote rather than a closing delimiter.
Prior to the patch, the escapeValue function processed string variables by replacing single quotes with doubled single quotes using the regex pattern value.replace(/'/g, "''"). No operations were performed to validate or escape literal backslash characters. When an input parameter such as test\ was passed, the utility produced the SQL literal 'test\''.
During parsing on the ClickHouse server, the sequence \' is read as an escaped quote. The string literal remains unclosed, causing the database to interpret all subsequent query components—including operators, commands, and structural clauses—as part of the string. The literal is only closed when the parser encounters the next unescaped single quote, which typically occurs in the next parameter, allowing the payload inside that parameter to execute as active SQL code.
The vulnerability inside packages/clickhouse/src/core/utils.ts is shown below, illustrating the lack of backslash handling in the string classification block:
// Vulnerable Implementation (pre-2.0.2)
export function escapeValue(value: any): string {
// ... types check
else if (typeof value === 'string') {
// Only single quotes are substituted, leaving backslashes unaltered
return `'${value.replace(/'/g, "''")}'`;
}
// ...
}To resolve this issue, commit 4dfa9d77d70a08b970e722268b75ca7d13db0bdf modified the string escaping logic. The updated code doubles all backslash characters before executing the single-quote replacement, neutralizing any attempts to escape the closing quote:
// Patched Implementation (2.0.2+)
export function escapeValue(value: any): string {
else if (typeof value === 'number') {
return value.toString();
} else if (typeof value === 'string') {
// Backslashes are doubled first to prevent escaping the closing quote
const escaped = value.replace(/\\/g, '\\\\').replace(/'/g, "''");
return `'${escaped}'`;
} else if (value instanceof Date) {
return `'${value.toISOString()}'`;
} else {
// ... fallback execution path
}
}While this patch successfully stops the trailing backslash attack vector, developers must ensure that fallback conditions do not introduce serialization bypasses. If an attacker can inject custom object types that bypass the typeof value === 'string' check but return malicious string values during execution, downstream vulnerabilities may persist. Strict input-type schema validation should be maintained on all upstream API endpoints.
Exploiting this vulnerability requires that an attacker can control at least one query parameter in a multi-parameter query, or control a parameter that precedes structurally predictable SQL operations. Consider a typical query constructed by the application interface to retrieve active database logs:
SELECT * FROM user_logs WHERE username = ? AND category = ?An attacker supplies a single backslash \ as the first parameter, and the payload OR 1=1 -- as the second parameter. The query engine uses escapeValue to prepare both parameters, yielding the SQL query:
SELECT * FROM user_logs WHERE username = '\' AND category = ' OR 1=1 -- 'The ClickHouse engine parses the first string literal starting at the single quote before the backslash. Because of the trailing backslash, the single quote at the end of the first parameter is treated as an escaped literal quote. The string literal does not close until the single quote preceding OR 1=1 is encountered. Consequently, the string literal value becomes \\' AND category = , and the database parses and executes OR 1=1 -- as unescaped SQL commands.
The impact of CVE-2026-54658 is severe, with a CVSS v3.1 score of 9.8. Because @hypequery/clickhouse is commonly deployed in analytical servers and metrics pipelines, this vulnerability allows unauthenticated remote attackers to execute arbitrary SQL commands directly against backend data store instances.
Successful exploitation results in complete data confidentiality failure, allowing attackers to bypass application-level access controls and read sensitive table structures, system logs, or user credentials. Since ClickHouse supports administrative operations, an attacker can execute resource-heavy queries to trigger a denial of service, or execute destructive commands such as dropping tables and dropping databases, compromising the overall data integrity of the system.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
@hypequery/clickhouse hypequery | < 2.0.2 | 2.0.2 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-89 |
| Attack Vector | Network (AV:N) |
| CVSS Severity | 9.8 (Critical) |
| Exploit Status | PoC (Proof of Concept) available in repository tests |
| CISA KEV Status | Not listed |
| Mitigated Version | 2.0.2 |
The software constructs an SQL command using externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended SQL command when it is sent to the database.
CVE-2026-68539 is a remote Denial of Service (DoS) vulnerability in Fulgur, a Rust-based offline HTML/CSS-to-PDF rendering engine. Prior to version 0.29.0, the engine's CSS Generated Content for Paged Media (GCPM) implementation resolved and stored named strings via the string-set property without enforcing memory caps or caching DOM subtree text extraction. An unauthenticated attacker supplying crafted HTML and CSS to a rendering endpoint can trigger multi-gigabyte heap memory allocations and redundant O(M * L) subtree traversals, leading to CPU starvation and out-of-memory (OOM) process aborts.
A stored cross-site scripting (XSS) vulnerability in @waline/client allows unauthenticated attackers to execute arbitrary JavaScript in the context of an administrator's browser session. The flaw exists because the client-side markdown preview renderer utilizes the marked library without HTML sanitization and injects the resulting output directly into the DOM via Vue's v-html directive. When an administrator opens the edit interface for a comment, the preview element is mounted and evaluated immediately due to the combination of watchImmediate and v-show, leading to automatic payload execution and administrative token compromise.
WWBN AVideo versions through 29.0 contain an OS command injection vulnerability (CWE-78) in the standalone API utility function listFFmpegProcesses(). The function constructs a shell pipeline to monitor active FFmpeg processes by interpolating a user-controlled keyword parameter directly into a single-quoted grep argument without sanitization or shell escaping. An attacker capable of crafting or submitting a valid encrypted codeToExec payload can break out of the single-quoted argument context and execute arbitrary operating system commands with the privileges of the web server user.
Ruflo versions prior to 3.16.3 expose the Model Context Protocol (MCP) bridge HTTP endpoints (`POST /mcp` and `POST /mcp/:group`) on all network interfaces (`0.0.0.0:3001`) without authentication. Because the primary JSON-RPC tool dispatcher (`executeTool()`) bypasses existing tool blocklists, an unauthenticated network attacker can invoke the `terminal_execute` tool to achieve arbitrary command execution inside the bridge container. This initial access permits full exfiltration of third-party LLM provider API keys, unauthorized access to the co-located MongoDB instance, and manipulation of the AgentDB learning store.
In etcd versions prior to 3.5.32 and 3.6.13, configuring the server with --listen-client-http-urls decouples HTTP and gRPC traffic onto distinct network listeners. Due to an implementation flaw in how TLS configurations are passed to the gRPC server instance, the Certificate Revocation List (CRL) defined by --client-crl-file is enforced exclusively on the HTTP listener and omitted entirely on the dedicated gRPC listener. This allows an adversary possessing a revoked, CA-signed client certificate to bypass mutual TLS (mTLS) revocation checks and authenticate directly to the gRPC interface.
GitHub CLI (gh) versions 2.10.0 through 2.95.0 contain an input validation vulnerability in the `gh codespace jupyter` command path. When connecting to a remote Codespace to launch a JupyterLab session, the CLI retrieves a server URL via a remote procedure call (RPC) and passes it directly to the host operating system's default URL dispatcher without validating the scheme or target host. A compromised or malicious Codespace can return a custom protocol URI, such as `vscode://` or `vscode-insiders://`, allowing an attacker to invoke local desktop application handlers and achieve arbitrary command execution on the developer's workstation.