Inside PostHog: How SSRF, a ClickHouse SQL Escaping 0day, and Default PostgreSQL Credentials Formed an RCE Chain

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

A chained SSRF-plus-SQL-escape exploit reached remote code execution inside PostHog's stack, and the specific ClickHouse escaping bug is now patched, teams self-hosting either product should update.

Read this as

A security researcher found a way to break into PostHog, a company that sells analytics software for websites. He chained three weaknesses together: a weak URL check let his server trick PostHog's own server into making requests (called server-side request forgery), that request carried a malicious database query into ClickHouse, and the query then forced PostgreSQL, where the default passwords were left unchanged, to run a shell command that phoned the attacker's machine. All the holes were reported and fixed, so only people running old, unpatched versions remain exposed.

A researcher demonstrated a full remote-code-execution chain against PostHog by chaining three flaws, all now fixed: weak webhook URL validation enabling server-side request forgery, a since-patched escaping bug in ClickHouse's PostgreSQL() function, and unchanged default 'posthog' PostgreSQL credentials. The final step used PostgreSQL's COPY ... FROM PROGRAM to open a reverse shell. Self-hosters who don't apply the ClickHouse patch or change default database passwords remain exposed.

Mehmet Ince's chain: webhook URL validation insufficiently strict → SSRF to ClickHouse on port 8123; a ClickHouse escaping 0day in the postgresql() table function (fixed in PR 74144) let injected SQL pass through to the backing PostgreSQL server; default 'posthog' credentials permitted COPY cmd_exec FROM PROGRAM to spawn a reverse bash shell to the attacker on port 4444 (ZDI-25-099/-097/-096). All issues reported and fixed.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

PostHog ClickHouse PostgreSQL SSRF

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading