CVE-2025-1520

8.0 HIGH

📋 TL;DR

This SQL injection vulnerability in PostHog's ClickHouse table functions allows authenticated attackers to execute arbitrary SQL commands, potentially leading to remote code execution. It affects PostHog installations where attackers have network access and valid credentials. The vulnerability stems from improper input validation in SQL query construction.

💻 Affected Systems

Products:
  • PostHog
Versions: Versions before commit 6e8f035f9acd339c5ba87ba6ea40fc1ab3053d42
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Requires ClickHouse backend and network-adjacent access with authentication.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full database compromise leading to data exfiltration, privilege escalation, and complete system takeover via RCE.

🟠

Likely Case

Database manipulation, data theft, and potential lateral movement within the network.

🟢

If Mitigated

Limited to authenticated user's permissions, potentially only data access within their scope.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: HIGH

🎯 Exploit Status

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

Authentication required, but SQL injection to RCE chain is documented in ZDI advisory.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Commit 6e8f035f9acd339c5ba87ba6ea40fc1ab3053d42 or later

Vendor Advisory: https://github.com/PostHog/posthog/commit/6e8f035f9acd339c5ba87ba6ea40fc1ab3053d42

Restart Required: Yes

Instructions:

1. Update PostHog to version containing commit 6e8f035f9acd339c5ba87ba6ea40fc1ab3053d42. 2. Restart PostHog services. 3. Verify the fix by checking version.

🔧 Temporary Workarounds

Network Segmentation

linux

Restrict network access to PostHog instances to only trusted IPs.

iptables -A INPUT -p tcp --dport [POSTHOG_PORT] -s [TRUSTED_IP] -j ACCEPT
iptables -A INPUT -p tcp --dport [POSTHOG_PORT] -j DROP

Authentication Hardening

all

Implement strong authentication controls and limit user privileges.

🧯 If You Can't Patch

  • Implement strict network access controls to limit exposure to authenticated users only.
  • Apply WAF rules to detect and block SQL injection patterns in requests.

🔍 How to Verify

Check if Vulnerable:

Check if PostHog version is before commit 6e8f035f9acd339c5ba87ba6ea40fc1ab3053d42.

Check Version:

Check PostHog version via web interface or API, or inspect git commit hash in deployment.

Verify Fix Applied:

Confirm PostHog is running version with commit 6e8f035f9acd339c5ba87ba6ea40fc1ab3053d42 or later.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL queries in PostHog/ClickHouse logs
  • Multiple failed authentication attempts followed by SQL errors

Network Indicators:

  • SQL injection patterns in HTTP requests to PostHog endpoints

SIEM Query:

source="posthog" AND ("sql" OR "injection" OR "CVE-2025-1520")

🔗 References

📤 Share & Export