CVE-2026-61781: Critical pg_partman Privilege Escalation and RCE
TL;DR
- CVE-2026-61781 is a critical
pg_partmanvulnerability caused by unsafe SQL interpolation increate_partition_time().- Versions before 5.5.0 are affected, especially deployments using the background worker with elevated privileges.
- No confirmed active exploitation or independently verified public PoC is known from the supplied data.
- Upgrade to 5.5.0 or later and audit stored partition configuration, database roles, and PostgreSQL logs.
Vulnerability at a Glance
CVE-2026-61781 affects the pg_partman PostgreSQL extension, which automates the creation and maintenance of partitioned tables. The issue can turn configuration data writable by a lower-privileged database role into SQL executed by the pg_partman_bgw background worker.
| Field | Details |
|---|---|
| CVE ID | CVE-2026-61781 |
| CVSS base score | 9.9, Critical |
| CVSS vector | Not supplied in the reviewed NVD data; confirm the current NVD record before using for automated scoring |
| Attack vector | Exact vector is unconfirmed; exploitation occurs through database configuration and background-worker activity |
| Authentication / privileges | Requires a database role with the documented partman_user INSERT and UPDATE privileges |
| Affected product | pg_partman |
| Affected versions | All versions before 5.5.0 |
| Fixed version | 5.5.0 |
| Patch available | Yes |
| CISA KEV status | Not listed |
The practical risk is higher in environments where pg_partman_bgw.role runs as a PostgreSQL superuser, which is its default according to the supplied research. Successful exploitation can provide database-wide control and potentially operating-system command execution as the PostgreSQL service account.
Because the exact CVSS vector was not included in the reviewed material, defenders should not infer individual CVSS metrics such as network reachability or authentication scope from the 9.9 score alone. The operational prerequisites described above are the reliable basis for triage.
What Is CVE-2026-61781?
The root cause is unsafe interpolation of the writable part_config.time_encoder text value into a dynamically executed SELECT statement. The value is expected to identify a function used when pg_partman creates partitions, but versions before 5.5.0 do not properly quote it as an identifier or apply equivalent restrictive validation.
An attacker who can modify the relevant configuration can store SQL in place of the expected function name. When pg_partman_bgw later creates a child partition for a text- or UUID-keyed partition set, the background worker consumes the stored value and executes the resulting SQL. The malicious configuration persists in the database and may be triggered again during later maintenance cycles.
The escalation occurs because the worker’s execution context can be more privileged than the role that changed the configuration. Where pg_partman_bgw.role is the PostgreSQL superuser, a role with configuration write access may obtain superuser-level database execution. From there, the impact may extend to operating-system commands executed under the PostgreSQL service account, depending on the database configuration and available PostgreSQL capabilities.
Who Is Affected?
The affected product is the pg_partman PostgreSQL extension. The supplied advisory information identifies all versions before 5.5.0 as affected, with 5.5.0 as the fixed release.
| Product or configuration | Status |
|---|---|
pg_partman versions earlier than 5.5.0 |
Affected |
pg_partman 5.5.0 and later |
Fixed according to the supplied project remediation |
create_partition_time() |
Relevant vulnerable code path |
| Text-keyed partition sets | Relevant exploitation condition |
| UUID-keyed partition sets | Relevant exploitation condition |
pg_partman_bgw enabled |
Increases exposure because stored configuration is consumed automatically |
pg_partman_bgw.role set to PostgreSQL superuser |
Highest-impact configuration |
Roles with documented partman_user INSERT and UPDATE privileges |
Potentially able to modify the relevant configuration |
Organizations should inventory both package versions and runtime configuration. A system may have the vulnerable extension installed without being immediately exploitable through the described path if the background worker is disabled, the relevant partition sets are not used, or no lower-privileged role can modify the required configuration. Those conditions reduce exposure but do not replace patching.
Conversely, a deployment deserves high priority when it combines a vulnerable extension, active background maintenance, text- or UUID-keyed partitioning, writable part_config data, and a worker role with superuser privileges. Database roles granted indirectly through group membership must also be included in the review.
CVSS Score Breakdown
CVE-2026-61781 has a supplied CVSS base score of 9.9, rated Critical. That score indicates potentially severe consequences, but the reviewed NVD response did not include the CVSS vector string. Without the vector, the exact values for attack vector, attack complexity, privileges required, user interaction, scope, confidentiality, integrity, and availability cannot be stated reliably.
The vulnerability’s technical behavior explains why the impact is serious. A role that can write the documented partman_user configuration fields may cause SQL to execute later in the background worker’s security context. If that context is PostgreSQL superuser, the result can be privilege escalation, database-wide compromise, and potentially operating-system command execution.
The table below separates confirmed facts from information that must be verified directly:
| CVSS component | Assessment |
|---|---|
| Base score | 9.9 |
| Severity | Critical |
| Exact vector | Not available in the supplied NVD response |
| Privilege prerequisite | Database role with relevant INSERT and UPDATE privileges |
| Impact | PostgreSQL privilege escalation, database compromise, and possible OS command execution |
| Scope and reachability metrics | Do not infer; confirm from the authoritative NVD record |
Exploitation Status
No verified in-the-wild exploitation was identified in the supplied NVD or CISA data. CVE-2026-61781 is also not listed in the CISA Known Exploited Vulnerabilities catalog. Therefore, there is no CISA KEV date added, due date, required action, or ransomware-campaign flag for this CVE based on the reviewed information.
A public project fix commit, GitHub security advisory, and pg_partman 5.5.0 release are available. Those materials may disclose enough implementation detail for security researchers or attackers to derive an exploit. However, no separate, independently verified public exploit repository or standalone proof of concept was confirmed in the supplied research.
Defenders should distinguish “no confirmed exploitation” from “safe to defer.” The vulnerable configuration is persistent, the trigger is automated, and the public remediation material can accelerate exploit development. Treat systems with exposed database roles and superuser background-worker execution as urgent even though the CVE is not currently in KEV.
How to Detect CVE-2026-61781
Detection should begin with an inventory of installed extension versions and the privileges surrounding pg_partman. Identify databases containing the extension, inspect the worker role, and locate partition configurations whose time_encoder values are unexpected, unusually complex, or inconsistent with approved function names.
A suspicious value may contain SQL syntax, statement separators, comments, casts, subqueries, or function calls rather than a simple trusted identifier. The exact table schema and column representation can vary by pg_partman release, so administrators should validate the query against the installed extension before using it operationally.
Technical Notes
The following example is an investigative starting point, not a universal schema guarantee:
-- Run with an account authorized to inspect pg_partman metadata.
SELECT parent_table,
partition_type,
time_encoder
FROM partman.part_config
WHERE time_encoder IS NOT NULL
AND (
time_encoder LIKE '%;%' OR
time_encoder LIKE '%--%' OR
time_encoder LIKE '%/*%' OR
time_encoder LIKE '%SELECT%' OR
time_encoder LIKE '%(%'
);
Review the worker role and memberships:
SHOW pg_partman_bgw.role;
SELECT rolname, rolsuper, rolcanlogin
FROM pg_roles
WHERE rolname = current_setting('pg_partman_bgw.role', true);
SELECT member.rolname AS member_name,
role_name.rolname AS granted_role
FROM pg_auth_members m
JOIN pg_roles member ON member.oid = m.member
JOIN pg_roles role_name ON role_name.oid = m.roleid
WHERE role_name.rolname ILIKE '%partman%';
For PostgreSQL logging, search for unexpected statements emitted around background maintenance, especially SQL that references partition creation and unusual function or identifier content:
grep -Ei \
'CREATE TABLE .*_p[0-9]|create_partition_time|pg_partman|SELECT .*time_encoder|background worker' \
/var/log/postgresql/postgresql-*.log
A single matching log line does not prove exploitation. Correlate database activity with configuration changes, the modifying role, worker execution times, failed partition-maintenance jobs, and any subsequent privileged DDL or operating-system activity. If PostgreSQL auditing is enabled, prioritize UPDATE statements against partman.part_config and activity performed by the configured background-worker role.
If suspicious activity is confirmed, follow a structured incident process, including containment, evidence preservation, credential review, and host investigation. The first-hour ransomware response checklist provides related guidance for prioritizing early investigative actions, although this vulnerability does not by itself indicate ransomware activity.
Mitigation and Patching
Upgrade the pg_partman extension to version 5.5.0 or later. The project’s 5.5.0 release and associated fix address the vulnerable code path described for versions before 5.5.0. Because PostgreSQL extensions are installed per database, verify and upgrade every database using pg_partman, not only the host-level package or one administrative database.
Before upgrading, preserve relevant configuration and establish a rollback plan appropriate to the organization’s PostgreSQL support process. Afterward, confirm the installed extension version from each affected database and test partition maintenance. Also review whether the background worker is unnecessarily configured to run as superuser; reducing its privileges limits impact if another configuration or extension issue is later discovered.
Technical Notes
The exact package manager command depends on the operating system and PostgreSQL distribution. For source-controlled or project-managed installations, follow the documented release workflow and then upgrade the extension in each database. A representative PostgreSQL extension upgrade is:
# Use the package or build artifact containing pg_partman 5.5.0 or later.
# Then run in each affected database:
psql -d "$DB_NAME" -v ON_ERROR_STOP=1 \
-c 'ALTER EXTENSION pg_partman UPDATE TO '\''5.5.0'\'';'
Verify the result:
SELECT extname, extversion
FROM pg_extension
WHERE extname = 'pg_partman';
If an immediate upgrade is impossible, apply layered controls:
- Restrict
INSERTandUPDATEaccess to the relevantpg_partmanconfiguration tables. - Remove unnecessary membership in roles that provide
partman_usercapabilities. - Disable or stop the
pg_partman_bgwworker where operationally safe. - Configure the worker with the least-privileged role supported by the deployment rather than PostgreSQL superuser.
- Review and normalize existing
time_encodervalues against an approved allowlist. - Monitor configuration changes and background-worker SQL activity.
These are compensating controls, not replacements for version 5.5.0 or later. If suspicious configuration or execution is found, isolate the database from untrusted roles, preserve logs, rotate potentially exposed credentials, inspect for persistence, and investigate the PostgreSQL host for commands executed as the service account.
During incident response, use approved endpoint and malware investigation tooling, such as Malwarebytes, only as part of a broader forensic process. Database logs, operating-system telemetry, and evidence preservation remain essential.
References
The authoritative references supplied for this assessment are the NVD record, the project’s remediation commit, the 5.5.0 release, and the GitHub security advisory. The NVD record should be checked directly for the current CVSS vector and any later updates to affected-version or exploitation information.
- NVD: CVE-2026-61781
- pg_partman remediation commit
- pg_partman 5.5.0 release
- GitHub Security Advisory GHSA-742w-3j7c-qwvp
- CISA Known Exploited Vulnerabilities Catalog
At publication time, the supplied research indicates no confirmed active exploitation, no independently verified standalone public PoC, and no CISA KEV listing. Those statuses can change; maintainers and defenders should recheck the references during triage and before closing the remediation record.
This article may contain affiliate links. We earn a commission on qualifying purchases at no extra cost to you.