DEV Community

jeffrey
jeffrey

Posted on

pgEdge Control Plane wrote trust into every PostgreSQL authentication file

pgEdge Control Plane wrote trust into every PostgreSQL authentication file

PostgreSQL's pg_hba.conf is a sequence of rules. The server reads it from top to bottom and uses the first matching entry. Order matters because a broad rule placed above a narrower one prevents the narrower rule from taking effect. CVE-2026-125323 is a clear example of that behavior: pgEdge Control Plane generated a file with trust entries for local and loopback connections above operator-supplied rules.

The GitHub advisory covers pgEdge Control Plane through 0.10.1 and fixes the issue in 0.11.0. The generated file included trust for Unix-socket and loopback connections across all users, all databases, and replication. Any operating-system account that could reach the socket or loopback interface on a database host could authenticate as any PostgreSQL role without a credential.

Why the first rule wins

Operators may have added authentication rules through the pg_hba_conf field and believed those settings protected the database. In post-0.9 versions, the generated trust block appeared first, so a local or loopback connection matched it before reaching the operator's rule. The control plane reported one policy while PostgreSQL enforced another.

The exposure differs by deployment model. With systemd, the database listens on a shared multi-user host. A local unprivileged account can reach the socket and become the PostgreSQL superuser. With Docker Swarm, the socket and loopback interface belong to the container, so an attacker needs code execution inside that container before the trust entries become useful. Publishing the PostgreSQL port to the host does not make a remote connection appear to come from 127.0.0.1 or ::1.

Local does not mean low impact

A database host often has application accounts, backup agents, monitoring users, and administrative scripts. Any one of them can become a database superuser if it can reach the privileged path. That supports reading or changing every database, altering roles and extensions, tampering with audit data, and preparing a broader compromise.

The advisory gives version-specific workarounds. On 0.1.0 through 0.8.1, an operator could copy the generated authentication files and point hba_file and ident_file at edited copies through node-level configuration. On 0.9.0 through 0.10.1, that approach is blocked by API validation. The only partial mitigation is to tighten Unix-socket permissions, and it does not close the loopback path. The complete remedy is version 0.11.0 or later.

Verify the file PostgreSQL is using

Do not rely on the control-plane interface or a template in Git. Connect to each database host and inspect the file that PostgreSQL reports as hba_file. Read the first matching rules for local socket, 127.0.0.1, ::1, and replication connections. A commented example in a repository is not proof of the active policy.

After upgrading, generate a fresh configuration and confirm that the trust block is gone. Confirm that operator-supplied rules appear above any broad defaults. Test with an unprivileged local account: the expected result is an authentication challenge or denial, not a successful superuser session. Repeat the test for each database node and for every host added after the change.

Review socket permissions, operating-system groups, and container mounts. Narrow access to the PostgreSQL socket and loopback interface as part of ordinary host hardening. Limit interactive logins on database hosts and remove unused service accounts. Those controls reduce the number of identities that can reach the local path even if another configuration mistake appears.

Treat generated security files as code

Authentication files deserve the same review as application code. A generator should have a regression test for the first-match behavior, a golden test for local and loopback rules, and a deployment check that reads the effective file from the database server. The check should fail closed when it sees an unexpected trust entry.

The incident record should include the database host, control-plane version, effective rule order, local account inventory, and the result of a credentialless connection test. If an upgrade cannot happen immediately, reduce socket permissions and keep the loopback path from untrusted local users. Document that the mitigation is partial.

CVE-2026-125323 is a useful reminder that a generated configuration is a security decision, not a convenience artifact. PostgreSQL follows the file exactly. The organization should verify the file it actually runs.

References

Top comments (0)