Skip to content

Latest commit

 

History

History

CVE-2019-9193

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

PostgreSQL COPY FROM PROGRAM Command Execution Vulnerability(CVE-2019-9193)

Introduction

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’.

Usage

Run

docker-compose up

Execute the poc in poc folder with

go run main.go

You will got the output

uid=999(postgres) gid=999(postgres) groups=999(postgres),101(ssl-cert)

Reference

  1. https://nvd.nist.gov/vuln/detail/CVE-2019-9193
  2. https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/authenticated-arbitrary-command-execution-on-postgresql-9-3/