Executive brief
ClickHouse Server, a high-performance database management system, contains a vulnerability in how it handles external data connections. An attacker with valid credentials to both ClickHouse and a connected PostgreSQL database can bypass security restrictions to execute unauthorized commands on the underlying database server. This could lead to full system compromise, data theft, or the execution of malicious code on the server hosting the database.
Technical details
A SQL injection vulnerability exists in ClickHouse Server versions up to 26.3.9.8 within the 'CREATE DICTIONARY' function using the PostgreSQL source. ClickHouse wraps user-provided SELECT queries in a 'COPY (...) TO STDOUT' statement for execution on the PostgreSQL backend. By crafting a query that begins with a closing parenthesis, an attacker can break out of the COPY command and execute arbitrary SQL statements. If the PostgreSQL user has sufficient privileges, this can be escalated to remote code execution via the 'COPY ... FROM PROGRAM' directive. Exploitation requires valid ClickHouse credentials with dictionary creation permissions and valid PostgreSQL credentials.
Affected products
- ClickHouse ClickHouse Server <= 26.3.9.8
Timeline
- 2025-01-30: disclosed: Vulnerability reported to vendor
- 2026-04-10: other: Vendor marked the issue as 'not applicable' due to required preconditions
- 2026-07-29: advisory: Public disclosure of CVE-2026-51992