{"id":"CVE-2026-7816","summary":"pgAdmin 4: OS command injection in Import/Export query export via psql metacommand breakout","details":"OS command injection (CWE-78) vulnerability in pgAdmin 4 Import/Export query export.\n\nUser-supplied input was interpolated directly into a psql \\copy metacommand template without sanitization. An authenticated user could inject \") TO PROGRAM 'cmd'\" to break out of the \\copy (...) context and achieve arbitrary command execution on the pgAdmin server, or \") TO '/path'\" for arbitrary file write. Additional fields (format, on_error, log_verbosity) were also raw-interpolated and exploitable.\n\nFix adds a parens-balance parser modeled on psql's strtokx tokenizer, allow-lists format/on_error/log_verbosity, rejects null bytes in the query, and tightens type and gating checks.\n\nThis issue affects pgAdmin 4: before 9.15.","aliases":["GHSA-j74f-g7vx-fh4x","PYSEC-2026-2870"],"modified":"2026-07-15T01:49:04.655218757Z","published":"2026-05-11T14:35:50.827Z","related":["CGA-7mqv-2cf3-9c6w"],"database_specific":{"cna_assigner":"PostgreSQL","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/7xxx/CVE-2026-7816.json"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/7xxx/CVE-2026-7816.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-7816"},{"type":"REPORT","url":"https://github.com/pgadmin-org/pgadmin4/issues/9899"},{"type":"PACKAGE","url":"https://github.com/pgadmin-org/pgadmin4"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/pgadmin-org/pgadmin4","events":[{"introduced":"7c74b7cdb764d54ba7f42e0644b3f1d3ee7c786f"},{"fixed":"86a8b165abbefd62e78fd43edcd66c0d09649442"}],"database_specific":{"extracted_events":[{"introduced":"9.4"},{"fixed":"9.15"}],"source":["AFFECTED_FIELD","CPE_RANGE"],"cpe":"cpe:2.3:a:pgadmin:pgadmin_4:*:*:*:*:*:postgresql:*:*"}}],"versions":["REL-9_14","REL-9_13","REL-9_12","REL-9_11","REL-9_10","REL-9_9","REL-9_8","REL-9_7","REL-9_6","REL-9_5","REL-9_4"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-7816.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"}]}