Skip to main content
Vulnerability Database/CVE-2026-96538

CVE-2026-96538: WarehousePG Privilege Escalation Vulnerability

CVE-2026-96538 is a privilege escalation flaw in WarehousePG allowing non-superusers to execute arbitrary code through file manipulation functions. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-96538 Overview

CVE-2026-96538 is a missing authorization vulnerability [CWE-862] affecting WarehousePG (WHPG) 7.x releases before 7.6.0-WHPG. The flaw exposes built-in server-side file functions, including pg_file_write(text,text,bool), pg_file_rename(text,text,text), pg_file_unlink(text), and pg_logdir_ls(), to any authenticated database role. The required REVOKE statements from contrib/adminpack were never applied in WHPG core after Greenplum's merge to a PostgreSQL 12 base. A non-superuser can therefore write, rename, and delete files in the data and log directories, enabling arbitrary code execution as the postgres operating system user.

Critical Impact

Any authenticated database role can append directives to postgresql.auto.conf and achieve code execution as the postgres OS user on the next restart or configuration reload.

Affected Products

  • WarehousePG (WHPG) 7.0 through 7.5.x
  • WarehousePG core builds derived from the PostgreSQL 12 merge
  • WarehousePG 6.x is not affected because the equivalent functions enforce an internal superuser check

Discovery Timeline

  • 2026-09-28 - CVE-2026-96538 published to the National Vulnerability Database
  • 2026-09-30 - Last updated in NVD database

Technical Details for CVE-2026-96538

Vulnerability Analysis

WarehousePG inherits a set of server-side file manipulation functions from Greenplum. During the merge to a PostgreSQL 12 base, catalog entries for pg_file_write, pg_file_rename, pg_file_unlink, and pg_logdir_ls were repointed to adminpack-derived implementations. The REVOKE statements that normally restrict these functions to superusers were omitted. As a result, every authenticated role can call them without an explicit GRANT.

The functions operate on files under the database data and log directories with the privileges of the postgres operating system user. An attacker who holds any login role can write to or append to arbitrary files inside those directories. This includes postgresql.auto.conf, which PostgreSQL loads on startup and when configuration is reloaded.

An attacker can append directives such as shared_preload_libraries or archive_command to the auto configuration file. On the next server restart or pg_reload_conf() call, the server executes attacker-controlled code or loads an attacker-controlled shared object as the postgres user.

Root Cause

The root cause is a missing authorization control [CWE-862]. The upstream contrib/adminpack module applies REVOKE ALL ... FROM PUBLIC to these functions, but that revocation was not carried into WHPG core when the catalog entries were repointed. The functions therefore execute with the default PUBLIC grant.

Attack Vector

Exploitation requires only an authenticated database role with network reachability to the WarehousePG coordinator. The attacker connects over the standard PostgreSQL wire protocol and issues SQL calls to the affected functions. No prior privilege escalation, no superuser role, and no local operating system access is required.

The vulnerability is described in prose because no verified proof-of-concept code is published. Technical details are available in EnterpriseDB Security Advisory CVE-2022-96538 and GitHub Pull Request #305.

Detection Methods for CVE-2026-96538

Indicators of Compromise

  • Unexpected modifications to postgresql.auto.conf, especially new shared_preload_libraries, archive_command, or local_preload_libraries entries
  • New or renamed files inside the data directory or server log directory that are not produced by routine WAL, checkpoint, or logging activity
  • SQL audit entries showing calls to pg_file_write, pg_file_rename, pg_file_unlink, or pg_logdir_ls from non-superuser roles
  • Server restarts or SELECT pg_reload_conf() calls that immediately follow non-superuser SQL activity touching file functions

Detection Strategies

  • Enable pgaudit or statement logging and alert on any invocation of pg_file_write, pg_file_rename, pg_file_unlink, or pg_logdir_ls
  • Compare on-disk postgresql.auto.conf against a signed baseline and raise an alert on drift
  • Review pg_proc ACLs for the four affected functions and flag any role grant that is not superuser

Monitoring Recommendations

  • Forward PostgreSQL CSV logs and file integrity events into a centralized analytics platform for correlation
  • Monitor the postgres OS user for unexpected child processes spawned after server reload or restart
  • Track outbound network connections from the coordinator host, since archive_command abuse frequently initiates egress

How to Mitigate CVE-2026-96538

Immediate Actions Required

  • Upgrade WarehousePG 7.x to version 7.6.0-WHPG or later as soon as possible
  • Until patching is complete, execute REVOKE ALL ON FUNCTION pg_file_write(text,text,bool), pg_file_rename(text,text,text), pg_file_rename(text,text), pg_file_unlink(text), pg_logdir_ls() FROM PUBLIC on every database
  • Audit existing roles and remove unused or shared login accounts that could be leveraged by an attacker
  • Verify postgresql.auto.conf contents and reset any unexpected directives before the next reload

Patch Information

The fix is delivered in WarehousePG 7.6.0-WHPG. The vendor change restores the missing REVOKE statements for the affected functions, bringing WHPG back in line with the upstream contrib/adminpack authorization model. Full details are available in GitHub Pull Request #305.

Workarounds

  • Apply the manual REVOKE statements above to every database, including template1, so new databases inherit the restriction
  • Restrict pg_hba.conf to trusted client networks and enforce strong authentication for all login roles
  • Enable file integrity monitoring on the data directory, with particular focus on postgresql.auto.conf
bash
# Manual mitigation: revoke PUBLIC execute on the affected functions
psql -d postgres -c "REVOKE ALL ON FUNCTION pg_file_write(text,text,bool) FROM PUBLIC;"
psql -d postgres -c "REVOKE ALL ON FUNCTION pg_file_rename(text,text,text) FROM PUBLIC;"
psql -d postgres -c "REVOKE ALL ON FUNCTION pg_file_unlink(text) FROM PUBLIC;"
psql -d postgres -c "REVOKE ALL ON FUNCTION pg_logdir_ls() FROM PUBLIC;"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.