Critical pgAdmin RCE (CVE-2025-13780) Flaw Bypasses Fix, Allowing Server Takeover Via Malicious Database Restore
- Dec 14, 2025
- 2 min read
Key Findings
A critical security vulnerability, CVE-2025-13780, has been discovered in pgAdmin, the popular open-source management tool for PostgreSQL.
The flaw allows attackers to achieve Remote Code Execution (RCE) by exploiting a subtle oversight in how the software processes file encoding.
The vulnerability affects pgAdmin versions up to 9.10 when running in server mode.
It creates a scenario where a routine database restore operation can be weaponized to execute arbitrary commands on the host server.
The issue represents a bypass of a previous security fix, CVE-2025-12762, which introduced a filter to strip out dangerous "meta-commands" from SQL dump files.
Background
pgAdmin is the world's most popular open-source management tool for PostgreSQL databases. It is widely used by database administrators and developers to manage their PostgreSQL infrastructure. The software is available in both desktop and server modes, with the server mode allowing remote administration of databases.
Vulnerability Details
The core of the issue lies in how pgAdmin's security filter, specifically the `has_meta_commands()` function, scans files versus how the underlying `psql` utility executes them. The filter uses a regular expression to scan raw bytes for dangerous commands like `\!` (which allows shell command execution). However, the regex was not designed to account for specific file signatures, such as the UTF-8 Byte Order Mark (BOM)—a sequence of bytes (EF BB BF) often added to the start of text files to indicate encoding.
An attacker can craft a malicious PLAIN-format SQL dump file that begins with the UTF-8 BOM byte sequence. When pgAdmin scans the file, the regex encounters the BOM bytes first. Because it does not recognize them as "ignorable," it fails to detect the dangerous meta-commands hidden immediately after them. The filter assumes the file is safe.
pgAdmin then passes the file to the `psql` utility using the `–file` argument. Unlike the filter, `psql` is designed to handle text encoding intelligently. It automatically strips the BOM bytes, reads the dangerous `\!` meta-command, and executes the attacker's payload. This "parsing mismatch" allows attackers to inject and execute arbitrary commands with the privileges of the user running the pgAdmin server.
Impact and Exploitation
The successful exploitation of this vulnerability could lead to:
Full server compromise
Theft or deletion of sensitive database data
Lateral movement within the network hosting the database infrastructure
Mitigations and Recommendations
Administrators running pgAdmin in server mode should immediately check their version. Since versions up to 9.10 are affected, teams should look for the release of pgAdmin 9.11 or apply vendor-supplied mitigations immediately to close this critical gap.
Related Posts
Critical pgAdmin Flaws (CVE-2025-12762, CVSS 9.1) Allow Remote Code Execution via PostgreSQL Dump Files
CVE-2025-26519 Exposes Applications Using musl libc to Remote Code Execution
PgAdmin Flaw Exposes Accounts to OAuth Hijacking Attacks
pgAdmin 4 Vulnerabilities Expose Databases to Remote Code Execution and XSS
Sources
https://securityonline.info/critical-pgadmin-rce-cve-2025-13780-flaw-bypasses-fix-allowing-server-takeover-via-malicious-database-restore/
https://securityonline.info/critical-plesk-flaw-cve-2025-66430-risks-full-server-takeover-via-lpe-and-apache-config-injection/


Comments