DISPUTED In PostgreSQL 9.3 through 11.2, the “COPY TO/FROM PROGRAM” function allows superusers and users in the ‘pg_execute_server_program’ group to execute arbitrary code in the context of the database’s operating system user. This functionality is enabled by default and can be abused to run arbitrary operating system commands on Windows, Linux, and macOS. NOTE: Third parties claim/state this is not an issue because PostgreSQL functionality for ‘COPY TO/FROM PROGRAM’ is acting as intended. References state that in PostgreSQL, a superuser can execute commands as the server user without using the ‘COPY FROM PROGRAM’.
Recent assessments:
pbarry-r7 at November 21, 2019 11:16pm UTC reported:
There’s some interesting debate around the couching of this as a vuln in PostgreSQL, itself, since the COPY TO/FROM PROGRAM is ostensibly documented to allow program execution. Certainly a good reminder to, in general, limit privs where possible (in this case, don’t grant ‘pg_execute_server_program’ to users who don’t require it).
Assessed Attacker Value: 2
Assessed Attacker Value: 2Assessed Attacker Value: 5
packetstormsecurity.com/files/152757/PostgreSQL-COPY-FROM-PROGRAM-Command-Execution.html
blog.hagander.net/when-a-vulnerability-is-not-a-vulnerability-244
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-9193
medium.com/greenwolf-security/authenticated-arbitrary-command-execution-on-postgresql-9-3-latest-cd18945914d5
paquier.xyz/postgresql-2/postgres-9-3-feature-highlight-copy-tofrom-program
security.netapp.com/advisory/ntap-20190502-0003
www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/authenticated-arbitrary-command-execution-on-postgresql-9-3