PostHog ClickHouse Table Functions SQL Injection Remote Code Execution Vulnerability
The SQL parser in PostHog did not properly validate a user-supplied string before using it to build SQL queries. An authenticated attacker could exploit this to execute code in the context of the database account.
Originally disclosed on Zero Day Initiative
This vulnerability allows network-adjacent attackers to execute arbitrary code on affected installations of PostHog. Authentication is required to exploit this vulnerability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the SQL parser passed user-supplied input into ClickHouse table functions without validating or restricting it, allowing injected SQL to reach dangerous functions.
Impact
An authenticated, network-adjacent attacker could execute arbitrary code in the context of the database account; the text does not say whether any defence limited the exploit.
What the attacker needed
Authentication required; network-adjacent access
The fix
The vulnerability was fixed in an update issued by PostHog.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
PostHog is an analytics tool that stores data in a database called ClickHouse. The software took text from a user and put it into a database command without checking it first, so a logged-in user could sneak in extra commands. That let them run their own code on the database server rather than just reading data.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.