Skip to main content
Mallory
← Back to News
ai-platform-securityinternet-facing-service-vulnerabilityproof-of-concept-releasewidely-deployed-product-advisory

pgAdmin AI Assistant Bypass Reopens Read-Only SQL Restrictions

Emerging Technology Risk · 4 sources · Updated 4mo ago · First seen Jul 31, 2026

pgAdmin AI Assistant Bypass Reopens Read-Only SQL Restrictions

A critical SQL injection flaw tracked as CVE-2026-17351 affects pgAdmin 4 and allows an authenticated remote attacker to induce the product's AI Assistant to bypass intended read-only database protections. The bug is an incomplete fix for CVE-2026-12045 and arises from a parsing mismatch: pgAdmin validates LLM-generated SQL with sqlparse, while PostgreSQL interprets the same input differently, enabling a crafted payload to be seen as a single statement during validation but executed as multiple statements by the database. Public reporting says the issue affects pgAdmin 4 releases before 9.18, including versions 9.13 through 9.16, and a public proof of concept is reportedly available.

By smuggling a COMMIT into the SQL stream, an attacker can escape the read-only transaction wrapper and regain write capability, potentially leading to unauthorized SQL execution, data modification, privilege escalation, security control bypass, and in some environments a return of arbitrary code execution risk through the same indirect prompt-injection path as the earlier bug. Researchers reported that a proposed mitigation using psycopg3 prepared execution failed under default pgAdmin settings because prepare_threshold remained unset, causing fallback to PostgreSQL's simple query protocol; the corrected fix forces conn.prepare_threshold = 0 on the dedicated read-only connection so PostgreSQL rejects multi-statement input via the extended query protocol. Authorities recommend upgrading to the latest vendor patches immediately.

New surface, new adversariesTrack how attackers are adapting to this technology.
Track this risk
Event timeline

How this story unfolded

Events from the most recent confirmed update back to the earliest known activity.

5 events · Aug 3, 2026
  1. Aug 3, 20264mo ago

    ACN warns of multiple pgAdmin vulnerabilities including CVE-2026-17351

    Italy's ACN/CSIRT Italia reported multiple pgAdmin vulnerabilities, including three critical and two high-severity issues, and highlighted CVE-2026-17351 as a critical SQL injection flaw with a public proof of concept reportedly available. It recommended applying the latest vendor security patches.

    Rilevata molteplici vulnerabilità in pgAdmin - ACN
  2. Reported Jul 31, 20264mo ago

    Corrected pgAdmin fix forces extended query protocol

    A corrected mitigation for CVE-2026-17351 set conn.prepare_threshold = 0 on the AI Assistant's dedicated read-only connection so PostgreSQL would reject multi-statement input via the extended query protocol. This replaced an earlier attempted fix using execute(..., prepare=True) that failed under default pgAdmin settings.

    CVE-2026-17351 - pgAdmin 4: AI Assistant read-only transaction bypass via sqlparse/PostgreSQL lexer disagreement (incomplete fix for CVE-2026-12045)
  3. Reported Jul 31, 20264mo ago

    CVE-2026-17351 disclosed as pgAdmin AI Assistant bypass

    CVE-2026-17351 was disclosed as a bypass of the earlier CVE-2026-12045 fix in pgAdmin 4, caused by a mismatch between sqlparse validation and PostgreSQL parsing that lets an attacker smuggle a COMMIT and re-enable write or possible RCE impact through the AI Assistant path. The issue affects pgAdmin 4 versions before 9.17 according to one reference, while another reports affected versions earlier than 9.18.

    CVE-2026-17351 - pgAdmin 4: AI Assistant read-only transaction bypass via sqlparse/PostgreSQL lexer disagreement (incomplete fix for CVE-2026-12045)
  4. Reported Jul 31, 20264mo ago

    Researchers verify CVE-2026-17351 bypass against PostgreSQL 18

    Testing against a live PostgreSQL 18 instance showed that a crafted payload could execute successfully under pgAdmin's default prepare_threshold=None behavior, escaping the intended read-only wrapper. When conn.prepare_threshold was set to 0, PostgreSQL rejected the multi-statement payload.

    CVE-2026-17351 - pgAdmin 4: AI Assistant read-only transaction bypass via sqlparse/PostgreSQL lexer disagreement (incomplete fix for CVE-2026-12045)
  5. Reported Jul 31, 20264mo ago

    pgAdmin 4 version 9.16 ships fix for CVE-2026-12045

    pgAdmin 4 version 9.16 introduced a fix for CVE-2026-12045 that required AI Assistant SQL to parse as exactly one non-transaction-control statement and executed it inside a read-only transaction wrapper. This fix was later found to be incomplete.

    CVE-2026-17351 - pgAdmin 4: AI Assistant read-only transaction bypass via sqlparse/PostgreSQL lexer disagreement (incomplete fix for CVE-2026-12045)
Linked entities

Related entities

Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.

Open in app →
Do you run this?Follow how adversaries are adapting to this technology, and where it touches your stack today.
Track This Risk
Mallory platform

See the full picture, correlated to your attack surface.

This page covers what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which threat actors are using it right now, and what to deploy next.

Exposure mappingMap indicators from this story to your assets and identify affected systems in minutes.
Threat actor evidenceEvery observed campaign, victim, and pivot linked to actors named in this story.
Associated malwareMalware, exploits, and IOCs connected to the activity described here.
Detection signaturesYARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Scheduled alertsGet matching new stories delivered to your team as they break, not the next morning.
AI threadsAsk questions about this story and take action on the answers.