Skip to main content
CVE Vulnerability Database

CVE-2025-1385: ClickHouse Library Bridge RCE Vulnerability

CVE-2025-1385 is a remote code execution vulnerability in ClickHouse library bridge that enables attackers to execute arbitrary code through misconfigured servers. This article covers technical details, exploitation risks, and mitigation.

Published:

CVE-2025-1385 Overview

CVE-2025-1385 affects ClickHouse when the library bridge feature is enabled. The clickhouse-library-bridge exposes an HTTP API on localhost that allows clickhouse-server to dynamically load and execute libraries from specified paths in an isolated process. When combined with ClickHouse table engine functionality that permits file uploads to specific directories, a misconfigured server allows authenticated attackers with privileges to access both table engines to execute arbitrary code on the ClickHouse server. The vulnerability is classified under [CWE-20] Improper Input Validation.

Critical Impact

Authenticated attackers with sufficient table engine privileges can execute arbitrary code on vulnerable ClickHouse servers by abusing the library bridge HTTP API combined with file upload functionality.

Affected Products

  • ClickHouse server installations with the library_bridge feature enabled
  • ClickHouse configurations exposing port 9019 for the library bridge
  • ClickHouse deployments granting users access to both file upload table engines and library bridge functionality

Discovery Timeline

  • 2025-03-20 - CVE-2025-1385 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-1385

Vulnerability Analysis

The vulnerability stems from the interaction between two ClickHouse features. The clickhouse-library-bridge is a helper process that loads shared libraries from disk and executes them on behalf of clickhouse-server. When the bridge feature is enabled, it listens on port 9019 on localhost and accepts HTTP requests that specify a library path to load.

ClickHouse table engines such as File, URL, and related engines allow data to be written to specific directories on the server filesystem. An attacker with privileges to use these engines can write attacker-controlled content, including a shared library, to a path accessible by the library bridge.

The attacker then issues a request to the library bridge instructing it to load and execute the uploaded library. The bridge process loads the library without validating its origin or contents, resulting in arbitrary code execution in the context of the bridge process.

Root Cause

The root cause is improper input validation in the library bridge HTTP API. The bridge accepts arbitrary library paths from authenticated callers without verifying that the library originated from a trusted source. Combined with file-writing table engines, this creates a code execution primitive when both capabilities are granted to the same user.

Attack Vector

An authenticated user with high privileges first uses a file-writing table engine to upload a malicious shared library to a directory readable by the library bridge. The attacker then triggers a query that causes clickhouse-server to invoke the library bridge against the uploaded library path. The bridge loads the shared object, executing attacker-controlled code in an isolated process on the server.

Exploitation requires that the configuration file contains an enabled <library_bridge> block with a defined <port> element. See the GitHub Security Advisory for vendor-provided technical details.

Detection Methods for CVE-2025-1385

Indicators of Compromise

  • Unexpected shared library files (.so) appearing in directories writable by ClickHouse table engines
  • HTTP requests to localhost:9019 referencing library paths outside the expected library directory
  • clickhouse-library-bridge process activity correlated with recent file uploads via File or URL table engines
  • New child processes spawned by clickhouse-library-bridge performing network, shell, or filesystem activity inconsistent with normal workloads

Detection Strategies

  • Inspect ClickHouse configuration files for an enabled <library_bridge><port>9019</port></library_bridge> block to identify exposed instances
  • Audit ClickHouse query logs for use of File, URL, and similar engines that write to disk, especially when followed by library bridge calls
  • Monitor process telemetry on hosts running ClickHouse for unexpected library loads by clickhouse-library-bridge
  • Correlate filesystem write events in ClickHouse data directories with subsequent library bridge HTTP requests

Monitoring Recommendations

  • Enable verbose logging on clickhouse-server and clickhouse-library-bridge to capture library load events
  • Forward ClickHouse audit logs and host process telemetry to a centralized SIEM for correlation
  • Alert on creation of .so files within ClickHouse-writable paths by non-administrative users
  • Track HTTP traffic on localhost port 9019 for anomalous source processes or request volume

How to Mitigate CVE-2025-1385

Immediate Actions Required

  • Disable the library bridge feature by removing or commenting out the <library_bridge> block in the ClickHouse configuration if it is not required
  • Review user grants and revoke access to file-writing table engines (File, URL) from accounts that do not require them
  • Audit existing ClickHouse data directories for unauthorized shared library files
  • Restrict ClickHouse administrative privileges to a minimal set of trusted operators

Patch Information

ClickHouse has published guidance and fixes in the GitHub Security Advisory GHSA-5phv-x8x4-83x5. Administrators should upgrade to a fixed ClickHouse release and review the advisory for configuration hardening recommendations.

Workarounds

  • Remove the <library_bridge> configuration block entirely if the feature is not in use
  • Apply least-privilege access controls so no single user holds both file upload and library bridge invocation permissions
  • Constrain the directories writable by ClickHouse table engines using the user_files_path and related settings
  • Place ClickHouse behind network segmentation that prevents untrusted clients from reaching the SQL interface
bash
# Configuration example: disable the library bridge in config.xml
# Remove or comment out the following block:
# <library_bridge>
#    <port>9019</port>
# </library_bridge>

# Restrict file engine paths in users.xml
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>

# Revoke file/URL engine access from non-admin users
REVOKE FILE, URL ON *.* FROM analyst_user;

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.