Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessPlant backslash-quote payload in AI-readable DB object
-
DeliveryUser invokes AI Assistant on that content
-
ExploitLLM emits payload to execute_sql_query
-
Executionsqlparse validates it as single SELECT
-
PersistPostgreSQL executes smuggled COMMIT plus writes
-
ImpactCOPY TO PROGRAM runs OS command on host
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Persistence The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires pgAdmin 4 9.13-9.16 with the AI Assistant feature enabled and connected to an LLM backend, targeting a PostgreSQL server running with standard_conforming_strings = on (PostgreSQL's default since 9.1) and the per-server 'Prepare threshold' field left blank (the pgAdmin default of None), which forces psycopg3 into the multi-statement-capable simple query protocol. The attacker must be able to plant the backslash-quote payload into any object the AI Assistant may read (indirect prompt injection), and a user must invoke the Assistant such that the LLM emits that content as an execute_sql_query tool call (UI:P). Exploitation is limited by these prerequisites: the optional AI Assistant must be turned on, the attack depends on the LLM reliably re-emitting the payload (non-deterministic), a low-privilege authenticated context is involved (PR:L), and setting a non-null Prepare threshold or a PostgreSQL configuration with standard_conforming_strings = off would break the parser-differential. |
| Impact | This is a genuine high-priority issue rather than an inflated CVSS score: the CVSS 4.0 vector (AV:N/AC:L/PR:L/UI:P) combined with high confidentiality, integrity, and availability impact on both the vulnerable and subsequent systems reflects a realistic path to write access and remote code execution (via COPY TO PROGRAM) on the database host. Working PoC payloads are published in the vendor's own security regression tests, and the technical writeup was verified against a live PostgreSQL 18 instance, so exploitability is concrete rather than theoretical. Countervailing factors lower real-world reach: exploitation requires the optional AI Assistant feature to be enabled with an LLM backend, a user to invoke the Assistant against attacker-controlled content (UI:P), and the indirect prompt-injection step depends on the LLM reliably emitting the payload as a tool call - a non-deterministic link. EPSS and KEV data are absent from the input, so probabilistic exploitation likelihood cannot be quantified and there is no confirmation of active exploitation; the risk is best read as high-impact but gated by feature adoption and the prompt-injection delivery path. |
| Exploit ScenarioDerived | An attacker plants a crafted SQL string such as SELECT '\';COMMIT;CREATE TABLE pwn(x int);SELECT 1 --' inside a comment, table row, or object description the AI Assistant may later read. When a legitimate user asks the Assistant a question that causes the LLM to read and re-emit that content to execute_sql_query, sqlparse validates it as a single benign SELECT while PostgreSQL executes the smuggled COMMIT and follow-on statements, escaping the read-only wrapper to write data or, via COPY TO PROGRAM, run OS commands on the database host. Publicly documented PoC payloads (including COMMIT followed by COPY TO PROGRAM 'id > /tmp/id.txt') exist in the vendor's regression tests, and the network attack vector with low complexity makes the database-side execution reliable once the LLM emits the payload. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 31, 2026
SQL injection sandbox escape in pgAdmin 4's AI Assistant (versions 9.13 through 9.16) lets an attacker break out of the read-only transaction wrapper on the execute_sql_query tool and run arbitrary write or OS commands on the backend PostgreSQL server. The flaw is an incomplete fix for CVE-2026-12045: the sqlparse-based validator disagrees with PostgreSQL over backslash-before-quote string escaping, so a crafted SELECT parses as one statement to the guard but executes as four statements (including a smuggled COMMIT) on the database. Delivery is via indirect prompt injection, and detailed PoC payloads exist publicly in the vendor's regression tests; there is no public exploit identified as used in the wild and no KEV listing, with EPSS data not provided.
RemediationAI
Upgrade to pgAdmin 4 9.17 or later, which structurally forces the PostgreSQL extended query protocol by setting prepare_threshold = 0 on the AI Assistant's read-only connection (Vendor-released patch: 9.17; see commits bf4792444446f0e7ab721d23cbd6bfe6afaa7a8b and ef76102bcd1cdb544eb9b4ef18d3382f22b76752 and issue https://github.com/pgadmin-org/pgadmin4/issues/10192). If immediate upgrade is not possible, disable the AI Assistant / LLM integration entirely, which removes the vulnerable execute_sql_query path at the cost of losing that feature. As a partial compensating control, explicitly set a non-null per-server Prepare threshold so psycopg3 uses the extended query protocol, though this is configuration-dependent and less reliable than the patch. Additionally, restrict which database objects and content the AI Assistant is permitted to read to reduce indirect prompt-injection surface, and run the connected PostgreSQL server under a least-privilege role without superuser or COPY TO PROGRAM rights to blunt the RCE impact - noting this narrows but does not eliminate write-bypass risk.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The vulnerable component is pgAdmin 4's LLM-integrated AI Assistant and its execute_sql_query tool, which validates LLM-supplied SQL with the Python sqlparse library before running it inside a BEGIN TRANSACTION READ ONLY wrapper. The root cause (CWE-89, SQL Injection) is a parser-differential: with PostgreSQL's default standard_conforming_strings = on (default since 9.1), a backslash immediately before a quote is a literal character, but sqlparse treats it as escaping the quote. This desynchronization means sqlparse sees a single SELECT where PostgreSQL sees multiple statements, allowing a smuggled COMMIT to terminate the protective read-only transaction. A first candidate fix using psycopg execute(prepare=True) failed because psycopg3's PrepareManager ignores the prepare flag when the connection's prepare_threshold is None - pgAdmin's default - falling back to the simple query protocol that permits multi-statement text. The corrected fix sets conn.prepare_threshold = 0 on the dedicated single-use read-only connection, forcing PostgreSQL's extended query protocol so its own Parse step rejects multi-statement input regardless of server configuration.
Know when Pgadmin 4 gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H
Network-reachable low-complexity flaw needing a low-privilege session (PR:L) and a user invoking the Assistant (UI:R); the read-only sandbox escape to OS command execution crosses scope (S:C) with full C/I/A impact.
AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H
Primary rating from Vendor (f86ef6dc-4d3a-42ad-8f28-e6d5547a5007).
CVSS VectorVendor: f86ef6dc-4d3a-42ad-8f28-e6d5547a5007
Lifecycle Timeline
2DescriptionCVE.org
The fix for CVE-2026-12045 in pgAdmin 4 9.16 required the LLM-supplied query passed to the AI Assistant's execute_sql_query tool to parse, via sqlparse, as exactly one non-transaction-control statement before running it inside a BEGIN TRANSACTION READ ONLY wrapper. sqlparse's string-literal lexing can disagree with PostgreSQL's own parser: under standard_conforming_strings = on (PostgreSQL's default since 9.1), a backslash immediately before a quote is an ordinary character to PostgreSQL, but sqlparse treats it as escaping the quote. A payload such as SELECT '\';COMMIT;CREATE TABLE pwn(x int);SELECT 1 --' therefore parses as a single SELECT to sqlparse's validator, while PostgreSQL executes it as four statements: the smuggled COMMIT ends the wrapping read-only transaction, and the trailing ROLLBACK becomes a no-op. This reintroduces the same write/RCE bypass CVE-2026-12045 was meant to close, reachable via the same indirect prompt-injection delivery (an attacker plants the payload in any object the AI Assistant may read; the LLM emits it as a tool call).
An initial candidate fix ran the query with psycopg's execute(..., prepare=True), intending to force PostgreSQL's own Parse step (extended query protocol) to reject multi-statement text regardless of sqlparse's classification. This candidate fix does not work as submitted: psycopg3's PrepareManager silently ignores the prepare argument whenever the connection's prepare_threshold is None, which is pgAdmin's default for every server connection (the per-server "Prepare threshold" field is blank unless an administrator explicitly sets it) -- psycopg3 falls back to the simple query protocol, the same multi-statement-capable path the bypass exploits, so the candidate fix closes nothing on any real-world default configuration.
The corrected fix sets conn.prepare_threshold = 0 directly on the dedicated, single-use read-only connection the AI Assistant tool opens, structurally forcing the extended query protocol independent of any server-level configuration. Verified against a live PostgreSQL 18 instance: the payload executes successfully under the prepare_threshold=None (default) behavior, and is rejected with "cannot insert multiple commands into a prepared statement" once prepare_threshold=0 is set on that connection.
This issue affects pgAdmin 4: from 9.13 before 9.17.
Articles & Coverage 2
Executive ViewAI
pgAdmin 4 versions 9.13-9.16 contain a critical SQL injection vulnerability in the AI Assistant that enables attackers to execute arbitrary commands on the PostgreSQL database server. Organizations using this feature face complete database compromise risk, including unauthorized data access, modification, or destruction. Immediate disabling of the AI Assistant is required pending vendor patch availability.
No vendor-released patch identified at time of analysis. Disable the AI Assistant feature in pgAdmin 4; restrict pgAdmin access to named administrative users only; implement network-level controls limiting database server connectivity from pgAdmin hosts; establish continuous monitoring for suspicious SQL statements and OS command execution on PostgreSQL backends; maintain comprehensive audit logs of all AI Assistant queries.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
pgAdmin <= 8.3 is affected by a path-traversal vulnerability while deserializing users’ sessions in the session handling
pgAdmin <= 8.4 is affected by a Remote Code Execution (RCE) vulnerability through the validate binary path API. Rated cr
Remote unauthenticated access to two SQL Editor endpoints in pgAdmin 4 server-mode deployments (versions 6.9 through 9.1
The pgAdmin server includes an HTTP API that is intended to be used to validate the path a user selects to external Post
pgAdmin versions 8.11 and earlier are vulnerable to a security flaw in OAuth2 authentication. Rated medium severity (CVS
Remote code execution in pgAdmin 4 (versions up to and including 9.9) lets an attacker who can get a crafted PLAIN-forma
Remote SQL injection via prompt injection in pgAdmin 4 versions 9.13 through 9.15 allows attackers who can write content
OS command injection in pgAdmin 4 (all versions before 9.18) lets an authenticated user with the commonly-granted tools_
Authorization bypass and privilege escalation in pgAdmin 4 server mode allows authenticated users to access other users'
pgAdmin <= 8.5 is affected by XSS vulnerability in /settings/store API response json payload. Rated medium severity (CVS
Authentication bypass in pgAdmin 4 (versions 6.2 through 9.17) lets any client that can reach the pgAdmin web interface
Same weakness CWE-89 – SQL Injection
View allVendor StatusVendor
SUSE
Severity: Critical| Product | Status |
|---|---|
| SUSE Linux Enterprise Desktop 15 SP7 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP7 | Not-Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP7 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP7 | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP7 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS | Not-Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP6 | Not-Affected |
| SUSE Linux Enterprise Module for Server Applications 15 SP4 | Not-Affected |
| SUSE Linux Enterprise Module for Server Applications 15 SP5 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP4 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Not-Affected |
| SUSE Linux Enterprise Server 15 SP5 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP5-LTSS | Not-Affected |
| SUSE Linux Enterprise Server 15 SP6 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Not-Affected |
| SUSE Manager Proxy 4.3 | Not-Affected |
| SUSE Manager Proxy LTS 4.3 | Not-Affected |
| SUSE Manager Retail Branch Server 4.3 | Not-Affected |
| SUSE Manager Retail Branch Server LTS 4.3 | Not-Affected |
| SUSE Manager Server 4.3 | Not-Affected |
| SUSE Manager Server LTS 4.3 | Not-Affected |
| SUSE CaaS Platform 4.0 | Not-Affected |
| SUSE Enterprise Storage 6 | Not-Affected |
| SUSE Enterprise Storage 7 | Not-Affected |
| SUSE Enterprise Storage 7.1 | Not-Affected |
| SUSE Linux Enterprise Desktop 15 SP6 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP1 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP1-ESPOS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP1-LTSS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP2 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP2-ESPOS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP2-LTSS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP3 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP3-ESPOS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP3-LTSS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP6 | Not-Affected |
| SUSE Linux Enterprise Module for Server Applications 15 SP1 | Not-Affected |
| SUSE Linux Enterprise Module for Server Applications 15 SP2 | Not-Affected |
| SUSE Linux Enterprise Module for Server Applications 15 SP3 | Not-Affected |
| SUSE Linux Enterprise Real Time 15 SP2 | Not-Affected |
| SUSE Linux Enterprise Real Time 15 SP3 | Not-Affected |
| SUSE Linux Enterprise Real Time 15 SP4 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP1 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP1-BCL | Not-Affected |
| SUSE Linux Enterprise Server 15 SP1-LTSS | Not-Affected |
| SUSE Linux Enterprise Server 15 SP2 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP2-BCL | Not-Affected |
| SUSE Linux Enterprise Server 15 SP2-LTSS | Not-Affected |
| SUSE Linux Enterprise Server 15 SP3 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP3-BCL | Not-Affected |
| SUSE Linux Enterprise Server 15 SP3-LTSS | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP1 | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP2 | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP3 | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Not-Affected |
| SUSE Manager Proxy 4.0 | Not-Affected |
| SUSE Manager Proxy 4.1 | Not-Affected |
| SUSE Manager Proxy 4.2 | Not-Affected |
| SUSE Manager Retail Branch Server 4.0 | Not-Affected |
| SUSE Manager Retail Branch Server 4.1 | Not-Affected |
| SUSE Manager Retail Branch Server 4.2 | Not-Affected |
| SUSE Manager Server 4.0 | Not-Affected |
| SUSE Manager Server 4.1 | Not-Affected |
| SUSE Manager Server 4.2 | Not-Affected |
| openSUSE Leap 15.3 | Not-Affected |
| openSUSE Leap 15.4 | Not-Affected |
| openSUSE Leap 15.5 | Not-Affected |
| openSUSE Leap 15.6 | Not-Affected |
EUVD-2026-51564
GHSA-v5gm-27gp-4f7w
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB