# CVE-2026-61820: pg_partman SQL injection in inherit_template_properties

Source: https://junglewise.ai/threats/cve-2026-61820-pg-partman-is-a-postgresql-extension-that-manages-partitioned  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-18. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

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

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.

Technologies: [Pgpartman Pg Partman](https://junglewise.ai/threats/technologies/pg-partman). Vendors: [Pgpartman](https://junglewise.ai/threats/vendors/pgpartman).

## Quick answers

**Is CVE-2026-61820 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-61820 being exploited in the wild.

**How severe is CVE-2026-61820?** High severity, with a CVSS score of 8.5, published 18 September 2026.

**Which products and versions are affected?** Pgpartman Pg Partman before 5.5.0.

**Is there a fix for CVE-2026-61820?** A patch was published on 2026-07-22: Fixed in v5.5.0 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-61820 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-61820?** Check whether you run Pgpartman Pg Partman at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## 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

- [https://github.com/pgpartman/pg_partman/commit/ba9405542acf24dd881845b935cab8b165854361](https://github.com/pgpartman/pg_partman/commit/ba9405542acf24dd881845b935cab8b165854361)
- [https://github.com/pgpartman/pg_partman/releases/tag/v5.5.0](https://github.com/pgpartman/pg_partman/releases/tag/v5.5.0)

## Related threats

- [pg_partman denial of service via uncaught exception in maintenance loop](https://junglewise.ai/threats/cve-2026-61822-pg-partman-is-a-postgresql-extension-that-manages-partitioned)
- [pg_partman authorization bypass in drop_partition functions](https://junglewise.ai/threats/cve-2026-61821-pg-partman-is-a-postgresql-extension-that-manages-partitioned)
- [pg_partman SQL injection and privilege escalation via jobmon](https://junglewise.ai/threats/cve-2026-61819-pg-partman-is-a-postgresql-extension-that-manages-partitioned)
- [pg_partman SQL injection in time_dncoder value](https://junglewise.ai/threats/cve-2026-61817-pg-partman-is-a-postgresql-extension-that-manages-partitioned)
