Skip to main content

pgAdmin 4 EUVDEUVD-2026-51564

| CVE-2026-17351 CRITICAL
SQL Injection (CWE-89)
2026-07-31 f86ef6dc-4d3a-42ad-8f28-e6d5547a5007 GHSA-v5gm-27gp-4f7w
9.4
CVSS 4.0 · Vendor: f86ef6dc-4d3a-42ad-8f28-e6d5547a5007
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Plant backslash-quote payload in AI-readable DB object
  2. Delivery
    User invokes AI Assistant on that content
  3. Exploit
    LLM emits payload to execute_sql_query
  4. Execution
    sqlparse validates it as single SELECT
  5. Persist
    PostgreSQL executes smuggled COMMIT plus writes
  6. Impact
    COPY 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.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

pgAdmin 4 9.13 <9.17

Affected Packages

euvd pgadmin_4 fix: 9.17

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

Vendor (f86ef6dc-4d3a-42ad-8f28-e6d5547a5007) PRIMARY 9.4 CRITICAL
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
vuln.today AI 9.0 CRITICAL

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.

3.1 AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H
SUSE 9.0 CRITICAL
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

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
Low
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
High
Subsequent system: Integrity
High
Subsequent system: Availability
High

Lifecycle Timeline

2
Patch available
Jul 31, 2026 - 17:01 EUVD
CVE Published
Jul 31, 2026 - 16:16 cve.org
CRITICAL 9.4

DescriptionCVE.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.

Executive ViewAI

Why It Matters

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.

Business Impact: Severe
Compensating Controls

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

EPSS Score
0.4%
Top 63% exploitable
Prevalence
High
pgAdmin is the most widely deployed PostgreSQL admin tool, though only recent AI-enabled builds
Social Media
2
Sightings
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment Vendor CIRCL GitHub

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.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
Very High
Technical Impact
Total

Priority Score

47
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +47
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2024-2044 CRITICAL POC
9.9 Mar 07

pgAdmin <= 8.3 is affected by a path-traversal vulnerability while deserializing users’ sessions in the session handling

CVE-2024-3116 CRITICAL POC
9.8 Apr 04

pgAdmin <= 8.4 is affected by a Remote Code Execution (RCE) vulnerability through the validate binary path API. Rated cr

CVE-2026-12046 CRITICAL POC
9.5 Jun 18

Remote unauthenticated access to two SQL Editor endpoints in pgAdmin 4 server-mode deployments (versions 6.9 through 9.1

CVE-2022-4223 HIGH POC
8.8 Dec 13

The pgAdmin server includes an HTTP API that is intended to be used to validate the path a user selects to external Post

CVE-2024-9014 MEDIUM POC
6.5 Sep 23

pgAdmin versions 8.11 and earlier are vulnerable to a security flaw in OAuth2 authentication. Rated medium severity (CVS

CVE-2025-12762 CRITICAL
9.8 Nov 13

Remote code execution in pgAdmin 4 (versions up to and including 9.9) lets an attacker who can get a crafted PLAIN-forma

CVE-2026-12045 CRITICAL
9.4 Jun 18

Remote SQL injection via prompt injection in pgAdmin 4 versions 9.13 through 9.15 allows attackers who can write content

CVE-2026-17566 CRITICAL POC
9.4 Jul 31

OS command injection in pgAdmin 4 (all versions before 9.18) lets an authenticated user with the commonly-granted tools_

CVE-2026-7813 CRITICAL
9.4 May 11

Authorization bypass and privilege escalation in pgAdmin 4 server mode allows authenticated users to access other users'

CVE-2024-4216 MEDIUM POC
5.4 May 02

pgAdmin <= 8.5 is affected by XSS vulnerability in /settings/store API response json payload. Rated medium severity (CVS

CVE-2026-86863 CRITICAL
9.3 Sep 17

Authentication bypass in pgAdmin 4 (versions 6.2 through 9.17) lets any client that can reach the pgAdmin web interface

Vendor 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

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy