CVE-2019-9193
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’.
What to do
Likely to be exploited: EPSS gives a 92% chance of exploitation in the next 30 days. Treat it as urgent if you run an affected version.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 16.04 | postgresql-9.5 | Not affected vulnerable_code_not_present | ||
| Ubuntu 14.04 | postgresql-9.1 | Not affected vulnerable_code_not_present | ||
| Red Hat Enterprise Linux 8 | libpq | Not affected | ||
| Red Hat Enterprise Linux 8 | libpq-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | pg_repack | Not affected | ||
| Red Hat Enterprise Linux 8 | pgaudit | Not affected | ||
| Red Hat Enterprise Linux 8 | postgres-decoderbufs | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-contrib | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-docs | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-plperl | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-plpython3 | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-pltcl | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-private-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-private-libs | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-server | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-server-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-static | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-test | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-test-rpm-macros | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-upgrade | Not affected | ||
| Red Hat Enterprise Linux 8 | postgresql-upgrade-devel | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-contrib | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-devel | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-docs | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-libs | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-plperl | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-plpython | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-pltcl | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-server | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-static | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-test | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-upgrade | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-contrib | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-devel | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-docs | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-libs | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-plperl | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-plpython | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-pltcl | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-server | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql-test | Not affected | ||
| Red Hat Enterprise Linux 5 | postgresql | Not affected |
References
- https://paquier.xyz/postgresql-2/postgres-9-3-feature-highlight-copy-tofrom-program/
- https://medium.com/greenwolf-security/authenticated-arbitrary-command-execution-on-postgresql-9-3-latest-cd18945914d5
- https://blog.hagander.net/when-a-vulnerability-is-not-a-vulnerability-244/
- https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/authenticated-arbitrary-command-execution-on-postgresql-9-3/
- https://security.netapp.com/advisory/ntap-20190502-0003/
- http://packetstormsecurity.com/files/152757/PostgreSQL-COPY-FROM-PROGRAM-Command-Execution.html
- http://packetstormsecurity.com/files/166540/PostgreSQL-11.7-Remote-Code-Execution.html
- http://packetstormsecurity.com/files/171722/PostgreSQL-9.6.1-Remote-Code-Execution.html
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.