SQL injection in pgadmin.org pgAdmin 4
Key facts
- Attack vector
- Network
- Privileges required
- Low
- User interaction
- Passive
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- SQL injection
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA. Impact type from CWE-89.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| pgadmin.org | pgAdmin 4 | 9.13 to before 9.17 | 9.17 | Patch available | CNA |
- pgAdmin 4 Vendorpgadmin.org Affected 9.13 to before 9.17 Fixed in 9.17 Patch available CNA
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:pgadmin:pgadmin_4:*:*:*:*:*:postgresql:*:* | 9.13 to before 9.17 | Vulnerable | pgadmin.org |
- cpe:2.3:a:pgadmin:pgadmin_4:*:*:*:*:*:postgresql:*:* Versions 9.13 to before 9.17 Vulnerable ·pgadmin.org
Remediation
- Fix · CNA pgAdmin 4 (pgadmin.org) Fixed in 9.17
Fixed in the same release
Records fixed by the same vendor advisory or release, as the CNA lists them.
- Release ·
pgadmin.org pgAdmin 4 9.17
6 records Highest priority Priority MEDIUM 3 MEDIUM, 3 LOW
Other records, highest priority first
- TI-2026-14309 pgAdmin 4: Adhoc server clone leaks another user's stored database credentials and ownership to a non-ownerPriority MEDIUM 42
- TI-2026-14306 SQL injection in pgadmin.org pgAdmin 4Priority MEDIUM 41
- TI-2026-14308 Missing authentication in pgadmin.org pgAdmin 4Priority LOW 37
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2026-17351
- 2026-10-03 Alias added: GHSA-v5gm-27gp-4f7w
References
More pgadmin.org Pgadmin 4 vulnerabilities
- TI-2024-01901 Unsafe Deserialisation and Remote Code Execution by an Authenticated user in pgAdmin 4 CVSS 3.1CRITICAL 9.9
- TI-2024-02918 Remote Code Execution Vulnerability through the validate binary path API in pgAdmin 4 CVSS 3.1CRITICAL 9.8
- TI-2022-03867 Code injection in pgadmin4 CVSS 3.1HIGH 8.8
- TI-2026-06875 pgAdmin 4: Cross-user data access and shared-server privilege escalation in server mode CVSS 4.0CRITICAL 9.4
- TI-2025-02572 pgAdmin 4: Remote Code Execution in Query Tool and Cloud Deployment CVSS 3.1CRITICAL 9.9
- TI-2023-00228 Path traversal in pgadmin CVSS 3.1MEDIUM 6.5
Sources
- CVE-2026-17351 · CVE Program
- CVE-2026-17351 · NVD
- FIRST EPSS
- GHSA-v5gm-27gp-4f7w · GitHub Advisory Database · CC BY 4.0
- CVE-2026-17351 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences