目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1359 元

100%

CVE-2025-2945 PoC — pgAdmin 安全漏洞

来源
关联漏洞
标题: pgAdmin 安全漏洞 (CVE-2025-2945)
Description:pgAdmin是pgAdmin开源的一个用于开源数据库 PostgreSQL 的开源管理和开发平台。 pgAdmin 4 9.2之前版本存在安全漏洞,该漏洞源于不安全地将参数传递给eval函数,可能导致远程代码执行。
Description
Exploit and test stand for CVE-2025-2945
介绍
# pgAdminOpendoor (CVE-2025-2945)

<p align="center">
<img src="logo.jpg" width="450">
</p>

### Overview
This is my research on CVE-2025-2945. This repo includes a test stand with postgress and vulnerable pgadmin, and exploit.

### CVE

Usefull links:
- [NVD Details](https://nvd.nist.gov/vuln/detail/CVE-2025-2945)
- [WIZ Analyze](https://www.wiz.io/vulnerability-database/cve/cve-2025-2945)
- [Metasploit](https://github.com/rapid7/metasploit-framework/issues/20011)

## Breakdown

In pgAdmin backend, which is written in python, there are two endpoint with lack of proper sanitization. Endpoints are:
- `/sqleditor/query_tool/download` - `query_commited` parameter
- `/cloud/deploy` - `high_availability` parameter

Let's look at the [code of sqleditor](https://github.com/pgadmin-org/pgadmin4/blob/a2b35b35f303348f3ec9a8c1a2e84810245b4c56/web/pgadmin/tools/sqleditor/__init__.py#L2159):
```python
for key, value in data.items():
    if key == 'query':
        sql = value
    if key == 'query_commited':
        query_commited = (
            eval(value) if isinstance(value, str) else value
        )
```

What we see here, is the value of `query_commited` been directly passed to `eval()` function. You can see the [docs for eval](https://docs.python.org/3/library/functions.html#eval).

Also see the [code of pgacloud](https://github.com/pgadmin-org/pgadmin4/blob/a2b35b35f303348f3ec9a8c1a2e84810245b4c56/web/pgacloud/providers/google.py#L139):
```python
def _create_google_postgresql_instance(self, args):
    credentials = self._get_credentials(self._scopes)
    service = discovery.build('sqladmin', 'v1beta4',
                              credentials=credentials)
    high_availability = \
        'REGIONAL' if eval(args.high_availability) else 'ZONAL'
```

Same problem here.

It still requires a valid creds and access to pgadmin to reach this endpoints. But any attacker, able to access it, is also able to pass any value to eval. Which is equal to executing any python oneliner. 

## Exploitation

Exploitation is pretty straight-forward. See the `exploit/src/main.py`. Don't forget to update the config in order to get a reverse shell.

## Stand Setup

To setup stand run this:
```bash
cd stand
docker compose up -d
```

And that's it. pgAdmin is now accessable at `http://localhost:8080`. Default creds are:
```
admin@example.com
admin
```

Feel free to edit the `.env` file and `stand/init-db/01-init.sql`.

---

prod by _I3r1h0n_.
文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →