Junglewise Threat Intelligence

CVE-2026-61820: pg_partman SQL injection in inherit_template_properties

CVE-2026-61820 · Severity: high · CVSS 8.5 · Published 2026-09-18

Technologies: Pgpartman Pg Partman. Vendors: Pgpartman.

Executive brief

pg_partman is a PostgreSQL extension that automates the creation and management of time-based and ID-based table partitions. A flaw in how the extension constructs SQL for primary keys allows a user to inject arbitrary SQL code that runs with superuser privileges, potentially leading to complete database compromise and command execution on the server. The vulnerability persists in the table schema until manually removed and can be re-triggered when new partitions are created.

Technical details

The inherit_template_properties() function fails to escape double-quote characters in column names extracted from the pg_attribute system catalog before inserting them into an ALTER TABLE ADD PRIMARY KEY statement. A partman_user can craft a column name containing embedded quotes to break out of the identifier context and inject arbitrary SQL. The malicious SQL executes with the privileges of pg_partman_bgw.role, which defaults to PostgreSQL superuser. This is a second-order injection: the crafted identifier is stored in the catalog and exploited each time the background worker applies the key to new child partitions.

Affected products

  • pgpartman pg_partman before 5.5.0

Timeline

  • 2026-09-18: disclosed: CVE-2026-61820 published
  • 2026-07-22: patched: Fixed in v5.5.0

References

Related threats