# CVE-2026-17347: pgAdmin 4 OS command injection in MASTER_PASSWORD_HOOK

Source: https://junglewise.ai/threats/cve-2026-17347-pgadmin-4-os-command-injection-in-master-password-hook  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-31. Updated: 2026-07-31  
License: CC BY 4.0 with a link back

CVE-2026-17347 · Severity: high · CVSS 7.5 · Published 2026-07-31

pgAdmin 4, a popular management tool for PostgreSQL databases, contains a vulnerability in how it handles user-defined scripts for managing master passwords. If an organization uses external login methods like OAuth or Kerberos, a malicious user could craft a username containing special characters to trick the system into running unauthorized commands. This could allow an attacker to take control of the pgAdmin service, potentially leading to the theft of database credentials or disruption of operations.

## Quick answers

**Is CVE-2026-17347 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-17347 being exploited in the wild.

**How severe is CVE-2026-17347?** High severity, with a CVSS score of 7.5, published 31 July 2026.

**Which products and versions are affected?** pgadmin.org pgAdmin 4 7.2 to 9.16.

**Is there a fix for CVE-2026-17347?** A patch was published on 2026-07-31: Version 9.17 released Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-17347 attacked?** It is attacked over the network, in a network appliance.

**Am I affected by CVE-2026-17347?** Check whether anything you run is named in the advisory. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

An OS command injection vulnerability exists in pgAdmin 4 (versions 7.2 through 9.16) within the MASTER_PASSWORD_HOOK functionality. The application improperly handled the '%u' placeholder by directly substituting the username into a command string and executing it via 'subprocess.Popen' with 'shell=True'. Because usernames can be sourced from external providers (OAuth, OIDC, Kerberos), an authenticated attacker can provide a username containing shell metacharacters (e.g., backticks, pipes, or semicolons) to execute arbitrary code as the pgAdmin service account. The vulnerability is mitigated in version 9.17 by switching to 'shell=False' and using 'shlex' to properly tokenize arguments before execution.

## Affected products

- pgadmin.org pgAdmin 4 7.2 to 9.16

## Timeline

- 2026-06-19: other: Initial fix authored
- 2026-07-24: disclosed: Issue reported via GitHub issue tracker
- 2026-07-31: advisory: NVD publication date
- 2026-07-31: patched: Version 9.17 released

## References

- [https://github.com/pgadmin-org/pgadmin4/blob/master/web/pgadmin/utils/master_password.py](https://github.com/pgadmin-org/pgadmin4/blob/master/web/pgadmin/utils/master_password.py)
- [https://github.com/pgadmin-org/pgadmin4/blob/master/web/config.py](https://github.com/pgadmin-org/pgadmin4/blob/master/web/config.py)
- [https://github.com/pgadmin-org/pgadmin4/commit/e7a85767314e7b0fe0b35fe80b9c1af38f48dff6](https://github.com/pgadmin-org/pgadmin4/commit/e7a85767314e7b0fe0b35fe80b9c1af38f48dff6)
- [https://github.com/pgadmin-org/pgadmin4/commit/ea7e798aac27174d2bacee1d6e136bed76a95e23](https://github.com/pgadmin-org/pgadmin4/commit/ea7e798aac27174d2bacee1d6e136bed76a95e23)
- [https://github.com/pgadmin-org/pgadmin4/issues/10191](https://github.com/pgadmin-org/pgadmin4/issues/10191)
