CVE-2026-17346: pgAdmin 4: SQL injection via unescaped object names in index Statistics and publication/subscription dependency views (incomplete fix for CVE-2026-12044)
The fix for CVE-2026-12044 in pgAdmin 4 9.16 hardened qtLiteral and switched sixteen COMMENT ON / pgstattuple / pgstatindex templates to it, but missed several sinks that had been placed in testsqlstringliterallint.py's ALLOWLIST on the incorrect assumption that schema, table, publication, and subscription names sourced from pgcatalog via the browser tree could never contain an apostrophe. PostgreSQL permits arbitrary characters in quoted identifiers, so a low-privileged user able to CREATE TABLE, CREATE PUBLICATION, or CREATE SUBSCRIPTION can plant an apostrophe'd object name that breaks out of the unescaped '{{ name }}' template interpolation the moment any user (including a higher-privileged one) opens that object's Statistics or Dependencies tab, allowing arbitrary SQL statement injection in the viewing user's database session.
Affected sinks: the Index Statistics query for all-indexes listing (collstats.sql, both the 16plus and default PostgreSQL-version template variants -- distinct from the single-index stats.sql path already fixed in CVE-2026-12044), and the publication and subscription dependencies.sql / getposition.sql templates (both the pg and ppas/EPAS dialect variants for publications).
Fix switches all of these templates to qtLiteral(conn) for name interpolation, and updates publications/init.py and subscriptions/init.py to pass conn=self.conn into the dependencies.sql rendertemplate call so the qtLiteral filter has a connection to quote against. The corresponding ALLOWLIST entries in testsqlstringliterallint.py are removed now that these sinks are properly escaped rather than merely assumed safe. A behavioral regression test renders each fixed template with a stacked-statement apostrophe payload and asserts both that the object name appears exactly as qtLiteral-escaped and that the rendered SQL parses as exactly one statement, verifying the assertion genuinely fails against the pre-patch raw-interpolation form.
This issue affects pgAdmin 4: the Index Statistics sink from 1.0, and the Publications/Subscriptions sinks from 5.0, both before 9.17.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pgAdmin 4to a version that resolves this vulnerability.Fixed in 9.17 - Configuration
Update the Index Statistics coll_stats.sql templates (all-indexes listing) to interpolate object names using qtLiteral(conn) (applies to both the 16_plus and default PostgreSQL-version template variants).
pgAdmin 4 templates (coll_stats.sql) name interpolation filter = qtLiteral(conn) - Configuration
Update the publication/subscription dependency templates dependencies.sql and get_position.sql to interpolate object names using qtLiteral(conn) (applies to both the pg and ppas/EPAS dialect variants for publications).
pgAdmin 4 templates (dependencies.sql / get_position.sql) name interpolation filter = qtLiteral(conn) - Configuration
Update publications/__init__.py and subscriptions/__init__.py so the dependencies.sql render_template call passes conn=self.conn, ensuring the qtLiteral filter has a connection to quote against.
pgAdmin 4 Python rendering code render_template call context = conn=self.conn - Configuration
Remove the corresponding allowlist entries in test_sql_string_literal_lint.py that previously allowed these sinks under the incorrect assumption they were safe without proper escaping.
pgAdmin 4 test_sql_string_literal_lint.py ALLOWLIST entries for sinks = removed
Event History
Frequently Asked Questions
What is the severity of CVE-2026-17346?
The severity of CVE-2026-17346 is high, rated at 8.7.
How do I fix CVE-2026-17346?
To fix CVE-2026-17346, users should upgrade to the latest version of pgAdmin 4 that includes patches addressing this SQL injection vulnerability.
What type of vulnerability is CVE-2026-17346?
CVE-2026-17346 is categorized as an SQL injection vulnerability.
What applications are impacted by CVE-2026-17346?
CVE-2026-17346 impacts pgAdmin 4 software.
Why is CVE-2026-17346 considered important?
CVE-2026-17346 is important because it can lead to unauthorized access and manipulation of database information due to the SQL injection vulnerability.