CVE-2026-17347

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. Fix 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. This issue affects pgAdmin 4: from 7.2 before 9.17.
Configurations

Configuration 1 (hide)

cpe:2.3:a:pgadmin:pgadmin_4:*:*:*:*:*:postgresql:*:*

History

23 Oct 2026, 23:10

Type Values Removed Values Added
Summary
  • (es) La configuración MASTER_PASSWORD_HOOK, introducida en pgAdmin 4 7.2, permite a un administrador configurar un comando externo que devuelve una clave de cifrado por usuario, con %u en la cadena configurada reemplazado por el nombre del usuario actual. La implementación anterior sustituía el nombre de usuario directamente en la cadena de comando y ejecutaba el resultado con subprocess.Popen(..., shell=True). Debido a que el nombre de usuario puede originarse de una fuente de autenticación externa (declaraciones de OAuth/OIDC, Kerberos, autenticación de servidor web) en lugar de un valor que pgAdmin controla completamente, un nombre de usuario que contiene metacaracteres de shell (’;’, ’$()’, backticks, pipes, ’&&’, newlines) permitía a un usuario autenticado ejecutar comandos arbitrarios como la cuenta de servicio de pgAdmin en cualquier despliegue donde la cadena de hook configurada usa %u. La corrección tokeniza primero la cadena de hook confiable y configurada por el administrador en un vector de argumentos (usando shlex en modo de citación POSIX, con el escape de barra invertida deshabilitado para que las rutas de estilo Windows no se interpreten incorrectamente), sustituye el nombre de usuario no confiable en los elementos individuales de argv, y ejecuta con shell=False. Por lo tanto, el nombre de usuario siempre está confinado a un único elemento de argv; cualquier metacaracter de shell que contenga es inerte. Los administradores cuyo MASTER_PASSWORD_HOOK dependía anteriormente de características de shell (pipes, redirección, expansión de variables de entorno, globbing) dentro de la propia cadena de hook deben mover esa lógica al script invocado, ya que ya no es interpretado por un shell. Este problema afecta a pgAdmin 4: desde 7.2 antes de 9.17.

Information

Published : 2026-07-31 16:16

Updated : 2026-10-23 23:10


NVD link : CVE-2026-17347

Mitre link : CVE-2026-17347

CVE.ORG link : CVE-2026-17347


JSON object : View

Products Affected

pgadmin

  • pgadmin_4
CWE
CWE-78

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

CWE-88

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