CVE-2025-1386

4.9 MEDIUM

📋 TL;DR

This vulnerability in the ch-go library allows an attacker to inject malicious query packets into ClickHouse connections when processing large uncompressed external data. Systems using vulnerable versions of ch-go for ClickHouse client connections are affected, particularly those accepting untrusted external data sources.

💻 Affected Systems

Products:
  • ClickHouse ch-go library
Versions: Versions before 0.61.0
Operating Systems: All platforms running ch-go
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects systems using ch-go library to process external data in ClickHouse queries.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could execute arbitrary queries against ClickHouse databases, potentially leading to data exfiltration, data corruption, or denial of service.

🟠

Likely Case

Query injection allowing unauthorized data access or manipulation, though limited by existing database permissions.

🟢

If Mitigated

Minimal impact if proper input validation and query sanitization are already implemented.

🌐 Internet-Facing: MEDIUM - Exploitable if ClickHouse endpoints accept external data from untrusted sources.
🏢 Internal Only: LOW - Requires attacker to control data being processed through ch-go library.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Requires attacker to control external data being processed and knowledge of target query structure.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: ch-go v0.61.0 and later

Vendor Advisory: https://github.com/ClickHouse/ch-go/security/advisories/GHSA-m454-3xv7-qj85

Restart Required: No

Instructions:

1. Update ch-go dependency to v0.61.0 or later. 2. Rebuild and redeploy applications using ch-go. 3. Test functionality with updated library.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Implement strict validation and sanitization of external data before processing through ch-go.

Compression Enforcement

all

Require compression for all external data inputs to prevent the specific condition.

🧯 If You Can't Patch

  • Implement network segmentation to isolate ClickHouse servers from untrusted data sources.
  • Deploy WAF or application firewall rules to detect and block suspicious query patterns.

🔍 How to Verify

Check if Vulnerable:

Check ch-go version in your project dependencies or go.mod file for versions before 0.61.0.

Check Version:

go list -m github.com/ClickHouse/ch-go

Verify Fix Applied:

Confirm ch-go version is 0.61.0 or later and test with known malicious data patterns.

📡 Detection & Monitoring

Log Indicators:

  • Unusual query patterns in ClickHouse logs
  • Multiple query attempts from single external data source
  • Query syntax errors following external data processing

Network Indicators:

  • Unusually large uncompressed data transfers to ClickHouse endpoints
  • Multiple query packets in single connection

SIEM Query:

source="clickhouse" AND ("query injection" OR "malformed query" OR "unexpected packet")

🔗 References

📤 Share & Export