{"id":"CVE-2026-116241","published":"2026-10-30T20:17:03.813","lastModified":"2026-10-30T20:17:03.813","description":"pgAdmin 4's Import/Export Data tool wraps a user's query export in a psql \\copy (...) TO command and checks that the query's parentheses are balanced so that nothing can escape the wrapper. The check rejected a backslash inside a single-quoted string, but not inside a double-quoted identifier, where it treated the next double quote as closing the identifier. psql's \\copy parser applies the connection's escape character to whichever quote opened a token, so with standard_conforming_strings off a backslash-escaped double quote does not close the identifier. pgAdmin's and psql's view of the quoting then diverged, a closing parenthesis hidden from the check ended the \\copy (...) wrapper, and a following TO PROGRAM clause was executed by psql on the pgAdmin host, as the operating-system account running pgAdmin, before the server rejected the statement. An ordinary database role can turn standard_conforming_strings off for itself, and the Import/Export Data permission is granted to non-administrators by default.\n\nThis is a bypass of the fix for CVE-2026-17566. The fix rejects any backslash inside a double-quoted identifier, as was already done for single-quoted strings, since its meaning depends on a server setting that cannot be known reliably when the query is validated.\n\nThis issue affects pgAdmin 4: before 9.19.","cvssScore":9.9,"cvssSeverity":"CRITICAL","cvssVector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H","cwes":["CWE-78","CWE-115"],"vendors":[],"products":[],"references":[{"url":"https://github.com/pgadmin-org/pgadmin4/commit/9be31a019f780647fb689c458408c8803263c812","tags":[]},{"url":"https://github.com/pgadmin-org/pgadmin4/issues/10663","tags":[]}],"exploitRefs":[{"url":"https://github.com/pgadmin-org/pgadmin4/commit/9be31a019f780647fb689c458408c8803263c812","tags":[]},{"url":"https://github.com/pgadmin-org/pgadmin4/issues/10663","tags":[]}],"hasPoc":true,"ai":{"summary":"pgAdmin 4's Import/Export Data tool incorrectly validated SQL queries by rejecting backslashes in single-quoted strings but not in double-quoted identifiers, allowing an attacker to bypass the wrapper and inject a psql TO PROGRAM clause that executes arbitrary commands on the host as the pgAdmin service account.","exploitability":"Exploitation requires valid database credentials (low-privilege roles suffice) and the ability to craft a malicious query with a backslash-escaped double quote inside a double-quoted identifier, which is feasible due to inconsistent quoting handling between pgAdmin's validation and psql's parser when standard_conforming_strings is disabled.","blast_radius":"Successful exploitation grants remote code execution on the pgAdmin host as the service account, potentially compromising the entire system and enabling lateral movement within the database environment.","remediation":"Upgrade to pgAdmin 4 version 9.19 or later, which patches the validation logic to reject backslashes in double-quoted identifiers.","detection":"Monitor for psql command-line invocations containing 'TO PROGRAM' in pgAdmin service logs or process execution logs on the host; also watch for unexpected child processes spawned by the pgAdmin service with non-standard command-line arguments.","tags":["rce","sql-injection","web","authentication-bypass","escape"],"model":"garnet-coder","analyzedAt":"2026-10-31T08:45:28.530Z"}}