Description
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’.
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Metasploit 1 module
-
PostgreSQL COPY FROM PROGRAM Command Execution
exploit/multi/postgres/postgres_copy_from_program_cmd_exec
Exploit-DB 1
- PostgreSQL 9.3 - COPY FROM PROGRAM Command Execution (Metasploit) EDB-46813 · remote · May 8, 2019 · verified
GitHub 9 repositories
-
b4keSn4ke/CVE-2019-9193 ★ 22 · Mar 29, 2022
CVE-2019–9193 - PostgreSQL 9.3-12.3 Authenticated Remote Code Execution
-
geniuszly/CVE-2019-9193 ★ 4 · Oct 6, 2024
is a PoC tool designed to exploit an authenticated Remote Code Execution (RCE) vulnerability in specific versions of PostgreSQL (9.3 - 11.7)
-
wkjung0624/cve-2019-9193 ★ 3 · Feb 12, 2020
PostgreSQL Remote Code Executuon
-
paulotrindadec/CVE-2019-9193 ★ 1 · Feb 1, 2023
-
CyberCTF/vulhub-postgres-cve-2019-9193 ★ 0 · Oct 8, 2026
Vulhub postgres/CVE-2019-9193: PostgreSQL COPY FROM PROGRAM Command Execution (CVE-2019-9193), run with Isoloom
-
CybersRMUTL/CVE-2019-9193-Postgresql-RCE ★ 0 · Jan 21, 2026
-
netw0rk7/CVE-2019-9193-Home-Lab ★ 0 · Nov 17, 2025
This lab simulates CVE-2019-9193 - PostgreSQL COPY FROM PROGRAM RCE
-
corsisechero/CVE-2019-9193byVulHub ★ 0 · Apr 2, 2025
-
jhnhnck/CVE-2019-9193 ★ 0 · Mar 20, 2025
PoC tool designed to exploit an authenticated Remote Code Execution (RCE) vulnerability in certain versions of PostgreSQL (9.3 - 11.7)
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Automated scanner template
A ready-made Nuclei template detects this vulnerability automatically. Vulnerabilities with public scanner templates are typically probed across the internet soon after the template appears — exposed systems should be patched first.
- PostgreSQL 9.3-12.3 Authenticated Remote Code Execution javascript/cves/2019/CVE-2019-9193.yaml
Source: projectdiscovery/nuclei-templates (MIT) — updated daily. Only links are listed.
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