{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-17347","assignerOrgId":"f86ef6dc-4d3a-42ad-8f28-e6d5547a5007","state":"PUBLISHED","assignerShortName":"PostgreSQL","dateReserved":"2026-07-25T02:52:54.844Z","datePublished":"2026-07-31T15:59:16.588Z","dateUpdated":"2026-08-01T03:56:12.755Z"},"containers":{"cna":{"providerMetadata":{"orgId":"f86ef6dc-4d3a-42ad-8f28-e6d5547a5007","shortName":"PostgreSQL","dateUpdated":"2026-07-31T15:59:16.588Z"},"title":"pgAdmin 4: OS command injection in MASTER_PASSWORD_HOOK via untrusted username substitution","affected":[{"vendor":"pgadmin.org","product":"pgAdmin 4","repo":"https://github.com/pgadmin-org/pgadmin4","modules":["Master Password Hook"],"programFiles":["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"],"versions":[{"status":"affected","version":"7.2","lessThan":"9.17","versionType":"custom"}],"defaultStatus":"unaffected"}],"descriptions":[{"lang":"en","value":"The MASTER_PASSWORD_HOOK setting, introduced in pgAdmin 4 7.2, lets an administrator configure an external command that returns a per-user encryption key, with %u in the configured string replaced by the current user's name. The previous implementation substituted the username directly into the command string and executed the result with subprocess.Popen(..., shell=True). Because the username can originate from an external authentication source (OAuth/OIDC claims, Kerberos, webserver auth) rather than a value pgAdmin fully controls, a username containing shell metacharacters (';', '$()', backticks, pipes, '&&', newlines) allowed an authenticated user to execute arbitrary commands as the pgAdmin service account in any deployment where the configured hook string uses %u.\n\nFix tokenises the trusted, administrator-configured hook string into an argument vector first (using shlex in POSIX-quoting mode, with backslash-escaping disabled so Windows-style paths are not mis-parsed), substitutes the untrusted username into the individual argv elements, and executes with shell=False. The username is therefore always confined to a single argv element; any shell metacharacters it contains are inert. Administrators whose MASTER_PASSWORD_HOOK previously relied on shell features (pipes, redirection, environment-variable expansion, globbing) within the hook string itself must move that logic into the invoked script, since it is no longer interpreted by a shell.\n\nThis issue affects pgAdmin 4: from 7.2 before 9.17."}],"references":[{"url":"https://github.com/pgadmin-org/pgadmin4/issues/10191","tags":["issue-tracking"]},{"url":"https://github.com/pgadmin-org/pgadmin4/commit/ea7e798aac27174d2bacee1d6e136bed76a95e23","tags":["patch"]},{"url":"https://github.com/pgadmin-org/pgadmin4/commit/e7a85767314e7b0fe0b35fe80b9c1af38f48dff6","tags":["patch"]}],"metrics":[{"format":"CVSS","scenarios":[{"lang":"en","value":"Threat model (per reporter's submitted rating): an authenticated pgAdmin user whose username is sourced from an external identity provider (OAuth/OIDC, Kerberos, or webserver auth passed through to pgAdmin) in a deployment where MASTER_PASSWORD_HOOK's configured string contains %u. Attack Complexity is High because exploitation depends on this non-default configuration (hook enabled with %u, combined with an external-auth username source under attacker influence) rather than being reachable in a default deployment. Scope is Unchanged: the resulting command execution runs as the pgAdmin service account, which is the same security authority the web application process itself already runs under -- it is a consequence of pgAdmin's own process, not a boundary crossing into an unrelated authority. Confidentiality/Integrity/Availability are High because arbitrary command execution as that account can read, modify, or destroy anything the account can reach."}],"cvssV3_1":{"version":"3.1","attackVector":"NETWORK","attackComplexity":"HIGH","privilegesRequired":"LOW","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"HIGH","integrityImpact":"HIGH","availabilityImpact":"HIGH","baseSeverity":"HIGH","baseScore":7.5,"vectorString":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"}},{"format":"CVSS","scenarios":[{"lang":"en","value":"Same reasoning as the CVSS 3.1 entry: authenticated low-privilege user with an externally-sourced username triggers arbitrary OS command execution as the pgAdmin service account, contingent on the non-default MASTER_PASSWORD_HOOK/%u configuration (AT:N here refers to no additional authentication target beyond the login itself; the configuration dependency is captured via AC:H in the 3.1 vector and is implicit in this scenario). VC:H/VI:H/VA:H for the service account's own reach; SC:N/SI:N/SA:N since that reach is the application's own process authority, not a distinct subsequent system."}],"cvssV4_0":{"version":"4.0","vectorString":"CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","baseScore":7.7,"baseSeverity":"HIGH"}}],"problemTypes":[{"descriptions":[{"lang":"en","description":"CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')","cweId":"CWE-78","type":"CWE"},{"lang":"en","description":"CWE-88 Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')","cweId":"CWE-88","type":"CWE"}]}],"credits":[{"lang":"en","value":"Thiago Pereira (@B1gN0Se)","type":"finder"},{"lang":"en","value":"Dave Page <page@pgadmin.org>","type":"remediation developer"},{"lang":"en","value":"Ashesh Vashi <ashesh.vashi@enterprisedb.com>","type":"remediation developer"},{"lang":"en","value":"Ashesh Vashi <ashesh.vashi@enterprisedb.com>","type":"remediation reviewer"},{"lang":"en","value":"Kundan Sable <kundan.sable@enterprisedb.com>","type":"remediation reviewer"}],"source":{"discovery":"EXTERNAL"}},"adp":[{"metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2026-07-31T00:00:00+00:00","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"role":"CISA Coordinator","version":"2.0.3","id":"CVE-2026-17347"}}}],"title":"CISA ADP Vulnrichment","providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2026-08-01T03:56:12.755Z"}}]}}