CVE-2025-2945

9.9 CRITICAL

📋 TL;DR

This CVE describes a critical remote code execution vulnerability in pgAdmin 4 where attacker-controlled input is passed to Python's eval() function. Attackers can execute arbitrary code on the pgAdmin server by exploiting two POST endpoints. All pgAdmin 4 installations before version 9.2 are affected.

💻 Affected Systems

Products:
  • pgAdmin 4
Versions: All versions before 9.2
Operating Systems: All platforms running pgAdmin 4
Default Config Vulnerable: ⚠️ Yes
Notes: Affects both desktop and server deployments. The vulnerability exists in default configurations.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise allowing attackers to execute arbitrary commands as the pgAdmin service account, potentially leading to database compromise, lateral movement, and full environment takeover.

🟠

Likely Case

Attackers gain shell access on the pgAdmin server, allowing them to access database credentials, modify data, and potentially pivot to other systems in the network.

🟢

If Mitigated

With proper network segmentation and access controls, impact is limited to the pgAdmin server itself, though database credentials could still be compromised.

🌐 Internet-Facing: HIGH
🏢 Internal Only: HIGH

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires authentication to pgAdmin, but the vulnerability is trivial to exploit once authenticated. Public proof-of-concept exists in the GitHub issue.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 9.2 and later

Vendor Advisory: https://github.com/pgadmin-org/pgadmin4/issues/8603

Restart Required: Yes

Instructions:

1. Backup your pgAdmin configuration and data. 2. Stop the pgAdmin service. 3. Upgrade to pgAdmin 4 version 9.2 or later using your package manager or from source. 4. Restart the pgAdmin service. 5. Verify the upgrade was successful.

🔧 Temporary Workarounds

Disable vulnerable endpoints via reverse proxy

all

Block access to the /sqleditor/query_tool/download and /cloud/deploy endpoints using a web application firewall or reverse proxy.

# Example nginx configuration
location ~ ^/(sqleditor/query_tool/download|cloud/deploy) {
    deny all;
    return 403;
}

Restrict network access

linux

Limit pgAdmin access to trusted IP addresses only using firewall rules.

# Example iptables rule
sudo iptables -A INPUT -p tcp --dport 5050 -s TRUSTED_IP -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 5050 -j DROP

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate pgAdmin from critical systems
  • Enforce strong authentication and limit user privileges to minimize attack surface

🔍 How to Verify

Check if Vulnerable:

Check pgAdmin version: if version is below 9.2, the system is vulnerable. Also check if /sqleditor/query_tool/download and /cloud/deploy endpoints are accessible.

Check Version:

pgadmin4 --version or check the About dialog in the web interface

Verify Fix Applied:

Verify pgAdmin version is 9.2 or higher and test that the vulnerable endpoints no longer accept malicious eval() payloads.

📡 Detection & Monitoring

Log Indicators:

  • Unusual POST requests to /sqleditor/query_tool/download or /cloud/deploy with Python code in parameters
  • Unexpected process execution from pgAdmin service account
  • Authentication logs showing access from unusual locations

Network Indicators:

  • POST requests containing Python eval() payloads to vulnerable endpoints
  • Outbound connections from pgAdmin server to unexpected destinations

SIEM Query:

source="pgadmin.log" AND (url_path="/sqleditor/query_tool/download" OR url_path="/cloud/deploy") AND (param="query_commited" OR param="high_availability") AND payload CONTAINS "eval"

🔗 References

📤 Share & Export